/* ================================================================
   player.css  —  Inhaler Animation Player
   public/css/player.css

   Design: medical-grade clarity. The SVG animation owns the
   screen; all chrome is light, unobtrusive, and recedes.
   Accent: #0096c7 (calm clinical blue)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

/* ── Tokens ───────────────────────────────────────────────────── */
:root {
    --accent:        #0096c7;
    --accent-hover:  #007aab;
    --accent-tint:   rgba(0, 150, 199, .10);
    --surface:       #ffffff;
    --surface-glass: rgba(255, 255, 255, .88);
    --text:          #0f172a;
    --text-muted:    #64748b;
    --border:        rgba(0, 0, 0, .08);
    --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.07);
    --shadow-md:     0 4px 10px rgba(0,0,0,.08), 0 16px 40px rgba(0,0,0,.11);
    --shadow-lg:     0 8px 24px rgba(0,0,0,.10), 0 32px 80px rgba(0,0,0,.14);
    --radius-sm:     8px;
    --radius-md:     14px;
    --radius-lg:     20px;
    --radius-pill:   999px;
    --header-h:      56px;
    --controls-h:    56px;
    --font:          'DM Sans', sans-serif;
    --font-mono:     'DM Mono', monospace;
}

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

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: #e8edf2;
    font-family: var(--font);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: var(--font);
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

/* ── Utility ──────────────────────────────────────────────────── */
.hide { display: none !important; }

/* ── SVG stage ────────────────────────────────────────────────── */
#svgdoc {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}
#svgdoc.paused * { animation-play-state: paused !important; }

/* ── Animated bar text ────────────────────────────────────────── */
#group_txt_barra_animada {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.txt_barra_animada {
    font-family: var(--font);
    font-size: 3.2px;
    font-weight: 600;
    fill: var(--text-muted);
}

/* ── Counter ──────────────────────────────────────────────────── */
#counter {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    width: 6vw;
    overflow: hidden;
    pointer-events: none;
}
#numbers {
    display: flex;
}
#numbers div {
    min-width: 6vw;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 8vw;
    font-weight: 700;
    color: var(--accent);
    opacity: .15;
    line-height: 1;
}

/* ════════════════════════════════════════════════════════════════
   TOP HEADER
   ════════════════════════════════════════════════════════════════ */
.player-header {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;

    display: flex;
    align-items: center;
    gap: 0;

    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    height: var(--header-h);
    padding: 0 6px;
    max-width: calc(100vw - 24px);
}

/* Home button */
.player-header__home {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: background .15s;
    flex-shrink: 0;
}
.player-header__home:hover { background: var(--accent-tint); }
.player-header__home img { width: 24px; height: 24px; object-fit: contain; }

/* Divider */
.player-header::after {
    content: '';
    display: block;
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

/* Title block */
.player-header__title {
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    min-width: 0;
}
.player-header__label {
    font-family: var(--font-mono);
    font-size: .58rem;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 2px;
}
.player-header__device {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}
.player-header__sep {
    margin: 0 4px;
    opacity: .4;
}
.player-header__techniques {
    font-size: .72rem;
    color: var(--text-muted);
}

/* Bibliography button */
.player-header__bib {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--text-muted);
    transition: background .15s, color .15s;
    flex-shrink: 0;
    text-decoration: none;
    margin-left: 2px;
}
.player-header__bib:hover {
    background: var(--accent-tint);
    color: var(--accent);
}
.player-header__bib .material-icons-round { font-size: 20px; }

/* ════════════════════════════════════════════════════════════════
   PLAY / REPLAY OVERLAY
   ════════════════════════════════════════════════════════════════ */
.play-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .28);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}

.play-overlay__content {
    position: relative;
    z-index: 1;
}

.play-overlay__card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    min-width: 280px;
    max-width: 360px;

    /* subtle top accent line */
    border-top: 3px solid var(--accent);
}

.play-overlay__device-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.play-overlay__hint {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.45;
}

.play-overlay__btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.play-overlay__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 22px;
    height: 44px;
    border-radius: var(--radius-pill);
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .03em;
    transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease, filter .15s;
}
.play-overlay__btn .material-icons-round { font-size: 20px; }
.play-overlay__btn:hover { transform: scale(1.05); }

.play-overlay__btn--play {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 18px rgba(0,150,199,.4);
}
.play-overlay__btn--play:hover {
    filter: brightness(.92);
    box-shadow: 0 6px 24px rgba(0,150,199,.5);
}

.play-overlay__btn--replay {
    background: var(--accent-tint);
    color: var(--accent);
}
.play-overlay__btn--replay:hover { background: rgba(0,150,199,.18); }

/* ════════════════════════════════════════════════════════════════
   LEGEND + NOTE
   ════════════════════════════════════════════════════════════════ */
.player-legend {
    position: fixed;
    bottom: calc(var(--controls-h) + 20px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    width: min(480px, 90vw);
    pointer-events: none;
}

#legenda {
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    box-shadow: var(--shadow-sm);
    font-size: .88rem;
    font-weight: 500;
    color: var(--text);
    text-align: center;
    line-height: 1.5;
    min-height: 46px;
    transition: opacity .2s;
}

.player-note {
    position: fixed;
    bottom: calc(var(--controls-h) + 76px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    width: min(480px, 90vw);
    pointer-events: none;
    font-size: .75rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    line-height: 1.4;
}

/* ════════════════════════════════════════════════════════════════
   BOTTOM CONTROLS
   ════════════════════════════════════════════════════════════════ */
.player-controls {
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;

    display: flex;
    align-items: center;
    gap: 2px;

    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    height: var(--controls-h);
    padding: 6px 8px;
}

/* Nav prev/next */
.player-controls__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text);
    transition: background .15s, transform .15s;
}
.player-controls__nav:hover {
    background: var(--accent-tint);
    color: var(--accent);
}
.player-controls__nav .material-icons-round { font-size: 26px; }
.player-controls__nav--prev .material-icons-round { font-size: 26px; }

/* Step counter pill */
.player-controls__step-pill {
    display: flex;
    align-items: baseline;
    gap: 2px;
    padding: 0 10px;
    font-family: var(--font-mono);
    font-size: .8rem;
    font-weight: 500;
    color: var(--accent);
    min-width: 48px;
    justify-content: center;
}
.player-controls__sep { color: var(--border); margin: 0 1px; }
.player-controls__total { color: var(--text-muted); }

/* Divider */
.player-controls__divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}

/* Action buttons */
.player-controls__action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-muted);
    transition: background .15s, color .15s;
    text-decoration: none;
}
.player-controls__action:hover {
    background: var(--accent-tint);
    color: var(--accent);
}
.player-controls__action .material-icons-round { font-size: 20px; }

/* ════════════════════════════════════════════════════════════════
   STEPS MENU OVERLAY  — bottom sheet
   ════════════════════════════════════════════════════════════════ */
.steps-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(15, 23, 42, .4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 84px;
}

/* JS sets display:block — show it as flex */
.steps-overlay[style*="block"] { display: flex !important; }

.steps-overlay__sheet {
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-md) var(--radius-md);
    width: min(520px, 96vw);
    max-height: 62vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Sheet header */
.steps-overlay__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    flex-shrink: 0;
}

.steps-overlay__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-muted);
    transition: background .15s;
}
.steps-overlay__close:hover { background: var(--accent-tint); color: var(--accent); }
.steps-overlay__close .material-icons-round { font-size: 18px; }

/* Scrollable list */
.steps-overlay__list {
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;

    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}
.steps-overlay__list::-webkit-scrollbar { width: 4px; }
.steps-overlay__list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

/* Step row */
.steps-overlay__row {
    display: flex;
    gap: 4px;
    align-items: stretch;
}

.steps-overlay__item {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: background .15s;
}
.steps-overlay__item:hover { background: var(--accent-tint); }
.steps-overlay__item:hover .steps-overlay__num { background: var(--accent); color: #fff; }

.steps-overlay__num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: background .15s, color .15s;
    margin-top: 1px;
}

.steps-overlay__text {
    font-size: .83rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

.steps-overlay__chain {
    flex-shrink: 0;
    width: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background .15s, color .15s;
}
.steps-overlay__chain:hover { background: var(--accent); color: #fff; }
.steps-overlay__chain .material-icons-round { font-size: 20px; }

.steps-overlay__empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: .85rem;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 520px) {
    .player-header__device { max-width: 160px; }

    .player-header__title { padding: 0 8px; }

    .player-controls {
        bottom: 10px;
        gap: 0;
        padding: 4px 6px;
    }

    .player-controls__action,
    .player-controls__nav { width: 36px; height: 36px; }

    .play-overlay__card { padding: 24px 20px; min-width: 240px; }
}

/** Font size controller */

.player-controls__action--font-size {
    font-size: 0.75rem;
    min-width: 2.5rem;
    font-weight: 600;
    pointer-events: auto;
    cursor: pointer;
}

#font_size_label {
    font-family: inherit;
    line-height: 1;
}