/* Multi-Angle Viewer Styles */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --dark-bg: #1a1a1a;
    --dark-surface: #2d2d2d;
    --dark-border: #404040;
    --header-height: 60px;
    --controls-height: 80px;
    --sidebar-width: 280px;
    --transition-speed: 0.3s;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    overflow: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
    transition: opacity 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-status {
    color: #adb5bd;
    margin-top: 10px;
}

/* Header */
.viewer-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.viewer-header .gap-3 {
    gap: 1rem !important;
}

/* Main Layout */
.viewer-main {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: var(--controls-height);
    background-color: #f8f9fa;
    overflow: hidden;
}

/* Camera Sidebar */
.camera-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: white;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) ease;
    z-index: 100;
}

.camera-sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e9ecef;
    margin-top: auto;
}

.camera-categories {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.camera-category {
    margin-bottom: 1.5rem;
}

.category-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
    margin-bottom: 0.5rem;
    display:none;
}

.camera-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.camera-item:hover {
    background-color: #f8f9fa;
}

.camera-item.active {
    background-color: #e3f2fd;
    color: var(--primary-color);
}

.camera-preview {
    width: 80px;
    height: 45px;
    background-color: #000;
    border-radius: 0.25rem;
    margin-right: 0.75rem;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.camera-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
}

.camera-preview::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: none;
    pointer-events: none;
}

.camera-preview.paused::after {
    display: block;
    background: radial-gradient(circle, transparent 30%, rgba(255, 255, 255, 0.8) 30%);
}

.camera-preview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #495057;
    color: #adb5bd;
}

.camera-info {
    flex: 1;
}

.camera-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.125rem;
}

.camera-status {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Video Container */
.video-container {
    position: absolute;
    left: var(--sidebar-width);
    top: 0;
    width: calc(100% - var(--sidebar-width));
    bottom: 0;
    transition: left var(--transition-speed) ease, width var(--transition-speed) ease;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.camera-sidebar.collapsed ~ .video-container {
    left: 40px; /* Space for toggle button */
    width: calc(100% - 40px);
}

/* Sidebar Toggle Button (when collapsed) */
.sidebar-toggle-collapsed {
    position: fixed;
    left: 0;
    top: calc(var(--header-height) + 1rem);
    width: 36px;
    height: 36px;
    background-color: white;
    border: 1px solid #e9ecef;
    border-left: none;
    border-radius: 0 4px 4px 0;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 101;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease;
}

.sidebar-toggle-collapsed:hover {
    background-color: #f8f9fa;
}

.camera-sidebar.collapsed ~ .sidebar-toggle-collapsed {
    display: flex;
}

.dark-mode .sidebar-toggle-collapsed {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.dark-mode .sidebar-toggle-collapsed:hover {
    background-color: var(--dark-bg);
}

/* Video Grid */
.video-grid {
    display: grid;
    gap: 0.5rem;
    flex: 1;
    width: 100%;
    height: 100%;
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
    align-content: stretch;
    align-items: stretch;
    justify-items: stretch;
}

.video-grid.grid-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.video-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 1fr;
}

.video-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.video-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.video-grid.grid-5,
.video-grid.grid-6 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* Video Player */
.video-player {
    position: relative;
    background-color: #000;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    aspect-ratio: 16/9;
    max-height: 100%;
    max-width: 100%;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure video player respects grid cell boundaries */
.video-grid > .video-player {
    min-width: 0;
    min-height: 0;
}

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

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-player:hover .video-overlay {
    opacity: 1;
}

.video-title {
    font-size: 0.875rem;
    font-weight: 500;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-player:hover .video-controls {
    opacity: 1;
}

.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
}

/* Empty State */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: none;
    z-index: 10; /* Ensure it's above other elements */
}

.video-grid:empty + .empty-state {
    display: block;
}

/* When grid has no children, show empty state */
.video-grid:not(:has(*)) + .empty-state {
    display: block;
}

/* Playback Controls */
.playback-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--controls-height);
    background-color: white;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.controls-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 2rem;
}

/* Timeline */
.timeline-container {
    margin-bottom: 1rem;
}

.timeline {
    position: relative;
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
}

.timeline-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #dee2e6;
    transition: width 0.1s linear;
}

.timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.1s linear;
}

.timeline-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background-color: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.timeline:hover .timeline-thumb {
    opacity: 1;
}

/* Control Buttons */
.control-buttons {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.time-display {
    font-size: 0.875rem;
    color: #6c757d;
    min-width: 100px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #e9ecef;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.speed-control .dropdown-toggle {
    min-width: 80px;
}

/* Match Info Panel */
.match-info-panel {
    position: fixed;
    bottom: var(--controls-height);
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid #e9ecef;
    padding: 1.5rem 0;
    transform: translateY(100%);
    transition: transform var(--transition-speed) ease;
    z-index: 500;
}

.match-info-panel.show {
    transform: translateY(0);
}

.match-card {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.player-info {
    position: relative;
}

.player-info.winner::after {
    content: 'WINNER';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--success-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.player-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    margin-bottom: 0.5rem;
}

.player-stats {
    font-size: 0.875rem;
    color: #6c757d;
}

.vs-badge {
    background-color: var(--danger-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
}

.match-details {
    background-color: white;
    border-radius: 0.375rem;
    padding: 1rem;
}

/* Focus Mode */
.video-grid.focus-mode {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.video-grid.focus-mode .video-player {
    display: none;
}

.video-grid.focus-mode .video-player:first-child {
    display: block;
}

/* Dark Mode */
body.dark-mode {
    background-color: var(--dark-bg);
    color: white;
}

.dark-mode .viewer-main {
    background-color: var(--dark-bg);
}

.dark-mode .camera-sidebar {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.dark-mode .sidebar-header,
.dark-mode .sidebar-footer {
    border-color: var(--dark-border);
}

.dark-mode .camera-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dark-mode .camera-item.active {
    background-color: rgba(13, 110, 253, 0.15);
}

.dark-mode .playback-controls {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.dark-mode .timeline {
    background-color: var(--dark-border);
}

.dark-mode .match-info-panel {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.dark-mode .match-card {
    background-color: var(--dark-bg);
}

.dark-mode .match-details {
    background-color: var(--dark-surface);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .video-grid.grid-5,
    .video-grid.grid-6 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    /* Keep 2-column layout for 4+ videos on tablets */
    .video-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
    }
    
    .video-grid.grid-5,
    .video-grid.grid-6 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
        --header-height: 50px;
        --controls-height: 120px;
    }
    
    .camera-sidebar {
        position: fixed;
        z-index: 1100;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .video-container {
        left: 0;
        width: 100%;
    }
    
    /* Only use single column on mobile */
    .video-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: repeat(auto-fit, minmax(200px, 1fr)) !important;
        max-height: 100%;
        overflow-y: auto; /* Allow scrolling on mobile if needed */
    }
    
    .control-buttons {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .viewer-header h1 {
        font-size: 1rem;
    }
    
    .viewer-header .gap-3 {
        gap: 0.5rem !important;
    }
}

/* Download control styling */
.download-control {
    margin-left: 1rem;
}

.download-control .btn {
    white-space: nowrap;
}

/* Dark mode support for download progress overlay */
body.dark-mode .download-progress-overlay .container {
    background-color: #2d2d2d;
    color: #ffffff;
}

body.dark-mode .download-progress-overlay h4 {
    color: #ffffff;
}

body.dark-mode .download-progress-overlay .text-muted {
    color: #a0a0a0 !important;
}

/* Fight summary in control bar */
.fight-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 15px;
    padding: 0 15px;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.fight-matchup {
    font-weight: 600;
    color: #333;
}

.vs-text {
    font-weight: 400;
    font-style: italic;
    color: #dc3545;
    margin: 0 5px;
}

.fight-class {
    font-size: 0.9em;
    color: #666;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
}

#fightDetailsBtn {
    margin-right: 15px;
}

/* Dark mode adjustments for fight summary */
body.dark-mode .fight-summary {
    border-left-color: rgba(255, 255, 255, 0.2);
    border-right-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .fight-matchup {
    color: #fff;
}

body.dark-mode .fight-class {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
}

/* Fight details modal styles */
.bot-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    background-color: rgba(128, 128, 128, 0.15);
}

.player-details {
    padding: 20px;
    position: relative;
}

.player-details.winner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(40, 167, 69, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.player-record {
    font-size: 1.1em;
    margin: 10px 0;
}

.vs-badge-modal {
    font-size: 2rem;
    font-weight: bold;
    background-color: #dc3545;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    display: inline-block;
}

.info-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    height: 100%;
}

.info-card h6 {
    font-size: 0.9em;
    margin-bottom: 5px;
}

.info-card p {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

/* Dark mode support for modal */
body.dark-mode .modal-content {
    background-color: #2d2d2d;
    color: #fff;
}

body.dark-mode .modal-header {
    border-bottom-color: #404040;
}

body.dark-mode .modal-footer {
    border-top-color: #404040;
}

body.dark-mode .btn-close {
    filter: invert(1);
}

body.dark-mode .info-card {
    background: #1a1a1a;
    color: #fff;
}

body.dark-mode .info-card h6 {
    color: #a0a0a0;
}

body.dark-mode .info-card p {
    color: #fff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .fight-summary {
        flex-direction: column;
        gap: 5px;
        font-size: 0.9em;
        padding: 0 10px;
    }
    
    .fight-class {
        font-size: 0.8em;
    }
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Mobile detection for touch-specific features */
@media (hover: none) and (pointer: coarse) {
    /* Touch-friendly tap targets */
    .camera-item {
        min-height: 60px;
        padding: 0.75rem;
    }
    
    .btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (max-width: 767px) {
    :root {
        --header-height: 50px;
        --controls-height: 120px;
        --sidebar-width: 100%;
    }
    
    /* Hide desktop-only elements */
    .viewer-header .gap-3 > *:not(#darkModeToggle):not(.btn-group) {
        display: none;
    }
    
    /* Simplified header */
    .viewer-header {
        padding: 0 0.5rem;
    }
    
    .viewer-header h1 {
        font-size: 1rem;
        margin-left: 0.5rem;
    }
    
    /* Mobile sidebar as bottom sheet */
    .camera-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        height: 50vh;
        width: 100%;
        transform: translateY(100%);
        border-right: none;
        border-top: 1px solid #e9ecef;
        border-radius: 1rem 1rem 0 0;
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
        z-index: 1100;
    }
    
    .camera-sidebar.open {
        transform: translateY(0);
    }
    
    /* Mobile sidebar header with drag handle */
    .sidebar-header {
        position: relative;
        padding-top: 1.5rem;
    }
    
    .sidebar-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background-color: #dee2e6;
        border-radius: 2px;
    }
    
    /* Hide desktop sidebar toggle */
    #toggleSidebar {
        display: none;
    }
    
    /* Mobile sidebar toggle button */
    .mobile-camera-toggle {
        position: fixed;
        bottom: calc(var(--controls-height) + 1rem);
        right: 1rem;
        width: 56px;
        height: 56px;
        background-color: var(--primary-color);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        z-index: 1050;
        border: none;
        cursor: pointer;
    }
    
    .mobile-camera-toggle:active {
        transform: scale(0.95);
    }
    
    /* Video container full width on mobile */
    .video-container {
        left: 0;
        width: 100%;
        padding: 0.5rem;
    }
    
    .camera-sidebar.collapsed ~ .video-container {
        left: 0;
        width: 100%;
    }
    
    /* Hide collapsed sidebar toggle on mobile */
    .sidebar-toggle-collapsed {
        display: none !important;
    }
    
    /* Mobile video grid */
    .video-grid {
        gap: 0.25rem;
    }
    
    /* Force 1x1 or 2x1 grid on mobile */
    .video-grid.grid-1,
    .video-grid.grid-2 {
        grid-template-columns: 1fr;
    }
    
    .video-grid.grid-3,
    .video-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
    }
    
    .video-grid.grid-5,
    .video-grid.grid-6 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
    
    /* Mobile playback controls */
    .playback-controls {
        height: var(--controls-height);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .controls-wrapper {
        padding: 0 1rem;
    }
    
    /* Stack controls on mobile */
    .control-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: space-between;
    }
    
    /* Primary controls row */
    .control-buttons > .btn-primary {
        order: 1;
        flex: 0 0 auto;
    }
    
    .time-display {
        order: 2;
        flex: 1;
        text-align: center;
        min-width: auto;
    }
    
    /* Secondary controls row */
    .volume-control {
        order: 3;
        flex: 0 0 45%;
    }
    
    .speed-control {
        order: 4;
        flex: 0 0 45%;
        text-align: right;
    }
    
    /* Hide fight summary on mobile - show in modal */
    .fight-summary {
        display: none;
    }
    
    /* Hide download button on mobile */
    .download-control {
        display: none;
    }
    
    /* Mobile camera list */
    .camera-categories {
        padding: 0.5rem;
    }
    
    .camera-item {
        margin-bottom: 0.5rem;
        border: 1px solid #e9ecef;
        border-radius: 0.5rem;
    }
    
    .camera-item.active {
        border-color: var(--primary-color);
    }
    
    /* Mobile-optimized empty state */
    .empty-state {
        padding: 2rem;
        text-align: center;
    }
    
    .empty-state h5 {
        font-size: 1.1rem;
    }
    
    .empty-state p {
        font-size: 0.9rem;
    }
    
    /* Mobile backdrop for sidebar */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1090;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mobile volume slider */
    .volume-control {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .volume-slider {
        flex: 1;
    }
    
    /* Touch-friendly timeline */
    .timeline {
        height: 8px;
        margin: 0.5rem 0 1rem;
    }
    
    .timeline-thumb {
        width: 20px;
        height: 20px;
        opacity: 1; /* Always visible on mobile */
    }
    
    /* Mobile view mode toggle */
    .mobile-view-toggle {
        position: fixed;
        top: calc(var(--header-height) + 0.5rem);
        right: 0.5rem;
        background-color: white;
        border-radius: 20px;
        padding: 4px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        z-index: 100;
        display: flex;
        gap: 4px;
    }
    
    .mobile-view-toggle button {
        background: none;
        border: none;
        padding: 0.5rem 1rem;
        border-radius: 16px;
        font-size: 0.875rem;
        color: #6c757d;
        transition: all 0.2s ease;
    }
    
    .mobile-view-toggle button.active {
        background-color: var(--primary-color);
        color: white;
    }
    
    /* Mobile quality indicator */
    .mobile-quality-badge {
        position: fixed;
        top: calc(var(--header-height) + 0.5rem);
        left: 0.5rem;
        background-color: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 0.25rem 0.75rem;
        border-radius: 16px;
        font-size: 0.75rem;
        z-index: 100;
    }
    
    /* Swipe hint for mobile */
    .swipe-hint {
        position: fixed;
        bottom: calc(var(--controls-height) + 5rem);
        left: 50%;
        transform: translateX(-50%);
        background-color: rgba(0, 0, 0, 0.8);
        color: white;
        padding: 0.5rem 1rem;
        border-radius: 20px;
        font-size: 0.875rem;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
        z-index: 1000;
    }
    
    .swipe-hint.show {
        opacity: 1;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575px) {
    /* Even more compact controls */
    .control-buttons {
        gap: 0.25rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Single column video grid on very small screens */
    .video-grid.grid-3,
    .video-grid.grid-4,
    .video-grid.grid-5,
    .video-grid.grid-6 {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }
    
    /* Compact camera items */
    .camera-preview {
        width: 60px;
        height: 34px;
    }
    
    .camera-name {
        font-size: 0.8rem;
    }
    
    .camera-status {
        display: none;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 767px) and (orientation: landscape) {
    :root {
        --header-height: 40px;
        --controls-height: 60px;
    }
    
    .camera-sidebar {
        height: 80vh;
    }
    
    /* Force 2x2 grid in landscape */
    .video-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
    }
    
    /* Hide some controls in landscape to save space */
    .mobile-quality-badge,
    .mobile-view-toggle {
        display: none;
    }
}

/* Dark mode mobile adjustments */
.dark-mode .camera-sidebar {
    background-color: var(--dark-surface);
    border-top-color: var(--dark-border);
}

.dark-mode .mobile-camera-toggle {
    background-color: #495057;
}

.dark-mode .mobile-view-toggle {
    background-color: var(--dark-surface);
}

.dark-mode .camera-item {
    border-color: var(--dark-border);
}

.dark-mode .camera-item.active {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

/* iOS specific adjustments */
@supports (-webkit-touch-callout: none) {
    /* iOS elastic scroll */
    .camera-categories {
        -webkit-overflow-scrolling: touch;
    }
    
    /* iOS safe areas */
    .playback-controls {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    
    .camera-sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Ensure videos play inline */
    video {
        -webkit-playsinline: true;
        playsinline: true;
    }
    
    /* Prevent iOS video fullscreen */
    video::-webkit-media-controls-fullscreen-button {
        display: none;
    }
} 