/* ═══════════════════════════════════════════════════════════════
   PodLearn — Design System
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ──────────────────────────────────── */
:root {
    /* Color palette — deep navy + electric accent */
    --bg-primary:    #0a0e1a;
    --bg-secondary:  #111827;
    --bg-card:       #1a2035;
    --bg-card-hover: #1f2847;
    --bg-input:      #141b2d;

    --text-primary:   #e8ecf4;
    --text-secondary: #8892a8;
    --text-muted:     #5a6478;

    --accent:         #6c5ce7;
    --accent-hover:   #7e6ff0;
    --accent-glow:    rgba(108, 92, 231, 0.25);

    --success:  #00cec9;
    --error:    #ff6b6b;
    --warning:  #feca57;
    --info:     #54a0ff;

    --border:       rgba(255, 255, 255, 0.06);
    --border-focus: rgba(108, 92, 231, 0.5);

    /* Spacing */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs:  0.75rem;
    --font-size-sm:  0.875rem;
    --font-size-md:  1rem;
    --font-size-lg:  1.25rem;
    --font-size-xl:  1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;

    /* Borders & Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Shadows */
    --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md:  0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg:  0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px var(--accent-glow);
}


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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
}

input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

::selection {
    background: var(--accent);
    color: white;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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


/* ── Flash Messages ─────────────────────────────────────────── */
.flash-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 420px;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
    transition: opacity 0.3s ease;
}

.flash--success {
    background: rgba(0, 206, 201, 0.15);
    border-color: rgba(0, 206, 201, 0.3);
    color: var(--success);
}

.flash--error {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.3);
    color: var(--error);
}

.flash--info {
    background: rgba(84, 160, 255, 0.15);
    border-color: rgba(84, 160, 255, 0.3);
    color: var(--info);
}

.flash--warning {
    background: rgba(254, 202, 87, 0.15);
    border-color: rgba(254, 202, 87, 0.3);
    color: var(--warning);
}

.flash__close {
    background: none;
    border: none;
    color: inherit;
    font-size: var(--font-size-lg);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
    line-height: 1;
}

.flash__close:hover {
    opacity: 1;
}

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


/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    line-height: 1;
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--accent-glow);
    color: white;
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn--ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.12);
}

.btn--accent {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 10px var(--accent-glow);
}

.btn--accent:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px var(--accent-glow);
}

.btn--danger {
    background: rgba(255, 107, 107, 0.12);
    color: var(--error);
    border: 1px solid rgba(255, 107, 107, 0.15);
}

.btn--danger:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.3);
}

.btn--sm {
    padding: 0.45rem 1rem;
    font-size: var(--font-size-xs);
}

.btn--full {
    width: 100%;
}


/* ── Form Elements ──────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    transition: all var(--transition-fast);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}


/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        var(--bg-primary);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: var(--space-xl);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.auth-logo {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a78bfa, var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-top: var(--space-xs);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-xl);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}


/* ── Dashboard ──────────────────────────────────────────────── */
.dashboard {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.dashboard-header__logo {
    font-size: var(--font-size-lg);
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-header__right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.dashboard-header__user {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.dashboard-main {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
}

.dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.dashboard-toolbar h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-md);
    padding: var(--space-2xl) var(--space-xl);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state__hint {
    font-size: var(--font-size-sm);
    margin-top: var(--space-sm);
}


/* ── Add Lesson Form ────────────────────────────────────────── */
.add-lesson-form {
    margin-bottom: var(--space-xl);
    animation: fadeSlideDown 0.25s ease;
}

.add-lesson-form__inner {
    display: flex;
    align-items: flex-end;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ── Lesson Card ────────────────────────────────────────────── */
.lesson-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

.lesson-card:hover {
    border-color: rgba(108, 92, 231, 0.3);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.lesson-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.lesson-card__link:hover {
    color: inherit;
}

.lesson-card__thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.lesson-card__body {
    padding: var(--space-md);
}

.lesson-card__title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lesson-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.lesson-card__duration {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.lesson-card__langs {
    color: var(--accent);
    font-weight: 500;
}

.lesson-card__actions {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.lesson-card:hover .lesson-card__actions {
    opacity: 1;
}

.lesson-card__actions .btn--danger {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: var(--font-size-xs);
    border-radius: 50%;
    backdrop-filter: blur(8px);
    background: rgba(255, 107, 107, 0.8);
    color: white;
    border: none;
}


/* ── Player Layout ──────────────────────────────────────────── */
.player-page {
    overflow: hidden;
    background: #000;
}

.player-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.player-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #000;
    max-width: 100%;
}

.player-right {
    flex: 1;
    min-width: 350px;
    max-width: 500px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

/* On very wide screens, don't cap the right pane just let it take the rest */
@media (min-width: 1600px) {
    .player-right {
        max-width: none;
    }
}

/* ── Right Pane Tabs ────────────────────────────────────────── */
.right-pane-tabs {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.pane-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.pane-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.02);
}

.pane-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.pane-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

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

/* ── Player Top Bar ─────────────────────────────────────────── */
.player-topbar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    width: 100%;
}

.player-topbar__title {
    flex: 1;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-topbar__spacer {
    flex-shrink: 0;
    width: 1px;
}


/* ── Video Container ────────────────────────────────────────── */
.player-video-wrap {
    flex-shrink: 0;
    /* Force exact 16:9 dimensions based on available screen height */
    width: calc((100vh - 60px) * 16 / 9);
    max-width: 100%; /* Don't exceed available screen width */
    aspect-ratio: 16 / 9;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin: auto;
}

.player-video {
    width: 100%;
    height: 100%;
    position: relative;
    aspect-ratio: 16 / 9;
}

.player-video iframe,
.player-video #ytPlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}


/* ── Language Selector Bar ──────────────────────────────────── */
.player-lang-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.lang-select-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.lang-select-group label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

.lang-select {
    padding: 0.35rem 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-xs);
    outline: none;
    cursor: pointer;
    min-width: 140px;
}

.lang-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-glow);
}


/* ── Notes Area ─────────────────────────────────────────────── */
.player-notes-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg-primary);
}

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.notes-header h3 {
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.notes-count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.notes-form {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.note-input-group {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
}

.note-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    resize: none;
    outline: none;
    font-family: inherit;
    margin-bottom: var(--space-sm);
}

.note-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.notes-empty {
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.note-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.note-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.note-item__time {
    flex-shrink: 0;
    color: var(--accent);
    font-size: var(--font-size-xs);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    padding-top: 2px;
}

.note-item__content {
    flex: 1;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
}

.note-item__delete {
    opacity: 0;
    transition: opacity 0.2s;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0 4px;
}

.note-item:hover .note-item__delete {
    opacity: 1;
}

.note-item__delete:hover {
    color: #ff6b6b;
}

/* ── Video Note Overlay ─────────────────────────────────────── */
.video-note-overlay {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(108, 92, 231, 0.4);
    border-radius: var(--radius-md);
    backdrop-filter: blur(12px);
    animation: noteFadeIn 0.3s ease;
    z-index: 10;
    display: none;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none; /* Let clicks pass through to video */
}

.video-note-overlay__text {
    color: white;
    font-size: var(--font-size-md);
    font-weight: 500;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

@keyframes noteFadeIn {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}


/* ── Transcript Header ──────────────────────────────────────── */
.transcript-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.transcript-header__title {
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.transcript-header__status {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}


/* ── Transcript Body ────────────────────────────────────────── */
.transcript-body {
    flex: 1;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.transcript-empty {
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.8;
}

.transcript-lines {
    padding: var(--space-sm) 0;
}


/* ── Transcript Line ────────────────────────────────────────── */
.tline {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
}

.tline:hover {
    background: rgba(255, 255, 255, 0.03);
    border-left-color: rgba(255, 255, 255, 0.1);
}

.tline__time {
    flex-shrink: 0;
    width: 40px;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    padding-top: 2px;
    font-variant-numeric: tabular-nums;
}

.tline__text {
    flex: 1;
    min-width: 0;
}

.tline__original {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.5;
}

.tline__translated {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.4;
    opacity: 0.8;
}

.tline__translated--2 {
    color: #a29bfe; /* Slightly different brand color */
}

/* ── Active line (karaoke highlight) ────────────────────────── */
.tline--active {
    background: linear-gradient(90deg,
        rgba(108, 92, 231, 0.12) 0%,
        rgba(108, 92, 231, 0.04) 100%
    );
    border-left-color: var(--accent);
}

.tline--active .tline__original {
    color: white;
    font-weight: 600;
}

.tline--active .tline__translated {
    color: var(--accent);
    opacity: 1;
    font-weight: 500;
}

.tline--active .tline__translated--2 {
    color: #c4b5fd;
}

.tline--active .tline__time {
    color: var(--accent);
}


/* ── Utilities ──────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Video Subtitle Overlay ─────────────────────────────────── */
.video-sub-overlay {
    position: absolute;
    width: 90%;
    text-align: center;
    pointer-events: none; /* Default to none, we'll toggle in JS */
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Position Classes */
.vso--pos-top { top: 40px; left: 50%; transform: translateX(-50%); }
.vso--pos-bottom { bottom: 40px; left: 50%; transform: translateX(-50%); }
.vso--pos-top-left { top: 40px; left: 40px; align-items: flex-start; text-align: left; }
.vso--pos-top-right { top: 40px; right: 40px; align-items: flex-end; text-align: right; }
.vso--pos-bottom-left { bottom: 40px; left: 40px; align-items: flex-start; text-align: left; }
.vso--pos-bottom-right { bottom: 40px; right: 40px; align-items: flex-end; text-align: right; }

/* SMART LIFT: Lift the subtitles when user hovers the player area (e.g. to see timeline) */
/* This now works because we don't have inline !important transforms anymore */
.player-video-wrap:hover .video-sub-overlay.vso--pos-bottom,
.player-video-wrap:hover .video-sub-overlay.vso--pos-bottom-left,
.player-video-wrap:hover .video-sub-overlay.vso--pos-bottom-right {
    transform: translateY(-45px);
}

/* If centered, we must keep the -50% X translation */
.player-video-wrap:hover .video-sub-overlay.vso--pos-bottom {
    transform: translate(-50%, -45px);
}

.video-sub-overlay.is-interactive {
    pointer-events: auto !important;
}


.vso-line {
    background: rgba(0, 0, 0, 0.75);
    color: inherit;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    display: inline-block;
    max-width: 100%;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    transition: all 0.2s ease;
    cursor: text;
}
.is-interactive .vso-line:hover {
    outline: 2px solid var(--accent);
}
.vso-line--1 {
    font-size: 0.85em; /* relative to parent subOverlay.fontSize */
    font-weight: 500;
    opacity: 0.9;
}
.vso-line--2 {
    font-size: 0.8em;
    font-weight: 500;
    opacity: 0.8;
}

/* ── Modal Tabs ──────────────────────────────────────────────── */
.modal-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.modal-tab {
    padding: 10px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.modal-tab:hover { color: var(--text-primary); }
.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ── Custom Toggle Switch ───────────────────────────────────── */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .switch-slider {
  background-color: var(--accent);
}
input:checked + .switch-slider:before {
  transform: translateX(22px);
}

/* ── Video Note Overlay ─────────────────────────────────────── */
.video-note-overlay {
    position: absolute;
    z-index: 20;
    max-width: 320px;
    padding: 12px 18px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    display: none;
    transition: all 0.3s ease;
    line-height: 1.4;
    cursor: default;
    pointer-events: none;
    font-weight: 500;
}
/* ── Note Edit Card Styles ── */
.note-edit-card {
    transition: transform 0.3s ease;
}

/* No hover opacity per user request */
.note-edit-card:hover {
    opacity: 1; 
}

/* Make other modals semi-transparent when editing if they overlap */
#noteEditModal {
    backdrop-filter: none !important;
}

/* ── Dictionary Tooltip ─────────────────────────────────────── */
.word-lookup {
    cursor: pointer;
    transition: all var(--transition-fast) !important;
    border-bottom: 1px dashed rgba(255,255,255,0.2) !important;
    display: inline-block !important;
    margin: 0 1px !important;
}

.word-lookup:hover {
    color: var(--accent) !important;
    border-bottom-color: var(--accent) !important;
    background: rgba(108, 92, 231, 0.1) !important;
}

.dict-tooltip {
    position: absolute;
    z-index: 2050;
    width: 280px;
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: var(--space-md) !important;
    display: none;
    pointer-events: auto;
    animation: fadeInTooltip 0.2s ease;
}

.dict-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    cursor: move; /* Indication it's draggable */
}

.btn--close-dict {
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn--close-dict:hover {
    background: rgba(255, 107, 107, 0.2);
    color: var(--error);
}


.dict-word {
    font-size: var(--font-size-md);
    font-weight: 700;
    color: var(--accent);
    text-transform: capitalize;
}

.dict-phonetic {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-family: inherit;
}

.dict-meaning {
    margin-bottom: var(--space-sm);
}

.dict-pos {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--accent);
    background: rgba(108, 92, 231, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
    display: inline-block;
}

.dict-defs {
    margin-top: 4px;
    padding-left: 15px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    list-style-type: disc;
}

.dict-defs li {
    margin-bottom: 4px;
}

.dict-actions {
    margin-top: var(--space-md);
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--border);
    padding-top: var(--space-md);
}

.dict-loading, .dict-error {
    font-size: var(--font-size-sm);
    text-align: center;
    padding: var(--space-md);
    color: var(--text-muted);
}

@keyframes fadeInTooltip {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Mobile Optimization (Max 900px) ─────────────────────────── */
@media (max-width: 900px) {
    .player-layout {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }

    .player-left {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: #000;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .player-video-wrap {
        width: 100vw;
        height: auto;
        aspect-ratio: 16 / 9;
        max-height: 40vh; /* Don't take too much height */
    }

    .player-right {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        height: 60vh; /* Fixed height for tools area */
        flex: none;
    }

    .right-pane-tabs {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-card);
    }

    /* Subtitle scaling for Mobile */
    .video-sub-overlay {
        font-size: 14px !important; /* Force smaller base on mobile */
        width: 95% !important;
    }

    .vso-line {
        padding: 4px 10px !important;
        line-height: 1.3 !important;
        border-radius: 6px !important;
    }

    /* Adjust specific sub line sizes relative to mobile base */
    .vso-line--0 { font-size: 1.1em !important; }
    .vso-line--1 { font-size: 0.9em !important; }
    .vso-line--2 { font-size: 0.85em !important; }

    /* Modal adjustments */
    .modal-content {
        width: 95% !important;
        padding: 15px !important;
    }
    
    .modal-pane {
        max-height: 60vh;
        overflow-y: auto;
    }

    .player-topbar {
        padding: 5px 10px;
    }

    .player-topbar__title {
        display: none; /* Hide title to save space for buttons */
    }
}
