/* ═══════════════════════════════════════════════════════════════
   LLOS.ai — Conversation Player V2 (page-specific)
   Nav/body/loading styles are in v2-shared.css
   ═══════════════════════════════════════════════════════════════ */

/* ───── Design Tokens ───── */
:root {
    --pv2-blue:        #3b82f6;
    --pv2-blue-light:  #eff6ff;
    --pv2-blue-border: #bfdbfe;
    --pv2-blue-deep:   #2563eb;

    --pv2-green-bg:    #f0fdf4;
    --pv2-green-border:#bbf7d0;

    --pv2-grammar:     #059669;
    --pv2-cultural:    #e11d48;
    --pv2-vocab:       #d97706;

    --pv2-surface:     #ffffff;
    --pv2-bg:          #f1f5f9;
    --pv2-bg-warm:     #f8fafc;
    --pv2-border:      #e2e8f0;
    --pv2-border-light:#f1f5f9;

    --pv2-text:        #0f172a;
    --pv2-text-mid:    #475569;
    --pv2-text-muted:  #94a3b8;
    --pv2-text-light:  #cbd5e1;

    --pv2-dark:        #0f172a;
    --pv2-nav-h:       52px;
    --pv2-ctrl-h:      60px;
    --pv2-notes-w:     380px;
    --pv2-radius:      12px;
    --pv2-radius-lg:   16px;
    --pv2-radius-xl:   20px;
}

/* ── Body override: lock viewport for player ── */
.pv2-body {
    overflow: hidden;
    height: 100vh;
}

/* ── Player nav-inner override: wider max-width ── */
.pv2-nav-inner {
    max-width: 1600px;
}


/* ═══════════════════════════════════════════════════════════════
   SETTINGS DROPDOWN
   ═══════════════════════════════════════════════════════════════ */

.pv2-settings {
    position: fixed;
    top: var(--pv2-nav-h);
    right: 80px;
    background: var(--pv2-surface);
    border: 1px solid var(--pv2-border);
    border-radius: var(--pv2-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    padding: 8px 4px;
    z-index: 45;
    min-width: 220px;
    animation: pv2-dropdown 0.15s ease;
}
.pv2-settings.hidden { display: none; }

@keyframes pv2-dropdown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pv2-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px; font-weight: 500;
    color: var(--pv2-text-mid);
}
.pv2-setting-row:hover { background: var(--pv2-bg); }

/* Toggle switch */
.pv2-toggle {
    position: relative;
    width: 36px; height: 20px;
    background: var(--pv2-text-light);
    border-radius: 10px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.pv2-toggle.on { background: var(--pv2-blue); }
.pv2-toggle::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.pv2-toggle.on::after { transform: translateX(16px); }


/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT — Two-Pane
   ═══════════════════════════════════════════════════════════════ */

.pv2-main {
    height: calc(100vh - var(--pv2-nav-h));
    overflow: hidden;
}
.pv2-main.hidden { display: none; }

.pv2-layout {
    height: 100%;
    display: grid;
    grid-template-columns: 1fr var(--pv2-notes-w);
}


/* ═══════════════════════════════════════════════════════════════
   LEFT: CONVERSATION PANE
   ═══════════════════════════════════════════════════════════════ */

.pv2-conv-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--pv2-bg-warm);
}

/* ─── Chat Area ─── */
.pv2-chat {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

/* ─── Scenario Intro Card ─── */
.pv2-scenario-intro {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--pv2-surface);
    border: 1px solid var(--pv2-border);
    border-radius: var(--pv2-radius);
    margin-bottom: 20px;
    animation: pv2-bubbleIn 0.3s ease both;
}
.pv2-intro-avatars {
    display: flex;
    gap: 0;
}
.pv2-intro-av {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800;
    color: white; overflow: hidden;
    border: 2px solid var(--pv2-surface);
}
.pv2-intro-av:last-child {
    margin-left: -10px;
}
.pv2-intro-av img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
}
.pv2-intro-info {
    flex: 1; min-width: 0;
}
.pv2-intro-title {
    font-size: 13px; font-weight: 700;
    color: var(--pv2-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv2-intro-meta {
    font-size: 11px;
    color: var(--pv2-text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv2-intro-badge {
    font-size: 10px; font-weight: 700;
    padding: 3px 10px; border-radius: 6px;
    background: var(--pv2-blue-light);
    color: var(--pv2-blue);
    white-space: nowrap; flex-shrink: 0;
}

/* ─── Chat Bubbles ─── */
.pv2-bubble {
    margin-bottom: 18px;
    max-width: 82%;
    cursor: pointer;
    transition: transform 0.15s;
    animation: pv2-bubbleIn 0.3s ease both;
}
.pv2-bubble:hover { transform: translateY(-1px); }

@keyframes pv2-bubbleIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pv2-bubble.left  { margin-right: auto; }
.pv2-bubble.right { margin-left: auto; }

/* Bubble header */
.pv2-bubble-hdr {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px;
}
.pv2-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800;
    flex-shrink: 0; color: white; overflow: hidden;
}
.pv2-avatar img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
}
.pv2-speaker-name {
    font-size: 12px; font-weight: 700;
    color: var(--pv2-text);
}
.pv2-speaker-role {
    font-size: 11px; font-weight: 500;
    color: var(--pv2-text-muted);
    margin-left: 2px;
}
.pv2-phrase-counter {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: var(--pv2-text-light);
    background: var(--pv2-bg);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.3px;
    transition: all 0.25s;
}
.pv2-bubble.active .pv2-phrase-counter {
    background: var(--pv2-blue-light);
    color: var(--pv2-blue);
}

/* Bubble content card */
.pv2-bubble-body {
    padding: 14px 18px;
    border-radius: var(--pv2-radius-lg);
    position: relative;
    transition: box-shadow 0.25s, border-color 0.25s;
}

.pv2-bubble.left .pv2-bubble-body {
    background: var(--pv2-blue-light);
    border: 1px solid var(--pv2-blue-border);
    border-bottom-left-radius: 4px;
}
.pv2-bubble.right .pv2-bubble-body {
    background: var(--pv2-green-bg);
    border: 1px solid var(--pv2-green-border);
    border-bottom-right-radius: 4px;
}

.pv2-bubble.active .pv2-bubble-body {
    box-shadow: 0 0 0 2px var(--pv2-blue), 0 4px 16px rgba(59,130,246,0.12);
}
.pv2-bubble.speaking .pv2-bubble-body {
    box-shadow: 0 0 0 2px var(--pv2-blue), 0 0 20px rgba(59,130,246,0.2);
}

.pv2-primary {
    font-size: 15px; font-weight: 500;
    line-height: 1.6; color: var(--pv2-text);
}

.pv2-hindi-box {
    display: inline-block;
    background: var(--pv2-blue);
    color: white;
    padding: 6px 14px; border-radius: 10px;
    font-size: 15px; font-weight: 500;
    line-height: 1.6; margin-top: 6px;
}

.pv2-secondary {
    font-size: 13px; color: var(--pv2-text-mid);
    margin-top: 5px; line-height: 1.5;
}

.pv2-romanized {
    font-size: 12px; color: var(--pv2-text-muted);
    font-style: italic;
    margin-top: 3px; line-height: 1.4;
}

.pv2-bubble-actions {
    display: flex; gap: 6px; margin-top: 10px;
}
.pv2-bubble-btn {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    border: 1px solid var(--pv2-border);
    background: white;
    color: var(--pv2-text-muted);
    transition: all 0.2s;
}
.pv2-bubble-btn:hover {
    border-color: var(--pv2-blue);
    color: var(--pv2-blue);
    background: var(--pv2-blue-light);
}


/* ═══════════════════════════════════════════════════════════════
   BOTTOM CONTROLS
   ═══════════════════════════════════════════════════════════════ */

.pv2-controls {
    height: var(--pv2-ctrl-h);
    background: var(--pv2-surface);
    border-top: 1px solid var(--pv2-border);
    display: flex; align-items: center;
    padding: 0 16px; gap: 10px;
    flex-shrink: 0;
}

.pv2-ctrl-btn {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    border: 1px solid var(--pv2-border);
    background: white;
    color: var(--pv2-text-mid);
    transition: all 0.2s; flex-shrink: 0;
}
.pv2-ctrl-btn:hover {
    border-color: var(--pv2-blue);
    color: var(--pv2-blue);
}

.pv2-play-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    background: var(--pv2-dark);
    color: white;
    transition: all 0.2s; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.pv2-play-btn:hover { background: #334155; transform: scale(1.05); }
.pv2-play-btn:active { transform: scale(0.96); }
.pv2-play-btn.playing { background: var(--pv2-blue); }

.pv2-progress { flex: 1; min-width: 60px; }
.pv2-progress-track {
    height: 4px; background: var(--pv2-border);
    border-radius: 2px; overflow: hidden;
}
.pv2-progress-fill {
    height: 100%; background: var(--pv2-blue);
    border-radius: 2px; transition: width 0.3s ease; width: 0%;
}

.pv2-progress-label {
    font-size: 12px; font-weight: 600;
    color: var(--pv2-text-muted);
    white-space: nowrap; flex-shrink: 0;
}

.pv2-hint {
    font-size: 11px; color: var(--pv2-text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex-shrink: 1; min-width: 0;
}


/* ═══════════════════════════════════════════════════════════════
   RIGHT: NOTES PANE
   ═══════════════════════════════════════════════════════════════ */

.pv2-notes-pane {
    overflow-y: auto;
    background: var(--pv2-surface);
    border-left: 1px solid var(--pv2-border);
}

.pv2-notes-mobile-hdr { display: none; }

.pv2-note-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--pv2-border-light);
}
.pv2-note-section:last-child { border-bottom: none; }

.pv2-note-hdr {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; font-weight: 800;
    letter-spacing: 1.5px; text-transform: uppercase;
    margin-bottom: 14px;
}
.pv2-note-hdr i { font-size: 13px; }

.pv2-clr-grammar  { color: var(--pv2-grammar); }
.pv2-clr-cultural { color: var(--pv2-cultural); }
.pv2-clr-vocab    { color: var(--pv2-vocab); }

.pv2-note-body {
    font-size: 13px; line-height: 1.75;
    color: var(--pv2-text-mid);
    animation: pv2-noteIn 0.25s ease;
}

@keyframes pv2-noteIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pv2-note-body p { margin-bottom: 8px; }
.pv2-note-body p:last-child { margin-bottom: 0; }

.pv2-note-empty {
    color: var(--pv2-text-light);
    font-style: italic; font-size: 12px;
}

.pv2-grammar-term {
    display: inline;
    background: #ecfdf5;
    color: var(--pv2-grammar);
    padding: 1px 6px; border-radius: 4px;
    font-weight: 600; font-size: 12px;
}

.pv2-vocab-item {
    display: flex; align-items: baseline; gap: 8px;
    padding: 8px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px; line-height: 1.5;
}
.pv2-vocab-item:last-child { margin-bottom: 0; }

.pv2-vocab-word { font-weight: 700; color: var(--pv2-vocab); white-space: nowrap; }
.pv2-vocab-meaning { color: var(--pv2-text-mid); }

.pv2-cultural-box {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px; line-height: 1.6;
    color: #9f1239;
}


/* ═══════════════════════════════════════════════════════════════
   ANALYSIS TAB
   ═══════════════════════════════════════════════════════════════ */

.pv2-analysis {
    height: calc(100vh - var(--pv2-nav-h));
    overflow-y: auto;
    background: var(--pv2-bg);
    padding: 32px;
}
.pv2-analysis.hidden { display: none; }

.pv2-analysis-inner { max-width: 800px; margin: 0 auto; }
.pv2-analysis-header { margin-bottom: 24px; }
.pv2-analysis-header h2 {
    font-size: 20px; font-weight: 800;
    color: var(--pv2-text); margin-bottom: 4px;
}
.pv2-analysis-header p { font-size: 13px; color: var(--pv2-text-muted); }

.pv2-vocab-table { display: grid; gap: 8px; }
.pv2-vocab-table-row {
    display: grid;
    grid-template-columns: 120px 120px 1fr;
    gap: 12px;
    padding: 14px 18px;
    background: white;
    border: 1px solid var(--pv2-border);
    border-radius: var(--pv2-radius);
    align-items: center;
    transition: border-color 0.2s;
}
.pv2-vocab-table-row:hover { border-color: var(--pv2-blue); }
.pv2-vocab-table-row .vt-word   { font-size: 16px; font-weight: 600; color: var(--pv2-text); }
.pv2-vocab-table-row .vt-roman  { font-size: 13px; color: var(--pv2-text-muted); font-style: italic; }
.pv2-vocab-table-row .vt-meaning { font-size: 13px; color: var(--pv2-text-mid); line-height: 1.5; }
.pv2-vocab-table-row .vt-usage  { font-size: 11px; color: var(--pv2-text-muted); margin-top: 2px; }


/* ═══════════════════════════════════════════════════════════════
   MOBILE NOTES FAB + BACKDROP
   ═══════════════════════════════════════════════════════════════ */

.pv2-notes-fab {
    display: none;
    position: fixed;
    bottom: 80px; right: 16px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--pv2-blue);
    color: white; font-size: 20px;
    align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(59,130,246,0.35);
    z-index: 35;
    transition: transform 0.2s;
}
.pv2-notes-fab:hover { transform: scale(1.08); }
.pv2-notes-fab.hidden { display: none !important; }

.pv2-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 38;
    transition: opacity 0.3s;
}
.pv2-backdrop.hidden { display: none; }


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (< 1024px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1023px) {
    .pv2-layout { grid-template-columns: 1fr; }

    .pv2-notes-pane {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        max-height: 65vh;
        border-left: none;
        border-radius: var(--pv2-radius-xl) var(--pv2-radius-xl) 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
        z-index: 39;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .pv2-notes-pane.open { transform: translateY(0); }

    .pv2-notes-mobile-hdr {
        display: block;
        position: sticky; top: 0;
        background: white; z-index: 2;
        border-radius: var(--pv2-radius-xl) var(--pv2-radius-xl) 0 0;
    }

    .pv2-sheet-handle {
        width: 36px; height: 4px;
        background: var(--pv2-text-light);
        border-radius: 2px;
        margin: 10px auto 0;
    }
    .pv2-sheet-bar {
        display: flex; align-items: center;
        justify-content: space-between;
        padding: 10px 20px 8px;
    }
    .pv2-sheet-title { font-size: 15px; font-weight: 700; color: var(--pv2-text); }
    .pv2-sheet-close {
        width: 30px; height: 30px;
        border-radius: 8px;
        display: flex; align-items: center; justify-content: center;
        color: var(--pv2-text-muted); transition: all 0.2s;
    }
    .pv2-sheet-close:hover { background: var(--pv2-bg); color: var(--pv2-text); }

    .pv2-notes-fab { display: flex; }

    .pv2-hint { display: none; }
}


/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (< 640px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 639px) {
    .pv2-chat { padding: 14px 12px; }
    .pv2-bubble { max-width: 90%; margin-bottom: 14px; }
    .pv2-bubble-body { padding: 12px 14px; }
    .pv2-primary { font-size: 14px; }
    .pv2-hindi-box { font-size: 14px; padding: 5px 12px; }
    .pv2-secondary { font-size: 12px; }
    .pv2-romanized { font-size: 11px; }
    .pv2-avatar { width: 26px; height: 26px; font-size: 10px; }
    .pv2-speaker-name { font-size: 11px; }
    .pv2-speaker-role { font-size: 10px; }
    .pv2-phrase-counter { font-size: 9px; padding: 2px 6px; }
    .pv2-bubble-btn { width: 26px; height: 26px; font-size: 10px; }

    .pv2-scenario-intro { padding: 10px 12px; gap: 10px; margin-bottom: 14px; }
    .pv2-intro-av { width: 28px; height: 28px; }
    .pv2-intro-av:last-child { margin-left: -8px; }
    .pv2-intro-title { font-size: 12px; }
    .pv2-intro-meta { font-size: 10px; }
    .pv2-intro-badge { font-size: 9px; padding: 2px 8px; }

    .pv2-controls { padding: 0 10px; gap: 6px; height: 54px; }
    .pv2-ctrl-btn { width: 32px; height: 32px; font-size: 12px; }
    .pv2-play-btn { width: 38px; height: 38px; font-size: 14px; }
    .pv2-progress-label { font-size: 11px; }

    .pv2-notes-fab { width: 46px; height: 46px; font-size: 18px; bottom: 70px; right: 12px; }

    .pv2-note-section { padding: 16px 16px; }
    .pv2-note-hdr { font-size: 10px; margin-bottom: 10px; }

    .pv2-analysis { padding: 20px 12px; }
    .pv2-vocab-table-row {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 12px 14px;
    }
}


/* ═══════════════════════════════════════════════════════════════
   WIDE DESKTOP (≥ 1440px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 1440px) {
    --pv2-notes-w: 420px;
    .pv2-chat { padding: 28px 40px; }
    .pv2-bubble { max-width: 70%; }
    .pv2-note-section { padding: 24px 28px; }
}


/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */

.pv2-chat::-webkit-scrollbar,
.pv2-notes-pane::-webkit-scrollbar { width: 6px; }
.pv2-chat::-webkit-scrollbar-thumb,
.pv2-notes-pane::-webkit-scrollbar-thumb { background: var(--pv2-text-light); border-radius: 3px; }
.pv2-chat::-webkit-scrollbar-track,
.pv2-notes-pane::-webkit-scrollbar-track { background: transparent; }
