/* ========================================
   BEAMX1 — Video Scenario Styles
   Split-screen layout: video left, content right
   ======================================== */

/* ========================================
   Video Preload Progress (in training card)
   ======================================== */
.video-preload-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.video-preload-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.video-preload-fill {
    height: 100%;
    background: var(--beam);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.video-preload-label {
    white-space: nowrap;
    min-width: 40px;
    text-align: right;
}

.video-preload-status.error { color: var(--danger); }
.video-preload-status.error .video-preload-fill { background: var(--danger); }
.video-preload-status.ready { color: var(--beam); }
.video-preload-status.ready .video-preload-fill { background: var(--beam); }

/* ========================================
   Split-Screen Layout (scenario stage)
   ======================================== */
.scenario-video-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 0;
    height: 100%;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    align-items: start;
    min-height: calc(100vh - 80px);
    box-sizing: border-box;
}

/* Video panel (left) */
.scenario-video-panel {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-lg);
}

.scenario-video-player {
    width: 100%;
    max-height: calc(100vh - 120px);
    aspect-ratio: 9 / 16;
    object-fit: contain;
    border-radius: var(--radius-lg);
}

/* Content panel (right) */
.scenario-video-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: calc(100vh - 80px);
}

/* Step header (top) */
.sv-step-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-xl) 0;
}

.sv-step-number {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--beam);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sv-step-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.sv-step-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Transcript area (middle, grows) */
.sv-transcript-area {
    flex: 1;
    padding: var(--space-lg) var(--space-xl);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.sv-transcript-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-xl);
}

.sv-transcript-badge {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    color: var(--text-muted);
}

.sv-transcript-badge span {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.sv-transcript-badge svg {
    opacity: 0.6;
}

.sv-transcript-text {
    font-size: 0.9375rem;
    line-height: 1.85;
    color: var(--text-primary);
}

/* Hint (mic listening) */
.sv-hint {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.sv-hint .mic-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: mic-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes mic-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Bottom bar (controls) */
.sv-bottom-bar {
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 56px;
}

/* Waiting for voice indicator */
.sv-waiting-voice {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
    padding: var(--space-xs) 0;
}

.sv-continue-btn {
    /* inherits .btn .btn-primary */
}

.sv-continue-btn[disabled] {
    opacity: 0.4;
    pointer-events: none;
}

.sv-continue-btn.ready {
    opacity: 1;
}

/* Voice choice options */
.scenario-video-choices {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.scenario-video-choice-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: border-color 0.2s, color 0.2s;
}

.scenario-video-choice-option.detected {
    border-color: var(--beam);
    color: var(--beam);
    background: rgba(16, 185, 129, 0.08);
}

.scenario-video-choice-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.scenario-video-choice-option.detected .scenario-video-choice-number {
    background: var(--beam);
    color: var(--bg);
}

/* No-choice warning */
.scenario-video-warning {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--danger);
}

/* ========================================
   Responsive: Mobile (<768px)
   ======================================== */
@media (max-width: 768px) {
    .scenario-video-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        min-height: auto;
    }

    .scenario-video-panel {
        max-height: 45vh;
        padding: var(--space-md);
    }

    .scenario-video-player {
        max-height: 45vh;
        border-radius: var(--radius-md);
    }

    .scenario-video-content {
        min-height: auto;
    }

    .sv-step-header {
        padding: var(--space-md) var(--space-md) 0;
    }

    .sv-transcript-area {
        padding: var(--space-md);
    }

    .sv-transcript-card {
        padding: var(--space-md);
    }

    .sv-transcript-text {
        font-size: 0.875rem;
    }

    .sv-bottom-bar {
        padding: var(--space-md);
    }
}

/* ========================================
   Fallback hint — shown when STT is not supported
   (replaces the mic-dot "listening" hint)
   ======================================== */
.sv-hint-fallback {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    line-height: 1.4;
}
.sv-hint-fallback svg {
    color: var(--warning);
    flex-shrink: 0;
    margin-top: 1px;
}

/* ========================================
   Runtime Status Toast — surfaces STT errors
   during a running scenario (bottom-center)
   ======================================== */
.scenario-status-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 20px);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(560px, calc(100% - 40px));
    padding: 12px 14px 12px 12px;
    background: rgba(20, 20, 20, 0.95);
    color: #fff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(245, 158, 11, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    font-size: 0.8125rem;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 180ms var(--ease), transform 180ms var(--ease);
    z-index: 10000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.scenario-status-toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}
.scenario-status-toast.warning svg { color: var(--warning); }
.scenario-status-toast.error { border-color: rgba(239, 68, 68, 0.6); }
.scenario-status-toast.error svg { color: var(--danger); }
.scenario-status-toast-msg {
    flex: 1;
    min-width: 0;
    color: #fff;
}
.scenario-status-toast-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 50%;
}
.scenario-status-toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
