/* Simple Sync Viewer - Streamlined Multi-Angle Video Player */

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

/* 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;
    height: 100vh;
}

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

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

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

/* 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 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0 1rem;
}

.viewer-header .container-fluid {
    height: 100%;
    display: flex;
    align-items: center;
}

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

/* Camera Sidebar */
.camera-sidebar {
    height: 100%;
    background-color: white;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

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

/* Camera Items */
.camera-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: white;
}

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

.camera-item.selected {
    border-color: #0d6efd;
    background-color: #e7f3ff;
}

.camera-item .camera-icon {
    width: 40px;
    height: 40px;
    background-color: #6c757d;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.camera-item.selected .camera-icon {
    background-color: #0d6efd;
}

.camera-item .camera-info {
    flex: 1;
    min-width: 0;
}

.camera-item .camera-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.camera-item .camera-category {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0;
}

.camera-item.selected .camera-category {
    color: #0d6efd;
}

/* Video Container */
.video-container {
    height: 100%;
    padding: 1rem;
    background-color: #212529;
    position: relative;
}

/* Video Grid */
.video-grid {
    display: grid;
    gap: 0.5rem;
    height: 100%;
    width: 100%;
}

/* Grid layouts based on video count */
.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,
.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;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
}

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

.video-player .video-label {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

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

.video-player .audio-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    z-index: 2;
}

/* Empty State */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    display: none;
}

.video-grid:empty ~ .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);
    padding: 0.75rem 1rem;
    z-index: 1000;
}

/* Timeline */
.timeline-container {
    width: 100%;
}

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

.timeline:hover {
    height: 8px;
}

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

.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.3);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

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

/* Volume Slider */
.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;
}

/* Fight Info */
.fight-info {
    font-size: 0.875rem;
}

.time-display {
    font-size: 0.875rem;
    color: #6c757d;
    font-variant-numeric: tabular-nums;
}

/* Mobile Camera Toggle */
.mobile-camera-toggle {
    position: fixed;
    bottom: calc(var(--controls-height) + 1rem);
    right: 1rem;
    width: 56px;
    height: 56px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    cursor: pointer;
    display: none;
}

.mobile-camera-toggle:active {
    transform: scale(0.95);
}

.mobile-camera-toggle .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    font-size: 0.75rem;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
}

.sidebar-backdrop.show {
    display: block;
}

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

.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 {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.dark-mode .camera-item:hover {
    background-color: var(--dark-bg);
    border-color: var(--primary-color);
}

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

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

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

.dark-mode .timeline-buffer {
    background-color: #495057;
}

/* Responsive Design */
@media (max-width: 767px) {
    :root {
        --header-height: 50px;
        --controls-height: 100px;
    }
    
    .camera-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1060;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        border-right: none;
        border-top: 1px solid #e9ecef;
    }
    
    .camera-sidebar.open {
        transform: translateY(0);
    }
    
    .mobile-camera-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .video-container {
        padding: 0.5rem;
    }
    
    .video-grid.grid-3,
    .video-grid.grid-4,
    .video-grid.grid-5,
    .video-grid.grid-6 {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
    
    .fight-info {
        font-size: 0.75rem;
    }
    
    .playback-controls {
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 575px) {
    .video-grid.grid-3,
    .video-grid.grid-4,
    .video-grid.grid-5,
    .video-grid.grid-6 {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(200px, 1fr);
    }
    
    .timeline {
        height: 8px;
    }
    
    .timeline-thumb {
        opacity: 1;
        width: 16px;
        height: 16px;
    }
}

/* Smooth transitions */
.video-player,
.camera-item,
.timeline-progress,
.timeline-thumb {
    transition: all 0.2s ease;
}

/* Focus states for accessibility */
button:focus-visible,
.camera-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading spinner animation */
@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.video-loading i {
    animation: spin 1s linear infinite;
}

/* Ensure proper aspect ratios */
.video-player {
    aspect-ratio: 16 / 9;
}

@media (max-width: 767px) {
    .video-player {
        aspect-ratio: auto;
    }
}

