/* Camera AI - Design System
 * Style: Dark Mode (OLED) Surveillance
 * Typography: Fira Code / Fira Sans
 * Palette: Blue data + Amber highlights
 */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Fira+Sans:wght@300;400;500;600;700&display=swap');

/* ========== CSS TOKENS ========== */
:root {
    /* Background */
    --bg-primary:   #0A0E17;
    --bg-secondary: #111827;
    --bg-tertiary:  #1F2937;
    --bg-hover:     #283548;
    --bg-card:      #151C2C;
    --bg-input:     #1A2332;

    /* Accent */
    --accent-blue:    #3B82F6;
    --accent-blue-hover: #2563EB;
    --accent-blue-glow: rgba(59, 130, 246, 0.15);
    --accent-amber:   #F59E0B;
    --accent-amber-hover: #D97706;
    --accent-green:   #10B981;
    --accent-green-dim: rgba(16, 185, 129, 0.15);
    --accent-red:     #EF4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);
    --accent-purple:  #8B5CF6;
    --accent-cyan:    #06B6D4;

    /* Text */
    --text-primary:    #F9FAFB;
    --text-secondary:  #9CA3AF;
    --text-muted:      #6B7280;
    --text-inverse:    #111827;

    /* Border */
    --border:       #1E293B;
    --border-light: #374151;
    --border-focus: #3B82F6;

    /* Shadow */
    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg:  0 8px 30px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.1);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-mono: 'Fira Code', monospace;
    --font-sans: 'Fira Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --sidebar-width: 260px;
    --navbar-height: 64px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Z-index */
    --z-sidebar: 40;
    --z-navbar: 30;
    --z-dropdown: 50;
    --z-modal: 60;
    --z-toast: 70;
}

/* ========== RESET ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent-blue); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-blue-hover); }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ========== LAYOUT ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo svg { width: 24px; height: 24px; color: white; }

.sidebar-brand {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.sidebar-brand small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 0 2px 2px 0;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    position: sticky;
    top: 0;
    height: var(--navbar-height);
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: var(--z-navbar);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
}

.topbar-breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-menu-toggle:hover { background: var(--bg-tertiary); }

/* Page Content */
.page-content {
    padding: 28px;
}

/* ========== COMPONENTS ========== */

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    border-color: var(--border-light);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-fast);
    cursor: default;
}

.stat-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-glow);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon svg { width: 22px; height: 22px; }
.stat-card-icon.blue  { background: var(--accent-blue-glow); color: var(--accent-blue); }
.stat-card-icon.green { background: var(--accent-green-dim); color: var(--accent-green); }
.stat-card-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.stat-card-icon.red   { background: var(--accent-red-dim);   color: var(--accent-red); }

.stat-card-value {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-card-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card-trend {
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-top: 8px;
}

.stat-card-trend.up   { background: var(--accent-green-dim); color: var(--accent-green); }
.stat-card-trend.down { background: var(--accent-red-dim);   color: var(--accent-red); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.4;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}
.btn-primary:hover {
    background: var(--accent-blue-hover);
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-light);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-danger {
    background: var(--accent-red);
    color: white;
}
.btn-danger:hover { background: #DC2626; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.btn:disabled, .btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Form Controls */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6 3.5 4 3.5-4h-7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    font-size: 14px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-online  { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-offline { background: rgba(107, 114, 128, 0.2); color: var(--text-muted); }
.badge-error   { background: var(--accent-red-dim);   color: var(--accent-red); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.badge-info    { background: var(--accent-blue-glow); color: var(--accent-blue); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Camera Grid */
.camera-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.camera-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.camera-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.camera-preview {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-primary);
    overflow: hidden;
}

.camera-preview video,
.camera-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-preview-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.7) 100%);
    display: flex;
    align-items: flex-end;
    padding: 16px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.camera-card:hover .camera-preview-overlay { opacity: 1; }

.camera-status-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.camera-status-dot.online {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse-green 2s infinite;
}

.camera-status-dot.offline { background: var(--text-muted); }
.camera-status-dot.error { background: var(--accent-red); animation: pulse-red 1.5s infinite; }

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 4px var(--accent-green); }
    50% { box-shadow: 0 0 12px var(--accent-green); }
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 4px var(--accent-red); }
    50% { box-shadow: 0 0 12px var(--accent-red); }
}

.camera-ai-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(59, 130, 246, 0.8);
    backdrop-filter: blur(4px);
    font-size: 11px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 4px;
}

.camera-info {
    padding: 16px;
}

.camera-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.camera-location {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Live Stream Viewer */
.stream-viewer {
    position: relative;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.stream-viewer video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stream-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    display: flex;
    align-items: center;
    justify-content: space-between;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stream-viewer:hover .stream-controls { opacity: 1; }

/* Face Grid */
.face-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.face-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.face-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.face-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 16px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-blue);
    overflow: hidden;
}

.face-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.face-name { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.face-dept { font-size: 13px; color: var(--text-muted); }

/* Alert Timeline */
.alert-timeline {
    position: relative;
    padding-left: 28px;
}

.alert-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.alert-item {
    position: relative;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.alert-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

.alert-item.critical::before { background: var(--accent-red); box-shadow: 0 0 8px var(--accent-red); }
.alert-item.high::before     { background: var(--accent-amber); }
.alert-item.medium::before   { background: var(--accent-blue); }
.alert-item.low::before      { background: var(--text-muted); }

.alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.alert-type {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.alert-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

.alert-detail {
    font-size: 13px;
    color: var(--text-secondary);
}

.alert-snapshot {
    width: 120px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 8px;
    border: 1px solid var(--border);
}

.alert-snapshot img { width: 100%; height: 100%; object-fit: cover; }

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
}

.modal-backdrop.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title { font-size: 18px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; }

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    animation: toast-in 0.3s ease;
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.warning { border-left: 3px solid var(--accent-amber); }
.toast.info    { border-left: 3px solid var(--accent-blue); }

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.toast-message { font-size: 14px; color: var(--text-primary); }

/* AI Status Indicator */
.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

.ai-status.online  { background: var(--accent-green-dim); color: var(--accent-green); }
.ai-status.offline { background: rgba(107, 114, 128, 0.2); color: var(--text-muted); }
.ai-status.processing { background: var(--accent-blue-glow); color: var(--accent-blue); }

.ai-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: ai-pulse 1.5s infinite;
}

@keyframes ai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-bar .form-control {
    width: auto;
    min-width: 150px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.4; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-description { font-size: 14px; max-width: 400px; margin: 0 auto; }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== LOGIN PAGE ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08), transparent 70%);
    top: -200px;
    right: -200px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.06), transparent 70%);
    bottom: -100px;
    left: -100px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo-icon svg { width: 36px; height: 36px; color: white; }

.login-title {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.login-form .form-group { margin-bottom: 20px; }

.login-form .form-control {
    padding: 12px 16px;
    font-size: 15px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

.login-error {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn-menu-toggle {
        display: flex;
    }

    .camera-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card { padding: 16px; }
    .stat-card-value { font-size: 24px; }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-control { width: 100%; min-width: auto; }

    .camera-grid {
        grid-template-columns: 1fr;
    }

    .face-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 375px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .face-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== UTILITIES ========== */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-12  { margin-top: 12px; }
.mt-20  { margin-top: 20px; }
.mb-12  { margin-bottom: 12px; }
.mb-20  { margin-bottom: 20px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mono { font-family: var(--font-mono); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }
.hidden { display: none; }

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
