@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
    --color-primary: #06b6d4; /* Cyan 500 */
    --color-primary-dim: rgba(6, 182, 212, 0.1);
    --color-danger: #ef4444;
    --font-mono: 'JetBrains Mono', monospace;
    --font-display: 'Rajdhani', sans-serif;
}

/* CUSTOM SCROLLBAR */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.3);
    border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(6, 182, 212, 0.6);
}

/* GRID BACKGROUND */
#grid-bg {
    background-image: 
        linear-gradient(rgba(6, 182, 212, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 182, 212, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

/* UI ELEMENTS */
body {
    font-family: 'Rajdhani', sans-serif;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

/* NAVIGATION BUTTONS */
.nav-btn {
    @apply w-full p-3 rounded-lg text-gray-500 transition-all duration-300 flex justify-center items-center relative;
}
.nav-btn:hover, .nav-btn.active {
    @apply bg-cyan-500/10 text-cyan-400;
}
.nav-btn.active::before {
    content: '';
    @apply absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 bg-cyan-500 rounded-r;
}

/* THREAT ANIMATION */
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.2); }
}

.threat-active {
    animation: pulse-red 1.5s infinite;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

/* RADAR GLOW */
.radar-sweep {
    box-shadow: 0 0 20px 10px rgba(6, 182, 212, 0.1);
}

/* TEXT GLOW */
.text-glow {
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}
/* SCAN ANIMATION FOR SENSORS */
@keyframes scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* CAMERA SCANNING EFFECT */
.camera-scan {
    position: relative;
    overflow: hidden;
}

.camera-scan::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #06b6d4, transparent);
    box-shadow: 0 0 10px #06b6d4;
    animation: cameraScan 2s linear infinite;
}

@keyframes cameraScan {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* AUDIO BAR ANIMATION */
.audio-bar {
    transition: height 0.05s ease, background-color 0.1s ease;
}

/* SENSOR GRID */
.sensor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* LIVE INDICATOR */
.live-indicator {
    position: relative;
}

.live-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: livePulse 1s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* SENSOR VALUE FLASH */
.sensor-update {
    animation: sensorFlash 0.3s ease;
}

@keyframes sensorFlash {
    0% { color: #06b6d4; text-shadow: 0 0 10px #06b6d4; }
    100% { color: inherit; text-shadow: none; }
}

/* CAMERA SCANNING EFFECT */
.camera-scan {
    position: relative;
    overflow: hidden;
}

.camera-scan::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #06b6d4, transparent);
    box-shadow: 0 0 10px #06b6d4;
    animation: cameraScan 2s linear infinite;
}

@keyframes cameraScan {
    0% { top: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* AUDIO BAR ANIMATION */
.audio-bar {
    transition: height 0.05s ease, background-color 0.1s ease;
}

/* SENSOR GRID */
.sensor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* LIVE INDICATOR */
.live-indicator {
    position: relative;
}

.live-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: livePulse 1s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* SENSOR VALUE FLASH */
.sensor-update {
    animation: sensorFlash 0.3s ease;
}

@keyframes sensorFlash {
    0% { color: #06b6d4; text-shadow: 0 0 10px #06b6d4; }
    100% { color: inherit; text-shadow: none; }
}
/* BLINKING CURSOR */
.cursor-blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* CRT FLICKER ANIMATION */
@keyframes flicker {
    0% { opacity: 0.97; }
    5% { opacity: 0.95; }
    10% { opacity: 0.9; }
    15% { opacity: 0.95; }
    20% { opacity: 0.99; }
    50% { opacity: 0.95; }
    80% { opacity: 0.9; }
    100% { opacity: 0.97; }
}

.crt-flicker {
    animation: flicker 0.15s infinite;
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 16, 16, 0.1);
    z-index: 9998;
}
/* MODAL TRANSITION */
#threat-modal {
    transition: opacity 0.3s ease;
}

/* TOAST ANIMATIONS */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.toast-enter {
    animation: slideIn 0.3s ease forwards;
}

.toast-exit {
    animation: slideOut 0.3s ease forwards;
}

/* ENHANCED GRID ANIMATION */
#grid-bg {
    background-image: 
        linear-gradient(rgba(6, 182, 212, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 182, 212, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: perspective(500px) rotateX(60deg) translateY(0); }
    100% { transform: perspective(500px) rotateX(60deg) translateY(50px); }
}

/* ENHANCED RADAR GLOW */
.radar-container {
    position: relative;
}

.radar-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg, transparent, rgba(6, 182, 212, 0.1), transparent);
    z-index: -1;
    pointer-events: none;
}

/* BLIP PULSE */
@keyframes blipPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}

.blip-detected {
    animation: blipPulse 0.5s ease;
}

/* KEYBOARD SHORTCUT HINTS */
kbd {
    background: rgba(6, 182, 212, 0.2);
    border: 1px solid rgba(6, 182, 212, 0.4);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #06b6d4;
}

/* SMOOTH PAGE TRANSITIONS */
main {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* AUDIO ENABLED INDICATOR */
.audio-enabled::after {
    content: '🔊';
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    opacity: 0.5;
}

/* REAL-TIME CONNECTED STATUS */
.status-connected {
    position: relative;
}

.status-connected::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.5; transform: translateY(-50%) scale(1.2); }
}

/* ENHANCED SCROLLBAR FOR DARK THEME */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(6, 182, 212, 0.3) transparent;
}

/* HOVER EFFECTS FOR INTERACTIVE ELEMENTS */
.nav-btn {
    position: relative;
    overflow: hidden;
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #06b6d4;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-btn:hover::after, .nav-btn.active::after {
    width: 60%;
}

/* ALERT BADGE PULSE */
.alert-badge {
    position: relative;
}

.alert-badge::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: alertPulse 2s infinite;
}

@keyframes alertPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}