@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg-dark: #0f172a;
    --bg-surface: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(255, 255, 255, 0.05);
    --glass-heavy: rgba(255, 255, 255, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    touch-action: pan-x pan-y;
}

/* NAVBAR */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    z-index: 1000;
}

.menu-icon {
    font-size: 28px;
    margin-right: 20px;
    cursor: pointer;
    color: var(--text-main);
    transition: transform 0.2s;
}

.menu-icon:hover {
    transform: scale(1.1);
    color: var(--primary);
}

.navbar h2 {
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: 70px;
    left: -260px;
    width: 260px;
    height: calc(100% - 70px);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1100; /* Higher than overlay */
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar.open {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar.open ~ .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

.sidebar button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.sidebar button:hover {
    background: var(--glass-heavy);
    color: var(--text-main);
    transform: translateX(4px);
}

.sidebar button.active {
    background: var(--primary);
    color: white;
}

/* MAIN CONTENT */
.app-container {
    padding-top: 70px;
    min-height: 100vh;
    transition: margin-left 0.4s;
}

.section-container {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.section-container h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 32px;
    letter-spacing: -0.03em;
}

/* BUS GRID */
.bus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.bus-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.bus-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.bus-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(59, 130, 246, 0.5);
}

.bus-card:hover::before {
    opacity: 1;
}

.bus-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.bus-card p {
    color: var(--text-muted);
    font-size: 14px;
}

/* FORMS */
.admin-form {
    background: var(--bg-surface);
    padding: 32px;
    border-radius: 20px;
    border: 1px solid var(--border);
    max-width: 500px;
}

.admin-form input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: white;
    margin-bottom: 20px;
    font-family: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
}

.admin-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-setup, .btn-save, .btn-view {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-setup:hover, .btn-save:hover, .btn-view:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* MODALS */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-surface);
    width: 100%;
    max-width: 500px;
    border-radius: 24px;
    border: 1px solid var(--border);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.video-grid {
    display: grid;
    gap: 16px;
    width: 100%;
}

.camera {
    position: relative;
    background: var(--bg-surface);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    aspect-ratio: 16/9;
}

.camera:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(59, 130, 246, 0.4);
}

.camera video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

/* CAMERA HEADER & CLOSE BUTTON */
.camera-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9), transparent);
    color: white;
    font-size: 13px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5000; /* Highest priority */
    opacity: 1;
    transition: background 0.3s;
}

.camera:hover .camera-header {
    background: linear-gradient(to bottom, rgba(15, 23, 42, 1), transparent);
}

.closeCam {
    background: var(--glass-heavy);
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.closeCam:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.timeline-bar {
    display: none !important; /* Hidden by default */
    overflow-x: auto;
    gap: 8px;
    padding: 8px 16px;
    width: 100%;
    scrollbar-width: none;
    z-index: 4600;
    background: transparent !important;
    backdrop-filter: none !important;
    border-radius: 0;
}

.timeline-bar.visible,
.show-timeline .timeline-bar {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

/* Hide main controls when timeline is shown */
.show-timeline .time-slider-container,
.show-timeline .control-buttons {
    display: none !important;
}

.camera .timeline-bar {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.camera.user-active .timeline-bar,
.camera.user-active .camera-controls {
    opacity: 1;
    pointer-events: auto;
}

.modal-inner .timeline-bar {
    opacity: 0;
    background: transparent !important;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 4600;
}

/* Show controls in modal/FS on activity */
.modal-inner.user-active .timeline-bar,
.modal-inner.user-active .camera-controls {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Force-hide on inactivity, UNLESS picker is open */
.user-inactive:not(.picker-open) .timeline-bar,
.user-inactive:not(.picker-open) .camera-controls {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Hide controls/timeline ONLY when zoomed, UNLESS picker is open */
.is-zoomed:not(.picker-open):not(.speed-picker-open) .camera-header,
.is-zoomed:not(.picker-open):not(.speed-picker-open) .timeline-bar,
.is-zoomed:not(.picker-open):not(.speed-picker-open) .camera-controls {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.picker-open .camera-controls,
.speed-picker-open .camera-controls {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Timestamps and close-viewer should STAY visible when zoomed */
.is-zoomed .video-overlay,
.is-zoomed .close-viewer,
.is-zoomed #modalClose {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 5100; /* Ensure they stay on top */
}

.timeline-btn {
    background: rgba(15, 23, 42, 0.7);
    color: #ffd700; /* Gold */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    border: 1px solid rgba(118, 229, 241, 0.2);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.timeline-btn.active {
    color: white !important; 
    background: rgba(59, 130, 246, 0.9) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.timeline-btn:hover {
    border-color: #00d4ff !important; /* Vivid Blue Border */
    background: rgba(15, 23, 42, 0.9);
}



.timeline-btn-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* TOAST NOTIFICATIONS */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    pointer-events: none;
}

.toast-message {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-message.visible {
    opacity: 1;
    transform: translateX(0);
}

.toast-undo-btn {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.toast-undo-btn:hover {
    background: var(--primary);
    color: white;
}

.toast-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
}

.toast-close-btn:hover {
    color: white;
}

/* 3-DOT MENU & DROPDOWN */
.menu-dots {
    cursor: pointer;
    padding: 4px 8px;
    font-size: 20px;
    font-weight: bold;
    color: var(--text-muted);
    transition: color 0.2s;
}

.menu-dots:hover {
    color: var(--text-main);
}

.dropdown-container {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 8px 0;
    min-width: 150px;
    display: none;
    flex-direction: column;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-menu button {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 10px 16px;
    text-align: left;
    width: 100%;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.dropdown-menu button:hover {
    background: var(--glass-heavy);
}

.dropdown-menu button.text-danger {
    color: #ef4444;
}

.dropdown-menu button.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* DELETE HOVER ICONS */
.btn-delete-icon {
    position: absolute;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

.btn-delete-icon:hover {
    background: #ef4444;
    transform: scale(1.1) !important;
}

/* For Shift Cards */
.recording-card {
    position: relative;
}
.recording-card .btn-delete-icon {
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    font-size: 14px;
    opacity: 0.5; /* Semi-visible by default */
}
.recording-card:hover .btn-delete-icon {
    opacity: 1;
    transform: scale(1);
}

/* For Timeline Videos */
.timeline-delete-btn {
    position: absolute;
    top: -8px;
    left: -8px; /* Place on top left since add-to-grid is top right */
    width: 20px;
    height: 20px;
    font-size: 12px;
}

.timeline-btn-wrapper:hover .timeline-delete-btn {
    opacity: 1;
    transform: scale(1);
}

.add-to-grid-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--primary);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 100;
    line-height: 1;
    padding: 0;
}

.timeline-btn-wrapper:hover .add-to-grid-btn {
    opacity: 1;
    transform: scale(1);
    background: var(--primary-hover);
}

.add-to-grid-btn:hover {
    transform: scale(1.2) !important;
    background: white !important;
    color: var(--primary) !important;
}

.viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000; /* Pure black for container */
    z-index: 9000;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

.camera-controls {
    position: absolute;
    bottom: 16px;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 12px 20px;
    border-radius: 0;
    z-index: 5000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none !important;
    box-shadow: none !important;
    pointer-events: auto;
    max-width: none !important;
    transform: none !important;
}

.camera:hover .camera-controls,
.camera.user-active .camera-controls,
.modal-inner.user-active .camera-controls {
    opacity: 1;
}

.time-slider-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: auto;
}

.control-buttons {
    display: flex;
    gap: 24px;
    align-items: center;
}

.time-display {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
    background: transparent !important;
}

.time-display:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-main);
}

/* TIME PICKER POPUP */
.time-picker-popup {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(24px);
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 20px;
    display: none;
    flex-direction: column;
    gap: 16px;
    z-index: 7000;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 280px;
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
}

.time-picker-popup.visible {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.time-picker-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
}

.time-picker-wheels {
    display: flex;
    justify-content: center;
    gap: 12px;
    align-items: center;
    position: relative;
    padding: 10px 0;
}

.wheel-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 50px;
}

.wheel-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.wheel-nav-btn:hover {
    color: var(--primary);
}

.time-wheel {
    height: 120px;
    width: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.time-wheel::-webkit-scrollbar {
    display: none;
}

.time-wheel div {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-muted);
    scroll-snap-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.time-wheel div.active {
    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
}

.wheel-divider {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 24px;
}

.fixed-ampm {
    background: var(--glass-heavy);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    margin-left: 8px;
    border: 1px solid var(--border);
}

/* SPEED PICKER POPUP */
.speed-picker-popup {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(24px);
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 7000;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 140px;
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
}

.speed-picker-popup.visible {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.speed-picker-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 4px;
}

.speed-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.speed-options button {
    background: var(--glass-heavy);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

.speed-options button:hover, .speed-options button:focus {
    background: rgba(59, 130, 246, 0.15); 
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

.speed-options button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    transform: scale(1.05);
}

.speed-options button.active:hover {
    background: var(--primary);
    color: white !important;
}

.speed-options button:focus {
    box-shadow: 0 0 0 2px var(--primary);
}

.speed-btn {
    font-size: 12px !important;
    font-weight: 700 !important;
    color: var(--primary) !important;
    min-width: 40px;
    text-align: center;
}

.time-picker-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn-picker-set {
    flex: 2;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-picker-set:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-picker-set:focus, .time-wheel:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-picker-cancel {
    flex: 1;
    background: var(--glass-heavy);
    color: var(--text-main);
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-picker-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.time-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.time-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.time-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.time-slider::-moz-range-thumb:hover {
    transform: scale(1.3);
}

.close-viewer {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 32px;
    color: white;
    cursor: pointer;
    z-index: 10000; /* Above everything */
    transition: all 0.2s;
    opacity: 0.9;
}

.close-viewer:hover {
    opacity: 1;
    transform: scale(1.1);
}

.video-overlay {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    padding: 8px 14px;
    border-radius: 10px;
    color: #4ade80;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid rgba(74, 222, 128, 0.3);
    display: none !important; /* Hidden by default when zoom = 0 */
    pointer-events: none;
    z-index: 4900 !important; /* Ensure visibility over zooming video */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.camera:hover .camera-controls,
.camera.user-active .camera-controls {
    opacity: 1;
}

.camera-controls button {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s;
}

.camera-controls button:hover {
    transform: scale(1.05);
    color: var(--primary);
}

/* MODAL VIDEO SIZE & CONTROLS */
.modal-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.viewer-modal video {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    object-fit: contain;
    background: #000;
    transition: transform 0.3s ease;
}

/* Improved full screen coverage */
:fullscreen video {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0;
    object-fit: contain;
    background: #000;
}

:fullscreen .timeline-bar {
    display: none !important;
    z-index: 999999 !important;
}

:fullscreen.show-timeline .timeline-bar {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

:fullscreen.show-timeline .time-slider-container,
:fullscreen.show-timeline .control-buttons {
    display: none !important;
}

:fullscreen .camera-controls {
    position: fixed !important;
    bottom: 60px !important;
    left: 0 !important;
    width: 100% !important;
    transform: none !important;
    z-index: 999999 !important;
    background: transparent !important;
    max-width: none !important;
    opacity: 0;
    pointer-events: auto !important;
    transition: opacity 0.3s;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 0 40px !important;
}

:fullscreen.user-active .camera-controls,
:fullscreen .user-active .camera-controls {
    opacity: 1 !important;
    pointer-events: auto !important;
}

:fullscreen .video-overlay {
    top: 32px !important;
    left: 40px !important;
    z-index: 999999 !important;
    display: block !important;
}

:fullscreen .close-viewer {
    top: 32px !important;
    right: 40px !important;
    opacity: 0.9;
    z-index: 999999 !important;
}

/* Ensure picker is above everything in FS */
.time-picker-popup {
    z-index: 1000000 !important;
}

.modal-inner .camera-controls,
.modal-inner .timeline-bar {
    z-index: 6000;
    pointer-events: auto !important;
}

.modal-inner .camera-controls {
    bottom: 30px; 
    opacity: 0;
    pointer-events: none;
}

/* SEARCH WRAP */
.search-wrap {
    margin-bottom: 32px;
}

.search-wrap input {
    width: 100%;
    max-width: 400px;
    padding: 14px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: white;
    font-size: 16px;
    transition: all 0.2s;
}

.search-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* UTILS */
.btn-cancel {
    background: var(--glass-heavy);
    color: var(--text-main);
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* CALENDAR PICKER VISIBILITY */
input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* View Type Modal Styles */
#viewTypeModal .btn-view {
    width: 100%;
    margin-bottom: 0;
}

#sideBySideBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-surface) !important;
    border-color: var(--border) !important;
    color: var(--text-muted) !important;
}

/* LOGIN PAGE STYLES */
.login-body {
    background: url('login_bg.png') no-repeat center center fixed;
    background-size: cover;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    position: relative;
    overflow: hidden;
}

.login-body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.9) 100%);
    z-index: 1;
}

.login-card {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: loginFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    color: white;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 15px;
}

.login-input-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-left: 4px;
}

.login-input-group input {
    width: 100%;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    transition: all 0.3s;
}

.login-input-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 12px;
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(59, 130, 246, 0.5);
}

.login-footer {
    margin-top: 32px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Password Visibility Toggle */
.pw-toggle-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(15%);
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s, transform 0.2s;
    user-select: none;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pw-toggle-icon:hover {
    color: var(--primary);
    transform: translateY(15%) scale(1.1);
}