/* ===================================
   CSS Variables & Reset
   =================================== */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ===================================
   Dashboard Layout
   =================================== */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-content h1 {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-content h1 .icon {
    width: 2.5rem;
    height: 2.5rem;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}

.stat.online {
    background: rgba(16, 185, 129, 0.2);
}

.stream-type-toggle {
    display: flex;
    align-items: center;
    margin-left: 2rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.toggle-button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-button.main {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.toggle-button.main:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.toggle-button.sub {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.toggle-button.sub:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 87, 108, 0.4);
}

.stat .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.stat span {
    font-size: 1rem;
    font-weight: 600;
}

/* ===================================
   Controls Section
   =================================== */
.dashboard-controls {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box .icon {
    position: absolute;
    left: 1rem;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--surface);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===================================
   Main Content
   =================================== */
.dashboard-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem;
}

.dvr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

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

/* ===================================
   DVR Card
   =================================== */
.dvr-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.dvr-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.dvr-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.dvr-info {
    flex: 1;
}

.dvr-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.license-plate {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.dvr-id {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.status-indicator {
    padding: 0.4rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===================================
   Device Details
   =================================== */
.dvr-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-row .icon {
    width: 1.1rem;
    height: 1.1rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.detail-row.streaming-indicator {
    color: var(--success-color);
    font-weight: 600;
}

.detail-row.streaming-indicator .icon {
    color: var(--success-color);
    animation: pulse 2s infinite;
}

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

/* ===================================
   Actions
   =================================== */
.dvr-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

/* First button (View Live) spans full width */
.dvr-actions .btn:first-child {
    grid-column: span 4;
}

/* Last 2 buttons (Recordings, Settings) span 2 columns each */
.dvr-actions .btn:nth-child(10) {
    grid-column: span 2;
}

.dvr-actions .btn:nth-child(11) {
    grid-column: span 2;
}

.snapshot-message {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    animation: slideIn 0.3s ease;
}

.snapshot-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.snapshot-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

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

/* ===================================
   Buttons
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn .icon {
    width: 1.1rem;
    height: 1.1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--primary-color);
}

.btn-accent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-accent:hover:not(:disabled) {
    background: linear-gradient(135deg, #5568d3 0%, #63408a 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-settings {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.btn-settings:hover:not(:disabled) {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-channel {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    font-size: 0.8rem;
}

.btn-channel:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-snapshot {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    font-size: 0.8rem;
}

.btn-snapshot:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-control {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    font-size: 0.8rem;
}

.btn-control:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-passengers {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    font-size: 0.8rem;
}

.btn-passengers:hover:not(:disabled) {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    flex: 0 0 auto;
}

/* ===================================
   States (Loading, Error, Empty)
   =================================== */
.loading-state,
.error-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.loading-state .icon,
.error-state .icon,
.empty-state .icon {
    width: 4rem;
    height: 4rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.loading-state .icon.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.error-state .icon {
    color: var(--danger-color);
}

.loading-state p,
.error-state p,
.empty-state p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ===================================
   Video Player Overlay
   =================================== */
.video-player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
}

.video-player-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}

.video-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.video-player-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.location-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-family: 'Courier New', monospace;
}

.close-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    border: none;
    border-radius: var(--radius);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.close-btn:hover {
    background: var(--danger-color);
    color: white;
}

.video-wrapper {
    position: relative;
    background: #000;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-loading,
.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem 2rem;
    border-radius: var(--radius);
}

.video-error {
    background: rgba(239, 68, 68, 0.9);
}

.video-player-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    background: var(--surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.btn-stop {
    min-width: 200px;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-danger:disabled {
    opacity: 0.6;
}

/* ===================================
   Recordings Browser
   =================================== */
.recordings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
}

.recordings-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
}

.recordings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.recordings-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.recordings-filters {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group input,
.filter-group select {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--surface);
    transition: var(--transition);
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.recordings-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.recordings-loading,
.recordings-error,
.recordings-empty {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.recordings-error {
    color: var(--danger-color);
}

.recording-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.recording-item:hover {
    background: var(--surface-hover);
    box-shadow: var(--shadow-sm);
}

.recording-info {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.recording-time,
.recording-duration,
.recording-channel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.recording-time .icon,
.recording-duration .icon,
.recording-channel .icon {
    width: 1rem;
    height: 1rem;
    color: var(--primary-color);
}

.recording-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-success {
    background: var(--success-color);
    color: white;
    border: none;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-success:disabled {
    background: #6ee7b7;
    cursor: wait;
}

.download-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--success-color);
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

.download-progress .icon {
    width: 1rem;
    height: 1rem;
    animation: bounce 1s ease-in-out infinite;
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-stats {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

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

    .dashboard-controls {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .recordings-filters {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .recording-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .recording-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .recording-actions {
        width: 100%;
        justify-content: stretch;
    }

    .recording-actions .btn {
        flex: 1;
    }
}

/* ===================================
   Scrollbar Styling
   =================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ===================================
   Utility Classes
   =================================== */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

/* ===================================
   Login Page Styles
   =================================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-primary);
    text-align: center;
}

.login-card h2 {
    font-size: 18px;
    margin-bottom: 30px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:disabled {
    background-color: var(--surface-hover);
    cursor: not-allowed;
    opacity: 0.6;
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.login-card .btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.login-card .btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.login-card .btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.error-message {
    padding: 12px;
    margin-bottom: 20px;
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
    border-radius: var(--radius);
    font-size: 14px;
}

/* ===================================
   Loading Screen
   =================================== */
.loading-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--background);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-screen p {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===================================
   User Info in Header
   =================================== */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.user-name .icon {
    width: 18px;
    height: 18px;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    font-family: inherit;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

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

/* Update dashboard header to flex layout */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: var(--shadow-md);
}

/* ===================================
   Multi-View Modal
   =================================== */
.multi-view-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.multi-view-container {
    background: #1a1a1a;
    border-radius: 12px;
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.multi-view-header {
    padding: 20px 24px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.multi-view-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.multi-view-header .location-info {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 6px;
    font-family: 'Courier New', monospace;
}

.multi-view-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.multi-view-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.multi-view-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
    flex: 1;
    overflow: hidden;
}

.stream-panel {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stream-label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.stream-loading,
.stream-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    text-align: center;
    z-index: 10;
}

.stream-error {
    color: #ef4444;
}

.multi-view-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.multi-view-footer {
    padding: 16px 24px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: center;
    background: #1a1a1a;
}

.multi-view-footer .btn {
    min-width: 200px;
}

@media (max-width: 1024px) {
    .multi-view-body {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .multi-view-container {
        width: 98%;
        max-height: 98vh;
    }

    .multi-view-body {
        padding: 12px;
        gap: 12px;
    }

    .multi-view-header {
        padding: 16px;
    }

    .multi-view-header h3 {
        font-size: 16px;
    }
}

/* ===================================
   Stream Type Selector Modal
   =================================== */
.stream-type-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.stream-type-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.stream-type-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.stream-type-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.stream-type-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.stream-type-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.stream-type-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stream-type-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.stream-type-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.stream-type-option.main-stream {
    border-color: #3b82f6;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(37, 99, 235, 0.05) 100%);
}

.stream-type-option.main-stream:hover {
    border-color: #2563eb;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
}

.stream-type-option.sub-stream {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.05) 100%);
}

.stream-type-option.sub-stream:hover {
    border-color: #059669;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.stream-icon {
    font-size: 48px;
    line-height: 1;
}

.stream-info {
    flex: 1;
}

.stream-info h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.stream-info p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #6b7280;
}

.stream-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}

.stream-type-option.main-stream .stream-badge {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.stream-type-option.sub-stream .stream-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

@media (max-width: 768px) {
    .stream-type-content {
        width: 95%;
    }

    .stream-type-body {
        padding: 16px;
    }

    .stream-type-option {
        padding: 16px;
    }

    .stream-icon {
        font-size: 36px;
    }

    .stream-info h4 {
        font-size: 16px;
    }

    .stream-info p {
        font-size: 13px;
    }
}

/* ===================================
   Snapshot Modal
   =================================== */
.snapshot-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.snapshot-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    will-change: transform;
    transform: translateZ(0);
}

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

.snapshot-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.snapshot-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.snapshot-modal-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.snapshot-modal-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.snapshot-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.snapshot-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: #f3f4f6;
}

.snapshot-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.snapshot-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.snapshot-icon {
    font-size: 18px;
    flex-shrink: 0;
    display: inline-block;
    width: 24px;
    text-align: center;
}

.snapshot-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #f9fafb;
}

.snapshot-modal-footer .btn {
    min-width: 120px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .snapshot-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .snapshot-modal-body {
        padding: 16px;
    }

    .snapshot-info {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }

    .snapshot-modal-footer {
        flex-direction: column;
    }

    .snapshot-modal-footer .btn {
        width: 100%;
    }

    .login-card {
        padding: 30px 20px;
    }

    .user-info {
        flex-direction: column;
        gap: 10px;
        align-items: flex-end;
    }

    .user-name {
        font-size: 12px;
    }

    .btn-logout {
        padding: 6px 12px;
        font-size: 12px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 15px;
    }

    .user-info {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
    }
}

/* ===================================
   General Modal Styles (Terminal Control & Passenger Count)
   =================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
    padding: 20px;
}

.modal-container {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.modal-container.large {
    max-width: 1200px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
}
