/* ==========================================================================
   OneEye — Enterprise AI Surveillance Design System
   Sleek Security Operations Center (SOC) Aesthetic
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-void: #06090f;
    --bg-base: #0a0f19;
    --bg-surface: #101726;
    --bg-card: #141d2f;
    --bg-card-hover: #19253b;
    --bg-elevated: #1e2c47;

    /* Semantic Accents */
    --blue: #38bdf8;        /* Sky/Cyan - System / Occupancy */
    --blue-glow: rgba(56, 189, 248, 0.15);
    --red: #f43f5e;         /* Crimson - Physical Altercations / Critical */
    --red-glow: rgba(244, 63, 94, 0.18);
    --orange: #f59e0b;      /* Amber - Sanitation / Garbage */
    --orange-glow: rgba(245, 158, 11, 0.15);
    --green: #10b981;       /* Emerald - Active / Operational / Normal */
    --green-glow: rgba(16, 185, 129, 0.15);

    /* Borders & Hairlines */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.14);
    --border-accent: rgba(56, 189, 248, 0.35);

    /* Typography */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Radii & Shadows */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-elevated: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
}

/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-ui);
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(56, 189, 248, 0.08), transparent 70%),
        linear-gradient(180deg, var(--bg-void) 0%, var(--bg-base) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-void);
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.navbar {
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 32px;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    cursor: pointer;
}

.logo-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(16, 185, 129, 0.1));
    border: 1px solid var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.2);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.logo:hover .logo-icon-wrapper {
    transform: scale(1.05);
    border-color: var(--blue);
}

.logo-icon-svg {
    width: 20px;
    height: 20px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.logo-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--blue);
    text-transform: uppercase;
}

/* Nav Menu Tabs */
.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 4px;
    background: rgba(16, 23, 38, 0.7);
    border: 1px solid var(--border-subtle);
    border-radius: 9999px;
    gap: 4px;
}

.nav-item {
    cursor: pointer;
    padding: 8px 18px;
    border-radius: 9999px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.nav-icon {
    width: 16px;
    height: 16px;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item:hover .nav-icon {
    opacity: 1;
}

.nav-item.active {
    background: var(--blue);
    color: #04101e;
    box-shadow: 0 2px 12px rgba(56, 189, 248, 0.3);
}

.nav-item.active .nav-icon {
    opacity: 1;
    stroke-width: 2.5;
}

/* System Status Bar in Nav */
.nav-system-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 5px 12px;
    border-radius: 9999px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
}

.pulse-emerald {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.status-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--green);
}

.header-clock {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Main Content Layout & Sections
   ========================================================================== */
main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 32px 48px;
}

.section {
    display: none;
    animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.section.active-section {
    display: block;
}

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

/* Section Header Component */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
    gap: 16px;
}

.section-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #ffffff;
    margin: 0 0 4px 0;
}

.section-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
}

.header-meta {
    display: flex;
    gap: 8px;
}

.badge-pill {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 4px 10px;
    border-radius: 9999px;
}

.badge-pill.active {
    color: var(--blue);
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.3);
}

/* ==========================================================================
   Dashboard Grid Layout
   ========================================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

/* Camera Feed Card */
.camera-feed {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-subtle);
    display: flex;
    flex-direction: column;
}

.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.feed-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.feed-live-dot {
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--red);
    animation: livePulse 1.5s infinite alternate;
}

@keyframes livePulse {
    from { opacity: 0.6; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1.1); }
}

.feed-controls-micro {
    display: flex;
    gap: 6px;
}

.feed-cam-select {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 3px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.feed-cam-select:hover {
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.feed-cam-select.active {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--blue);
    color: var(--blue);
}

/* ==========================================================================
   Realistic CCTV Feed Monitor Viewport (Preserving .feed-video-placeholder)
   ========================================================================== */
.feed-video-placeholder {
    width: 100%;
    min-height: 280px;
    background: #070b13;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(56, 189, 248, 0.2);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8);
    transition: border-color 0.3s ease;
}

/* Subtle CRT Scanline overlay */
.feed-video-placeholder::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 2;
    opacity: 0.6;
}

/* Subtle Ambient Radar Sweep */
.feed-video-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.05) 0%, transparent 65%);
    pointer-events: none;
    z-index: 1;
}

.feed-video-placeholder.pulse {
    /* Refined, non-gaudy subtle edge pulse */
    animation: cctvEdgeGlow 4s ease-in-out infinite alternate;
}

@keyframes cctvEdgeGlow {
    0% {
        border-color: rgba(56, 189, 248, 0.15);
        box-shadow: 0 0 20px -5px rgba(56, 189, 248, 0.1);
    }
    100% {
        border-color: rgba(56, 189, 248, 0.35);
        box-shadow: 0 0 30px -5px rgba(56, 189, 248, 0.2);
    }
}

.feed-video-placeholder.large {
    min-height: 480px;
}

/* CCTV HUD Layer */
.cctv-hud-overlay {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 14px 18px;
    flex: 1;
}

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

.hud-tag {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hud-cam-id {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    letter-spacing: 0.05em;
}

.hud-resolution {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.hud-rec-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.65);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(244, 63, 94, 0.3);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
}

.rec-dot {
    width: 7px;
    height: 7px;
    background: var(--red);
    border-radius: 50%;
    animation: recBlink 1s infinite;
}

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

.rec-text {
    color: var(--red);
    letter-spacing: 0.08em;
}

.rec-timer {
    color: var(--text-secondary);
    margin-left: 4px;
}

/* Center HUD Reticle */
.hud-reticle {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.reticle-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: rgba(56, 189, 248, 0.4);
    border-style: solid;
    pointer-events: none;
}

.reticle-corner.top-left {
    top: 10px;
    left: 10px;
    border-width: 2px 0 0 2px;
}

.reticle-corner.top-right {
    top: 10px;
    right: 10px;
    border-width: 2px 2px 0 0;
}

.reticle-corner.bottom-left {
    bottom: 10px;
    left: 10px;
    border-width: 0 0 2px 2px;
}

.reticle-corner.bottom-right {
    bottom: 10px;
    right: 10px;
    border-width: 0 2px 2px 0;
}

.reticle-crosshair {
    width: 40px;
    height: 40px;
    position: absolute;
    opacity: 0.3;
}

.reticle-crosshair::before,
.reticle-crosshair::after {
    content: "";
    position: absolute;
    background: var(--blue);
}

.reticle-crosshair::before {
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    transform: translateY(-50%);
}

.reticle-crosshair::after {
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-50%);
}

.hud-standby-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(10, 15, 25, 0.65);
    backdrop-filter: blur(8px);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.hud-cam-icon {
    width: 32px;
    height: 32px;
    color: var(--blue);
    opacity: 0.8;
}

.standby-title {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.standby-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Bottom HUD Bar */
.hud-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 10px;
}

.hud-telemetry {
    display: flex;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.hud-telemetry b {
    color: var(--text-secondary);
    font-weight: 600;
}

.hud-timestamp {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--blue);
    letter-spacing: 0.05em;
}

/* ==========================================================================
   Stats Cards Component
   ========================================================================== */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-subtle);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--blue));
    opacity: 0.9;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-elevated);
}

.stat-card.blue {
    --card-accent: var(--blue);
}
.stat-card.red {
    --card-accent: var(--red);
}
.stat-card.orange {
    --card-accent: var(--orange);
}
.stat-card.green {
    --card-accent: var(--green);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--card-accent);
}

.stat-card .stat-icon svg {
    width: 18px;
    height: 18px;
}

.stat-trend {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 9999px;
    letter-spacing: 0.02em;
}

.stat-trend.positive {
    background: rgba(56, 189, 248, 0.1);
    color: var(--blue);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.stat-trend.critical {
    background: rgba(244, 63, 94, 0.12);
    color: var(--red);
    border: 1px solid rgba(244, 63, 94, 0.25);
}

.stat-trend.warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--orange);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.stat-trend.nominal {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 10px;
}

.stat-footer {
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 8px;
    margin-top: auto;
}

/* ==========================================================================
   Recent Detections Component
   ========================================================================== */
.recent-detections {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-subtle);
}

.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.recent-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 2px 0;
}

.recent-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
}

.detection-filter-tabs {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 3px;
    border-radius: var(--radius-md);
    gap: 4px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--bg-card);
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
}

/* Detections List */
.detections-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detection-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    align-items: center;
    gap: 16px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.detection-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--item-accent, var(--blue));
}

.detection-item.fight {
    --item-accent: var(--red);
}
.detection-item.garbage {
    --item-accent: var(--orange);
}
.detection-item.people {
    --item-accent: var(--blue);
}

.detection-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    transform: translateX(3px);
}

.detection-item .icon-wrapper {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--item-accent);
}

.detection-item .icon-wrapper svg {
    width: 18px;
    height: 18px;
}

.detection-item .detection-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detection-item .type-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: capitalize;
}

.detection-item .detection-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.detection-item .conf-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.detection-item .conf {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--green);
}

.conf-bar-bg {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.conf-bar-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
}

.detection-item .location-pill {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.detection-item .timestamp {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ==========================================================================
   Live Feed Controls
   ========================================================================== */
.live-controls {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-subtle);
}

.controls-action-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.controls-config-group {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
}

.btn.blue {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.25);
}

.btn.blue:hover {
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4);
}

.btn.red {
    background: linear-gradient(135deg, #e11d48, #be123c);
    border-color: #fb7185;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(244, 63, 94, 0.25);
}

.btn.red:hover {
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.4);
}

.btn.green {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #34d399;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

.btn.green:hover {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-record-dot {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
}

.btn.recording {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: #f87171;
}

.btn.recording .btn-record-dot {
    animation: recBlink 0.8s infinite;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.quality-selector {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.quality-selector:focus {
    border-color: var(--blue);
}

.range-label {
    min-width: 190px;
}

.mono-readout {
    font-family: var(--font-mono);
    color: var(--blue);
    font-weight: 600;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid #ffffff;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
    cursor: pointer;
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ==========================================================================
   Detections Registry Section
   ========================================================================== */
.search-box-wrapper {
    position: relative;
    width: 320px;
}

.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.detections-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-subtle);
}

/* ==========================================================================
   Analytics & Telemetry Charts
   ========================================================================== */
.time-range-picker {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 3px;
    border-radius: var(--radius-md);
    gap: 4px;
}

.range-chip {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.range-chip:hover {
    color: var(--text-primary);
}

.range-chip.active {
    background: rgba(56, 189, 248, 0.12);
    color: var(--blue);
    border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Preserving .chart-placeholder while making it an authentic, sleek telemetry SVG chart */
.chart-placeholder {
    width: 100%;
    min-height: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    position: relative;
    padding: 20px;
    box-shadow: var(--shadow-subtle);
    display: flex;
    flex-direction: column;
}

.chart-inner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chart-title-tag {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.chart-legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.chart-svg-container {
    flex: 1;
    width: 100%;
    height: 200px;
    position: relative;
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-subtle);
}

.summary-card.red-border { border-left: 3px solid var(--red); }
.summary-card.orange-border { border-left: 3px solid var(--orange); }
.summary-card.blue-border { border-left: 3px solid var(--blue); }

.summary-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-icon svg {
    width: 22px;
    height: 22px;
}

.summary-icon.red-bg {
    background: rgba(244, 63, 94, 0.12);
    color: var(--red);
}

.summary-icon.orange-bg {
    background: rgba(245, 158, 11, 0.12);
    color: var(--orange);
}

.summary-icon.blue-bg {
    background: rgba(56, 189, 248, 0.12);
    color: var(--blue);
}

.summary-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.summary-val {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
}

.summary-val .red { color: var(--red); }
.summary-val .orange { color: var(--orange); }
.summary-val .blue { color: var(--blue); }

.summary-note {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Timeline */
.recent-detections-timeline {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-subtle);
}

.detections-timeline {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.timeline-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    background: var(--t-accent, var(--blue));
}

.timeline-item.fight { --t-accent: var(--red); }
.timeline-item.garbage { --t-accent: var(--orange); }
.timeline-item.people { --t-accent: var(--blue); }
.timeline-item.fallen_person { --t-accent: var(--orange); }
.timeline-item.mobile_phone { --t-accent: var(--blue); }
.timeline-item.accident { --t-accent: var(--red); }

.detection-item.fallen_person { --item-accent: var(--orange); }
.detection-item.mobile_phone { --item-accent: var(--blue); }
.detection-item.accident { --item-accent: var(--red); }

.pulse-critical {
    background: var(--red);
    box-shadow: 0 0 12px var(--red);
}

.live-stream-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.feed-video-placeholder .cctv-hud-overlay {
    position: relative;
    z-index: 3;
}

.timeline-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-medium);
}

.timeline-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-item .timestamp {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--text-muted);
}

.timeline-item .type-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
}

.timeline-item .conf {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--green);
}

.timeline-item .location {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   Settings Section
   ========================================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-subtle);
}

.settings-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.settings-title-icon {
    width: 20px;
    height: 20px;
    color: var(--blue);
}

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.setting-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setting-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
}

.setting-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* iOS-style Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #334155;
    transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 24px;
}

.toggle-switch .slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: var(--blue);
}

.toggle-switch input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* Sliders Control */
.settings-sliders {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.slider-control {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.styled-range {
    width: 100%;
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(16, 23, 38, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    color: #ffffff;
    font-size: 0.85rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast.toast-critical {
    border-left: 4px solid var(--red);
}
.toast.toast-info {
    border-left: 4px solid var(--blue);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .analytics-summary {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .nav-menu {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 4px;
    }

    .nav-system-status {
        display: none;
    }

    main {
        padding: 16px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .detection-item {
        grid-template-columns: auto 1fr;
        gap: 10px;
    }

    .live-controls {
        flex-direction: column;
        align-items: stretch;
    }
}
