/* ==========================================================================
   Investep Academy Player - Terminal Theme
   Estética profesional tipo terminal de trading
   ========================================================================== */

:root {
    /* Base Colors - Dark Terminal */
    --bg-primary: #0a0b0f;
    --bg-secondary: #111318;
    --bg-elevated: #1a1d24;
    --bg-hover: #252a33;
    
    /* Accent Colors - Trading Theme */
    --accent-primary: #00d084;
    --accent-secondary: #00a86b;
    --accent-glow: rgba(0, 208, 132, 0.3);
    --accent-dim: rgba(0, 208, 132, 0.1);
    
    /* Trading Colors */
    --bullish: #00d084;
    --bearish: #ff4757;
    --warning: #ffa502;
    --info: #3742fa;
    
    /* Text */
    --text-primary: #e8e9ec;
    --text-secondary: #8b92a8;
    --text-muted: #4a5063;
    
    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(0, 208, 132, 0.2);
    
    /* Typography */
    --font-display: 'JetBrains Mono', monospace;
    --font-body: 'Inter', system-ui, sans-serif;
    
    /* Spacing */
    --sidebar-width: 320px;
    --notes-width: 380px;
    --header-height: 60px;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.app-container {
    display: flex;
    height: 100vh;
    background: var(--bg-primary);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo-link {
    text-decoration: none;
    display: block;
    min-width: 0;
}

.logo-link:hover .logo { color: var(--accent-secondary); }

.header-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.hdr-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.hdr-btn:hover {
    color: var(--accent-primary);
    border-color: var(--border-accent);
    background: var(--bg-hover);
}

/* Mobile Top Bar (oculta en desktop) */
.mobile-topbar { display: none; }

.hamburger {
    width: 38px;
    height: 38px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.mt-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
}

.mt-brand i { font-size: 18px; }
.mt-actions { display: flex; gap: 6px; flex-shrink: 0; }

.sidebar-backdrop { display: none; }

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-primary);
}

.logo i {
    font-size: 22px;
}

.subtitle {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-top: 4px;
    margin-left: 32px;
}

/* Search Box */
.search-box {
    margin: 16px 16px 0;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 36px 10px 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

#clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

#clear-search:hover {
    color: var(--text-primary);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-secondary);
}

.stats-bar button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.stats-bar button:hover {
    color: var(--accent-primary);
}

/* Catalog */
.catalog-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 12px;
}

/* ── Secciones (capa superior que agrupa cursos) ── */
.section-item {
    margin-bottom: 6px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    cursor: pointer;
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    transition: background 0.2s;
}

.section-header:hover { background: var(--bg-hover); }
.section-header i:first-child { color: var(--accent-primary); margin-right: 8px; }
.section-header .caret {
    color: var(--text-muted);
    font-size: 11px;
    transition: transform 0.2s;
}
.section-header.expanded .caret { transform: rotate(180deg); }

.section-list {
    display: none;
    padding: 6px 0 2px 6px;
}
.section-list.open { display: block; }

.material-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 36px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.material-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.material-item i { color: var(--accent-primary); font-size: 12px; flex-shrink: 0; }
.material-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.course-item {
    margin-bottom: 4px;
}

.course-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    font-weight: 500;
}

.course-header:hover {
    background: var(--bg-hover);
}

.course-header i {
    color: var(--accent-primary);
    margin-right: 8px;
}

.course-header .caret {
    color: var(--text-muted);
    font-size: 12px;
    transition: transform 0.2s;
    margin-right: 0;
}

.course-header.expanded .caret {
    transform: rotate(180deg);
}

.module-list {
    margin-left: 24px;
    display: none;
}

.module-list.open {
    display: block;
}

.folder-item {
    margin: 2px 0;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.folder-header:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.folder-header i {
    margin-right: 8px;
    color: var(--text-muted);
}

.video-item {
    display: flex;
    align-items: center;
    padding: 8px 12px 8px 36px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
}

.video-item::before {
    content: '';
    position: absolute;
    left: 12px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
}

.video-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.video-item.active {
    background: var(--accent-dim);
    color: var(--accent-primary);
}

.video-item.active::before {
    background: var(--accent-primary);
}

.video-item .transcription-indicator {
    margin-left: auto;
    font-size: 10px;
    color: var(--accent-primary);
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
}

/* Video Section */
.video-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

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

.video-header h1 {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.video-actions {
    display: flex;
    gap: 8px;
}

/* Video Wrapper */
.video-wrapper {
    flex: 1;
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#video-player {
    width: 100%;
    height: 100%;
    outline: none;
}

.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.overlay-content {
    text-align: center;
    color: var(--text-muted);
}

.overlay-content i {
    font-size: 48px;
    margin-bottom: 16px;
}

.overlay-content p {
    font-size: 14px;
}

/* Transcription Overlay */
.transcription-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.progress-content {
    text-align: center;
    color: var(--text-primary);
}

.progress-content i {
    font-size: 32px;
    color: var(--accent-primary);
    margin-bottom: 12px;
    display: block;
}

.progress-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    width: 0%;
    transition: width 0.3s;
}

/* Subtitle Controls */
.subtitle-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.subtitle-controls .label {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.subtitle-controls select {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.subtitle-controls select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Transcription Panel */
/* Transcription Tab Styles */
#transcription-tab.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.transcription-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.transcription-toolbar .toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-subtle);
}

.transcription-toolbar .toolbar-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.transcription-content-wrapper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.transcription-content {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px 32px;
    font-size: 13px;
    line-height: 1.6;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.transcription-content::-webkit-scrollbar {
    width: 6px;
}

.transcription-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.transcription-content::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.transcription-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Transcription segment count badge */
.segment-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 8px;
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 12px;
}

/* Font size classes for transcription */
.transcription-font-small {
    font-size: 11px !important;
}

.transcription-font-medium {
    font-size: 13px !important;
}

.transcription-font-large {
    font-size: 15px !important;
}

.panel-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.transcription-segment {
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-left: 3px solid transparent;
}

.transcription-segment:hover {
    background: var(--bg-hover);
    border-left-color: var(--text-muted);
}

.transcription-segment .time {
    color: var(--accent-primary);
    font-family: var(--font-display);
    font-size: 11px;
    flex-shrink: 0;
    min-width: 45px;
    padding-top: 1px;
}

.transcription-segment .text {
    color: var(--text-secondary);
    flex: 1;
    line-height: 1.5;
}

.transcription-segment.active {
    background: var(--accent-dim);
    border-left-color: var(--accent-primary);
}

.transcription-segment.active .text {
    color: var(--text-primary);
}

/* Responsive adjustments for small screens */
@media (max-width: 1200px) {
    .transcription-panel {
        max-height: 30vh;
    }
    
    .transcription-panel.expanded {
        max-height: 40vh;
    }
}

@media (max-width: 768px) {
    .transcription-panel {
        max-height: 25vh;
    }
    
    .transcription-panel.expanded {
        max-height: 35vh;
    }
    
    .panel-content {
        padding: 0 12px 12px;
    }
    
    .transcription-segment {
        padding: 8px 10px;
    }
}

/* Pulse animation for scroll to current */
@keyframes pulse-highlight {
    0% { background-color: var(--accent-dim); }
    50% { background-color: var(--accent-glow); }
    100% { background-color: var(--accent-dim); }
}

/* ==========================================================================
   Notes Panel
   ========================================================================== */

.notes-panel {
    width: var(--notes-width);
    min-width: var(--notes-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}

/* Tabs */
.panel-tabs {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-tabs::-webkit-scrollbar { height: 0; display: none; }

.tab-btn {
    flex: 1 0 auto;
    min-width: 0;
    padding: 13px 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn i { flex-shrink: 0; }

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom: 2px solid var(--accent-primary);
    background: var(--accent-dim);
}

.tab-btn.has-content::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    margin-left: 6px;
}

.tab-content {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* Search Mode Selector */
.search-mode-selector {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-elevated);
}

.search-mode-selector .btn-small.active {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

.mode-toggle {
    display: flex;
    gap: 8px;
    flex: 1;
}

.mode-toggle .btn-small {
    flex: 1;
    justify-content: center;
}

/* Notes List */
.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 13px;
}

.note-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.note-card:hover {
    border-color: var(--border-accent);
}

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

.note-time {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--accent-primary);
    background: var(--accent-dim);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}

.note-time:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.note-actions {
    display: flex;
    gap: 4px;
}

.note-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 12px;
    transition: color 0.2s;
}

.note-actions button:hover {
    color: var(--text-primary);
}

.note-actions button.delete:hover {
    color: var(--bearish);
}

.note-content {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* Note Editor */
.note-editor {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

.timestamp-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
}

.timestamp-indicator .label {
    color: var(--text-muted);
}

#current-time-badge {
    font-family: var(--font-display);
    color: var(--accent-primary);
    background: var(--accent-dim);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

#note-input {
    width: 100%;
    height: 100px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    resize: none;
    transition: border-color 0.2s;
}

#note-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#note-input::placeholder {
    color: var(--text-muted);
}

#note-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Search Tab */
.search-transcription {
    display: flex;
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    gap: 8px;
}

.search-transcription input {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

.search-transcription input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-transcription button {
    padding: 10px 14px;
    background: var(--accent-primary);
    border: none;
    border-radius: 6px;
    color: var(--bg-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.search-transcription button:hover {
    background: var(--accent-secondary);
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.search-result-item {
    padding: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.search-result-item:hover {
    border-color: var(--accent-primary);
}

.search-result-item .course {
    font-size: 11px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.search-result-item .video-name {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.search-result-item .context {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.search-result-item .context .highlight {
    background: var(--accent-dim);
    color: var(--accent-primary);
    padding: 2px 4px;
    border-radius: 3px;
}

.search-result-item .timestamp {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-icon:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-icon.active:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

.btn-primary {
    flex: 1;
    padding: 10px 16px;
    background: var(--accent-primary);
    border: none;
    border-radius: 6px;
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-secondary);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-small {
    padding: 6px 12px;
    background: var(--accent-dim);
    border: 1px solid var(--border-accent);
    border-radius: 4px;
    color: var(--accent-primary);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

/* ==========================================================================
   Loader
   ========================================================================== */

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-hover);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

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

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent-primary);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.toast.error {
    border-left-color: var(--bearish);
}

.toast.warning {
    border-left-color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.hidden {
    display: none !important;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1200px) {
    .notes-panel {
        width: 320px;
        min-width: 320px;
    }
}

/* Tablet / móvil: el video es la sección prioritaria.
   El catálogo pasa a un drawer off-canvas (hamburguesa) y los
   paneles (notas / transcripción / búsqueda) comparten una sola
   zona con pestañas debajo del video. */
@media (max-width: 1024px) {
    html, body {
        overflow: auto;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 10px 14px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-subtle);
        position: sticky;
        top: 0;
        z-index: 900;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    /* Catálogo como drawer deslizable */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 86%;
        max-width: 340px;
        min-width: 0;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 28px rgba(0, 0, 0, 0.55);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1050;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }

    /* Video = prioridad visual */
    .main-content {
        width: 100%;
        order: 1;
        flex: none;
    }

    .video-section {
        padding: 12px;
    }

    .video-wrapper {
        flex: none;
        height: auto;
        aspect-ratio: 16 / 9;
        min-height: 160px;
    }

    .overlay-content i { font-size: 36px; }

    /* Paneles secundarios debajo, comparten zona con pestañas */
    .notes-panel {
        width: 100%;
        min-width: 0;
        order: 2;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border-subtle);
    }

    /* Altura definida => la transcripción hace scroll DENTRO del panel
       y el borde inferior queda claro (no se desborda la página) */
    .tab-content.active {
        height: 60vh;
        min-height: 320px;
    }

    .notes-list,
    .search-results {
        flex: 1;
        min-height: 0;
        max-height: none;
    }

    .subtitle-controls {
        flex-wrap: wrap;
    }
}

/* Móvil pequeño: compactar aún más sin sacrificar el video */
@media (max-width: 560px) {
    .video-section { padding: 8px; }
    .video-header h1 { font-size: 14px; }
    .video-actions { gap: 6px; }
    .btn-icon { width: 32px; height: 32px; }
    .tab-btn { padding: 12px 8px; font-size: 12px; }
    .tab-btn span { display: none; }
    .editor-actions { flex-direction: column; }
    .tab-content.active { height: 56vh; min-height: 280px; }
}

/* Custom Video Controls Styling */
video::cue {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 16px;
    padding: 4px 8px;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.new {
    background: var(--accent-dim);
    color: var(--accent-primary);
}

.status-badge.in-progress {
    background: rgba(255, 165, 2, 0.1);
    color: var(--warning);
}

.status-badge.completed {
    background: rgba(0, 216, 132, 0.1);
    color: var(--bullish);
}

.status-badge.reference {
    background: rgba(55, 66, 250, 0.1);
    color: var(--info);
}
