@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #020617;
    --primary-neon: #06b6d4;
    --primary-blue: #3b82f6;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    
    --border-glow: rgba(6, 182, 212, 0.2);
    --border-glow-focus: rgba(56, 189, 248, 0.65);
    
    --bg-glass: rgba(8, 14, 27, 0.55);
    --bg-glass-heavy: rgba(5, 9, 20, 0.85);
    
    --safe-green: #10b981;
    --safe-green-glow: rgba(16, 185, 129, 0.25);
    --danger-red: #ef4444;
    --danger-red-glow: rgba(239, 68, 68, 0.35);
    --warning-yellow: #f59e0b;
    --warning-yellow-glow: rgba(245, 158, 11, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', 'Outfit', sans-serif;
}

body {
    min-height: 100vh;
    background-color: var(--bg-dark);
    /* Sleek, professional dark SaaS ambient gradients matching contact.html */
    background: 
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
        linear-gradient(180deg, #020617 0%, #070a13 100%);
    color: var(--text-main);
    overflow-x: hidden;
    position: relative;
}

/* ===== CANVAS BACKDROP & SCRIPTS ===== */
#particle-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.laser-scan-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-neon), transparent);
    box-shadow: 0 0 15px 2px var(--primary-neon);
    animation: screenScan 8s infinite linear;
    z-index: 2;
    pointer-events: none;
}

@keyframes screenScan {
    0% { top: 0%; opacity: 0.1; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { top: 100%; opacity: 0.1; }
}

/* ===== CYBER HUD OVERLAYS ===== */
.cyber-hud-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    font-family: 'Space Grotesk', sans-serif;
}

.hud-tag {
    position: absolute;
    font-size: 11px;
    font-weight: 700;
    color: rgba(6, 182, 212, 0.35);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hud-top-left { top: 90px; left: 40px; display: flex; flex-direction: column; gap: 4px; }
.hud-top-right { top: 90px; right: 40px; text-align: right; }
.hud-bottom-left { bottom: 40px; left: 40px; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--safe-green);
    letter-spacing: 1px;
    text-shadow: 0 0 8px var(--safe-green-glow);
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: var(--safe-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--safe-green);
    animation: activePulse 1.6s infinite ease-in-out;
}

@keyframes activePulse {
    0% { transform: scale(0.9); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.5; }
}

/* ===== NAVBAR STYLES HANDLED BY CENTRAL NAVBAR_RESPONSIVE.CSS ===== */

/* ===== MAIN WORKSPACE ===== */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 5;
    position: relative;
}

.main {
    flex: 1;
    padding: 170px 60px 40px 60px;
    max-width: 1500px;
    margin: 0 auto;
    width: 100%;
}

.main h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff, var(--primary-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}

.subtitle {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 700px;
    line-height: 1.5;
}

/* ===== HIGH TECH GRID SYSTEM ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    grid-template-rows: auto;
    gap: 30px;
    margin-bottom: 40px;
}

/* ===== PREMIUM GLASSMORPHIC CARDS ===== */
.box {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: 20px;
    padding: 26px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
    position: relative;
    overflow: hidden;
}

.box:hover {
    transform: translateY(-3px);
    border-color: rgba(6, 182, 212, 0.35);
    box-shadow: 0 15px 35px rgba(6, 182, 212, 0.12), 0 5px 15px rgba(0, 0, 0, 0.5);
}

.box::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.3), transparent);
}

.box-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.box-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 12px rgba(248, 250, 252, 0.2);
}

.box-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.4;
}

/* Also support h4, h2, p for older markup patterns in some cards */
.box h4 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.box h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 12px rgba(248, 250, 252, 0.2);
    margin-bottom: 4px;
}

.box p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.4;
}

/* ===== CAMERA VIEWPORT OPERATOR CONSOLE ===== */
.box.camera {
    grid-column: 1;
    grid-row: span 2;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 480px;
}

.camera-viewport-wrapper {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(6, 182, 212, 0.3);
    background: #020617;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(6, 182, 212, 0.15);
    margin-top: 10px;
}

/* High-tech Viewfinder corners */
.camera-viewport-wrapper::before,
.camera-viewport-wrapper::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--primary-neon);
    border-style: solid;
    pointer-events: none;
    z-index: 10;
    opacity: 0.85;
}

.camera-viewport-wrapper::before {
    top: 12px;
    left: 12px;
    border-width: 2px 0 0 2px;
}

.camera-viewport-wrapper::after {
    bottom: 12px;
    right: 12px;
    border-width: 0 2px 2px 0;
}

.camera-box {
    width: 100%;
    height: 320px;
    position: relative;
    overflow: hidden;
    background: #000;
}

#ai-camera {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Integrated camera HUD tag layout overlay */
.camera-feed-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: rgba(6, 182, 212, 0.7);
    letter-spacing: 1px;
}

.feed-hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-hud-rec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 4px 10px;
    border-radius: 4px;
    color: var(--danger-red);
    text-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
}

.feed-rec-dot {
    width: 6px;
    height: 6px;
    background-color: var(--danger-red);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--danger-red);
    animation: activePulse 1.2s infinite ease-in-out;
}

/* Local scanner line on the camera stream itself */
.camera-scanner-sweep {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-neon), transparent);
    box-shadow: 0 0 10px 1px var(--primary-neon);
    animation: cameraScan 4s infinite linear;
    pointer-events: none;
    z-index: 5;
}

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

.camera-selector {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.cam-btn {
    background: rgba(8, 14, 27, 0.4);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cam-btn:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--primary-neon);
    color: var(--text-main);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
    transform: translateY(-1px);
}

.cam-btn.active {
    background: rgba(6, 182, 212, 0.18);
    border-color: var(--primary-neon);
    color: var(--primary-neon);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.35);
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}

.add-cam-btn {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--safe-green);
}

.add-cam-btn:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--safe-green);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.camera-status {
    margin-top: 15px;
    font-size: 13px;
    text-align: center;
    color: var(--primary-neon);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ===== DYNAMIC TELEMETRY STATES ===== */
#safety-box, #action-box {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Safe State Styles */
#safety-box.safe, #action-box.safe {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.03);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 15px rgba(16, 185, 129, 0.05);
}

#safety-box.safe::before, #action-box.safe::before {
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.4), transparent);
}

#safety-box.safe .box-value, #action-box.safe .box-value {
    color: var(--safe-green);
    text-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

/* Danger State Styles & Flash */
#safety-box.danger, #action-box.danger {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.06);
    animation: hazardPulse 2s infinite ease-in-out;
}

#safety-box.danger::before, #action-box.danger::before {
    background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.6), transparent);
}

#safety-box.danger .box-value, #action-box.danger .box-value {
    color: var(--danger-red);
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

@keyframes hazardPulse {
    0% {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(239, 68, 68, 0.05);
        border-color: rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 30px rgba(239, 68, 68, 0.35), inset 0 0 20px rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.85);
    }
    100% {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(239, 68, 68, 0.05);
        border-color: rgba(239, 68, 68, 0.4);
    }
}

/* ===== CONTROL BUTTON PANELS ===== */
.history-btn-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.history-btn {
    padding: 14px 34px;
    font-size: 15px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-neon));
    border-radius: 30px;
    text-decoration: none;
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
}

.history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(6, 182, 212, 0.45);
}

.btn-danger-cyber {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: white;
    padding: 14px 34px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.25);
}

.btn-danger-cyber:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(239, 68, 68, 0.45);
}

/* ===== FOOTER SYSTEM ===== */
.footer {
    text-align: center;
    padding: 30px 20px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid rgba(6, 182, 212, 0.1);
    background: rgba(4, 8, 16, 0.4);
    z-index: 10;
}

/* ===== MENU-TOGGLE STYLES HANDLED BY NAVBAR_RESPONSIVE.CSS ===== */

/* =========================================
   MEDIA RESPONSIVENESS OVERRIDES
========================================= */

/* Desktop / Tablet Breakpoint (Under 1200px) */
@media (max-width: 1200px) {
    .cyber-hud-layer {
        display: none;
    }
    
    .main {
        padding: 110px 40px 40px 40px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }
    
    .box.camera {
        grid-column: span 2;
        min-height: auto;
    }
    
    .camera-box {
        height: 380px;
    }
}

/* Tablet & Mobile Layout Shifts (Under 768px) */
@media (max-width: 768px) {
    .main {
        padding: 90px 20px 30px 20px;
    }

    .main h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 14px;
        margin-bottom: 25px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .box.camera {
        grid-column: span 1;
    }

    .camera-box {
        height: 280px;
    }

    .camera-selector {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .cam-btn {
        width: 100%;
        text-align: center;
        padding: 10px 20px;
    }

    .box {
        min-height: auto;
        padding: 22px;
    }

    .box-value {
        font-size: 26px;
    }

    .history-btn-wrapper {
        flex-direction: column;
        width: 100%;
        gap: 15px;
    }

    .history-btn, .btn-danger-cyber {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }
}

/* Micro Mobile Polish (Under 480px) */
@media (max-width: 480px) {
    .camera-box {
        height: 210px;
    }
}

/* Custom Scrollbar system matching index.html */
body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

body::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.25);
    border-radius: 4px;
}

body::-webkit-scrollbar-thumb:hover {
    background: rgba(6, 182, 212, 0.45);
}