/* css/instructor.css — playerul cu instructor 3D, comun paginilor Tai Chi, Baduanjin și Qigong */

#instructor-section .container { max-width: 900px; }

.instructor-intro {
    padding: 0.85rem 1rem;
    border: 1px solid var(--card-border);
    border-left: 4px solid #0891b2;
    border-radius: 0.6rem;
    background: var(--section-alt-bg);
    font-size: 0.92rem;
    line-height: 1.55;
    margin-bottom: 1.5rem;
}

/* ─── Player ───────────────────────────────────────────────────────────── */
.instructor-player {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 2rem;
}
.instructor-stage-wrap { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.instructor-stage {
    position: relative;
    min-height: 420px;
    min-width: 0;
    flex-grow: 1;
    border-radius: 0.9rem;
    background: radial-gradient(ellipse at 50% 85%, rgba(56, 189, 248, 0.16) 0%, rgba(15, 23, 42, 0) 65%),
                linear-gradient(180deg, #0f172a 0%, #131c2e 100%);
    /* pan-y, nu none: tragerea pe orizontală rotește personajul, dar tragerea pe verticală
       rămâne a paginii — altfel scena ocupă tot ecranul telefonului și nu mai poți derula */
    touch-action: pan-y;
    overflow: hidden;
}
/* Pânza e scoasă din flux. Un element absolut nu contribuie la lățimea intrinsecă a
   părinților, deci lățimea în pixeli pe care three.js o măsoară nu mai poate deveni un prag
   sub care coloana refuză să scadă. Fără asta, o dată lărgită (rotire în peisaj, prima
   randare), pagina rămânea lată și apărea derulare orizontală. */
.instructor-stage canvas {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Explicația fazei curente — se schimbă în timpul mișcării */
.instructor-phase {
    margin: 0;
    min-height: 2.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(8, 145, 178, 0.4);
    background: rgba(8, 145, 178, 0.12);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    color: #0e7490;
}
.instructor-phase.is-new { animation: instructor-phase-in 0.4s ease; }
@keyframes instructor-phase-in {
    from { opacity: 0; transform: translateY(0.35rem); }
    to   { opacity: 1; transform: none; }
}

.instructor-views { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.instructor-view {
    flex: 1 1 auto;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.instructor-view.is-active {
    border-color: #0891b2;
    background: rgba(8, 145, 178, 0.16);
    box-shadow: inset 0 -2px 0 #0891b2;
    font-weight: 700;
}

.instructor-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.9rem;
    font-size: 0.76rem;
    color: var(--secondary-text-color);
}
.instructor-legend i { font-size: 0.6rem; vertical-align: middle; }

.instructor-info {
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--card-border);
    border-radius: 0.9rem;
    background: var(--section-alt-bg);
    display: flex;
    flex-direction: column;
}
.instructor-step {
    margin: 0 0 0.3rem;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--secondary-text-color);
}
.instructor-name {
    margin: 0 0 0.15rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: clamp(1.15rem, 3.2vw, 1.5rem);
    line-height: 1.25;
}
.instructor-pinyin {
    margin: 0 0 0.7rem;
    font-size: 0.85rem;
    font-style: italic;
    color: #0891b2;
}
.instructor-desc { margin: 0 0 0.7rem; font-size: 0.92rem; line-height: 1.55; }
.instructor-breath {
    margin: 0 0 0.9rem;
    padding: 0.45rem 0.7rem;
    border-radius: 0.5rem;
    background: rgba(8, 145, 178, 0.12);
    color: #0e7490;
    font-size: 0.84rem;
    font-weight: 600;
}

.instructor-progress {
    height: 0.35rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    overflow: hidden;
    margin-bottom: 0.9rem;
}
.instructor-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #0891b2, #38bdf8);
    border-radius: 999px;
}

.instructor-controls {
    display: flex;
    flex-wrap: wrap;          /* rândul se rupe în loc să iasă din panou pe ecran îngust */
    gap: 0.45rem;
    justify-content: center;
    margin-bottom: 0.9rem;
}
.instructor-btn {
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.instructor-btn-main {
    min-width: min(8rem, 100%);   /* 8rem cât încape, dar niciodată mai lat decât panoul */
    font-weight: 700;
    background: linear-gradient(135deg, #0891b2, #0e7490);
    border-color: transparent;
    color: #fff;
}
.instructor-btn-main.is-paused { background: linear-gradient(135deg, #64748b, #475569); }

.instructor-speed {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    margin-top: auto;
}
/* min-width: 0 — fără el, un element flex refuză să scadă sub lățimea lui min-content */
.instructor-speed .form-range { flex-grow: 1; min-width: 0; }
.instructor-speed span { min-width: 2.6rem; text-align: right; font-weight: 700; }

.instructor-toggles { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.instructor-toggle {
    flex: 1 1 0;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.instructor-toggle.is-active {
    border-color: #0891b2;
    background: rgba(8, 145, 178, 0.16);
    box-shadow: inset 0 -2px 0 #0891b2;
    font-weight: 700;
}

/* Răspuns la atingere. :active se stinge singur la ridicarea degetului, deci nu rămâne lipit
   cum rămânea :hover — de aceea e în afara blocului @media (hover: hover). */
.instructor-btn:active,
.instructor-view:active,
.instructor-toggle:active,
.instructor-item:active { border-color: #0891b2; }

/* ─── Lista mișcărilor ─────────────────────────────────────────────────── */
.instructor-section-title {
    font-size: 1.2rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    margin-bottom: 0.8rem;
}
.instructor-list {
    display: grid;
    /* min(16rem, 100%): pe ecran lat coloanele rămân de 16rem ca înainte, dar pe un telefon
       îngust pista se poate strânge la lățimea disponibilă în loc să iasă din pagină */
    grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.instructor-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--card-border);
    border-radius: 0.6rem;
    background: transparent;
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.12s ease;
}
/* Fundalul selecției are un contrast de ~1.14:1 față de pagină, adică aproape invizibil.
   Dunga din stânga se vede sigur și, fiind box-shadow, nu mișcă nimic în layout. */
.instructor-item.is-active {
    border-color: #0891b2;
    background: rgba(8, 145, 178, 0.12);
    box-shadow: inset 3px 0 0 #0891b2;
    font-weight: 600;
}
.instructor-item-num {
    flex-shrink: 0;
    width: 1.75rem; height: 1.75rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(8, 145, 178, 0.18);
    color: #0e7490;
    font-size: 0.8rem;
    font-weight: 700;
}
.instructor-item.is-active .instructor-item-num { background: #0891b2; color: #fff; }
.instructor-item-body { display: flex; flex-direction: column; min-width: 0; }
.instructor-item-name { font-size: 0.9rem; line-height: 1.25; }
.instructor-item-pinyin { font-size: 0.74rem; color: var(--secondary-text-color); font-style: italic; }

/* ─── Sfaturi ──────────────────────────────────────────────────────────── */
.instructor-tips {
    padding: 1rem 1.15rem;
    border: 1px solid var(--card-border);
    border-radius: 0.8rem;
    background: var(--section-alt-bg);
}
.instructor-tips h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.6rem; }
.instructor-tips h3 i { color: #eab308; }
.instructor-tips ul { margin: 0 0 0.8rem; padding-left: 1.2rem; }
.instructor-tips li { font-size: 0.9rem; line-height: 1.65; }
.instructor-note {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--secondary-text-color);
    border-top: 1px solid var(--card-border);
    padding-top: 0.7rem;
}

@media (max-width: 767.98px) {
    /* minmax(0, 1fr), NU 1fr: „1fr" înseamnă minmax(auto, 1fr), iar minimul „auto" e lățimea
       min-content a conținutului — adică pista nu poate coborî sub cel mai lat lucru dinăuntru.
       Coloana de pe desktop are deja minmax(0, …); aici lipsea, și tocmai de asta apărea
       derularea orizontală pe telefon. */
    .instructor-player { grid-template-columns: minmax(0, 1fr); }
    .instructor-stage { min-height: 340px; }
    .instructor-info { min-width: 0; }

    /* sliderul de viteză coboară pe rândul lui în loc să fie strivit */
    .instructor-speed { flex-wrap: wrap; }
    .instructor-speed .form-range { flex: 1 1 8rem; }

    /* ținte de atins mai mari pe ecran tactil */
    .instructor-btn, .instructor-view, .instructor-toggle {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    #instructor-prev, #instructor-next { min-width: 44px; }
}

/* :hover rămâne lipit după atingere pe telefon și imită starea activă. Doar `hover: hover`,
   fără `pointer: fine`: laptopurile cu ecran tactil raportează pointer grosier, dar au mouse
   și trebuie să păstreze efectul. */
@media (hover: hover) {
    .instructor-btn:hover { border-color: #0891b2; }
    .instructor-view:hover { border-color: #0891b2; }
    .instructor-toggle:hover { border-color: #0891b2; }
    .instructor-item:hover { transform: translateY(-2px); border-color: #0891b2; }
}
