/**
 * Preview Component Styles
 * 
 * Styles for the frame preview component including:
 * - Preview window and canvas layout
 * - Playback controls (Play/Yalp buttons)
 * - Speed controls
 * - Navigation overlay
 * - Responsive design
 * 
 * Features:
 * - Dynamic canvas sizing to fill available space
 * - Modern button design with hover effects
 * - Consistent color scheme (gray inactive, blue active)
 * - Responsive layout for mobile devices
 * 
 * @author Your Name
 * @version 1.0.0
 */

/* ============================================================================
   FRAME PREVIEW CONTAINER
   ============================================================================ */

.frame-preview {
    background-color: #2a2a2a;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1; /* Take up all available space */
    min-height: 0; /* Allow flex item to shrink */
}

/* ============================================================================
   PREVIEW HEADER
   ============================================================================ */

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.preview-header h3 {
    color: #e0e0e0;
}

.frame-info {
    display: flex;
    gap: 24px;
    color: #888;
    font-size: 14px;
}

.frame-preview.compact-layout .frame-info {
    gap: 12px;
    font-size: 12px;
    flex-wrap: wrap;
}

.frame-preview.compact-layout .frame-info span {
    white-space: nowrap;
}

#timestamp {
    color: #4CAF50;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

#timestamp:hover {
    background-color: rgba(76, 175, 80, 0.1);
}

.layout-toggle-btn {
    background: #444;
    color: #ccc;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.layout-toggle-btn:hover {
    background: #555;
    color: #fff;
}

.layout-toggle-btn .icon {
    font-size: 16px;
    font-weight: bold;
}

/* ============================================================================
   PREVIEW CONTENT WRAPPER
   ============================================================================ */

.preview-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Allow it to shrink */
}

/* ============================================================================
   PREVIEW WINDOW
   ============================================================================ */

.preview-window {
    position: relative;
    flex: 1; /* Take up available space but allow shrinking */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
    min-height: 300px; /* Minimum height */
    max-height: 500px; /* Maximum height */

.frame-load-indicator {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 15;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(15, 17, 21, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #eef3f8;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.frame-load-indicator.hidden {
    display: none;
}

.frame-load-spinner {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(232, 188, 106, 0.32);
    border-top-color: #e8bc6a;
    animation: frameLoadSpin 0.9s linear infinite;
}

@keyframes frameLoadSpin {
    to {
        transform: rotate(360deg);
    }
}
}

#frame-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ============================================================================
   NAVIGATION OVERLAY
   ============================================================================ */

.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    opacity: 0;
    transition: opacity 0.3s;
}

.preview-window:hover .preview-overlay {
    opacity: 1;
}

.nav-btn {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

/* ============================================================================
   PLAYBACK CONTROLS
   ============================================================================ */

.preview-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #2a2a2a 0%, #333 100%);
    border-radius: 8px;
    border: 1px solid #444;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* ============================================================================
   CONTROL BUTTONS
   ============================================================================ */

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 60px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #444;
    color: #ccc;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    gap: 4px;
}

.control-btn:hover {
    background-color: #555;
    color: #fff;
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Primary button (Play) - inactive state */
.control-btn.primary {
    background: linear-gradient(135deg, #444 0%, #555 100%);
    color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn.primary:hover {
    background: linear-gradient(135deg, #555 0%, #666 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Active state (playing) - both buttons */
.control-btn.primary.paused {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.control-btn.primary.paused:hover {
    background: linear-gradient(135deg, #357abd 0%, #2e6da4 100%);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.control-btn.paused {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.control-btn.paused:hover {
    background: linear-gradient(135deg, #357abd 0%, #2e6da4 100%);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* Button content */
.control-btn .icon {
    font-size: 18px;
    line-height: 1;
}

.control-btn .label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================================
   SPEED CONTROLS
   ============================================================================ */

.speed-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ccc;
    font-size: 14px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.speed-controls label {
    font-weight: 500;
    color: #bbb;
}

#playback-speed {
    padding: 6px 12px;
    background-color: #444;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#playback-speed:hover {
    background-color: #555;
    border-color: #666;
}

#playback-speed:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Compact layout - when preview window is constrained */
.frame-preview.compact-layout {
    /* Keep header at top, make preview and controls side by side */
    flex-direction: column !important; /* Keep header at top */
    border: 2px solid #ffaa00; /* Visual indicator that compact mode is active */
    background-color: rgba(255, 170, 0, 0.1) !important; /* Very obvious indicator */
}

.frame-preview.compact-layout .preview-window {
    flex: 1;
    margin-bottom: 0;
    min-height: 350px;
    max-height: 500px;
    border-radius: 8px;
}

.frame-preview.compact-layout .preview-controls {
    flex-shrink: 0;
    width: 200px;
    margin-top: 0;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    height: 350px;
    min-height: 350px;
    max-height: 500px;
    padding: 16px;
}

/* Compact layout - make preview content horizontal */
.frame-preview.compact-layout .preview-content {
    flex-direction: row !important;
    gap: 12px !important;
}

.frame-preview.compact-layout .preview-window {
    flex: 1 !important;
    margin-bottom: 0 !important;
}

.frame-preview.compact-layout .preview-controls {
    flex-shrink: 0 !important;
    width: 200px !important;
    margin-top: 0 !important;
}

.frame-preview.compact-layout .preview-window {
    flex: 1;
    margin-bottom: 0;
    margin-top: 0;
    min-height: 350px;
    max-height: 500px;
    border-radius: 8px;
}

.frame-preview.compact-layout .preview-controls {
    flex-shrink: 0;
    width: 200px;
    margin-top: 0;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    height: 350px;
    min-height: 350px;
    max-height: 500px;
    padding: 16px;
}

.frame-preview.compact-layout .playback-controls {
    flex-direction: column;
    gap: 6px;
    margin-bottom: 0;
}

.frame-preview.compact-layout .playback-controls .control-btn {
    width: 100%;
    height: 40px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 10px;
    gap: 8px;
    font-size: 12px;
}

.frame-preview.compact-layout .playback-controls .control-btn .icon {
    font-size: 14px;
}

.frame-preview.compact-layout .playback-controls .control-btn .label {
    font-size: 10px;
}

.frame-preview.compact-layout .speed-controls {
    position: static;
    transform: none;
    justify-content: center;
    margin-bottom: 0;
    padding: 12px 0;
    border-top: 1px solid #444;
    border-bottom: 1px solid #444;
}

.frame-preview.compact-layout .annotation-controls {
    flex-direction: column;
    gap: 6px;
    flex: 1;
    justify-content: flex-start;
    padding-top: 12px;
}

.frame-preview.compact-layout .annotation-controls .control-btn {
    width: 100%;
    height: 40px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 10px;
    gap: 8px;
    font-size: 12px;
}

.frame-preview.compact-layout .annotation-controls .control-btn .icon {
    font-size: 14px;
}

.frame-preview.compact-layout .annotation-controls .control-btn .label {
    font-size: 10px;
}

/* Small screens - stack everything vertically */
@media (max-width: 768px) {
    .frame-preview {
        flex-direction: column;
        gap: 15px;
    }
    
    .preview-header {
        margin-bottom: 15px;
    }
    
    .preview-window {
        min-height: 200px;
        margin-bottom: 15px;
    }
    
    .preview-controls {
        width: 100%;
        margin-top: 0;
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .playback-controls {
        flex-direction: row;
        justify-content: center;
        gap: 16px;
        margin-bottom: 0;
    }
    
    .speed-controls {
        justify-content: center;
        margin-bottom: 0;
    }
    
    .annotation-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    .annotation-controls .control-btn {
        width: auto;
        min-width: 80px;
        height: 50px;
        flex-direction: column;
        justify-content: center;
        padding: 0;
        gap: 4px;
    }
    
    .annotation-controls .control-btn .icon {
        font-size: 18px;
    }
    
    .annotation-controls .control-btn .label {
        font-size: 11px;
    }
    
    .frame-info {
        flex-direction: column;
        gap: 5px;
    }
} 