/* ============================================================================== */
/* CAI LIGHT THEME - HOMAGE EDITION (Cel-Tech-Serv Pty Ltd Exact Colours)         */
/* ============================================================================== */

body { background-color: #f8fafc; color: #1e293b; font-family: 'Courier New', monospace; }

/* SCROLLBARS */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* COMPONENTS */
.status-dot { height: 8px; width: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-online { background-color: #007b5f; box-shadow: 0 0 8px rgba(0, 123, 95, 0.4); } 
.status-offline { background-color: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }

.btn-tab { padding: 0 24px; border-bottom: 2px solid transparent; color: #64748b; font-weight: bold; transition: all 0.2s; letter-spacing: 1px; font-size: 0.85rem; display: flex; align-items: center; }
.btn-tab:hover { color: #334155; background: rgba(0,0,0,0.03); }
.btn-tab.active { border-bottom: 2px solid #3f5bca; color: #3f5bca; background: linear-gradient(to top, rgba(63, 91, 202, 0.05), transparent); }

/* Input Fields for Light Mode */
.dark-input { background-color: #ffffff; border: 1px solid #cbd5e1; color: #1e293b; padding: 8px; font-size: 0.85rem; outline: none; transition: border-color 0.2s; }
.dark-input:focus { border-color: #3f5bca; box-shadow: 0 0 0 1px #3f5bca; }

/* TELEMETRY DIALS */
.dial { width: 80px; height: 80px; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center; background: #e2e8f0; margin-bottom: 5px; }
.dial::before { content: ""; position: absolute; top: 10px; left: 10px; right: 10px; bottom: 10px; background: #ffffff; border-radius: 50%; z-index: 1; }
.dial-val { z-index: 2; font-size: 0.85rem; font-weight: bold; color: #1e293b; }
.dial-wrapper { display: flex; flex-direction: column; align-items: center; }
.dial-label { font-size: 0.7rem; color: #64748b; font-weight: bold; }

/* ============================================================================== */
/* MATRIX FLEXBOX CONSTRAINTS (The Overflow & Cropping Fix)                       */
/* ============================================================================== */

/* Keep the rigid 16:9 ratio ONLY for the single preview in the Config Tab */
.video-container {
    aspect-ratio: 16/9; 
    background: #e2e8f0; 
    border: 1px solid #cbd5e1; 
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); 
    min-height: 0; 
}

/* Playback Matrix must be fully fluid to prevent cropping */
.playback-matrix-container {
    position: relative; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    min-height: 0; /* CRITICAL: Stops flex items from expanding past their bounds */
}

/* Force video to fit inside its boundaries without cropping (Letterbox mode) */
.video-frame, .playback-matrix-container video { 
    width: 100%; 
    height: 100%; 
    object-fit: contain !important; 
}

/* ============================================================================== */
/* LIVE MATRIX MAXIMIZER (DOM Override)                                           */
/* ============================================================================== */
.matrix-cell.matrix-maximized {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background-color: #000;
}

/* ============================================================================== */
/* CEL-TECH-SERV PTY LTD: EXPORT PIPS (HANDLES)                                   */
/* ============================================================================== */
.export-pip {
    position: absolute;
    top: -10px;
    height: calc(100% + 20px);
    width: 4px;
    z-index: 60;
    cursor: ew-resize;
    display: none; /* Hidden by default */
}

#export-start { background-color: #3b82f6; border-left: 1px solid white; }
#export-end { background-color: #ef4444; border-right: 1px solid white; }

/* The shaded "Selection" area between the pips */
#export-selection {
    position: absolute;
    height: 100%;
    background-color: rgba(59, 130, 246, 0.2);
    z-index: 55;
    display: none;
}

#pb-timeline-container {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    background: #e2e8f0;
    /* Hide scrollbar for Chrome/Safari */
    scrollbar-width: none; 
}

#pb-timeline-container::-webkit-scrollbar {
    display: none;
}

/* CEL-TECH-SERV PTY LTD: HIGH-INTENSITY UI LOADER */
.cai-loader {
    width: 32px;
    height: 32px;
    /* Thicker, solid white base for maximum visibility */
    border: 4px solid rgba(255, 255, 255, 0.8); 
    border-radius: 50%;
    /* High-contrast Electric Teal */
    border-top-color: #00ffcc; 
    /* Subtle glow effect to make it 'pop' */
    filter: drop-shadow(0 0 8px rgba(0, 255, 204, 0.6));
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

.loader-overlay {
    /* Slightly darker backdrop to make the white/neon spinner stand out */
    background: rgba(15, 23, 42, 0.7); 
    backdrop-filter: blur(4px);
    transition: opacity 0.4s ease;
}