/* ═══════════════════════════════════════════
   Audio Subtitle Sync v3.2 — Frontend CSS
   Layout & structure only. Colors applied by JS via style API.
   ═══════════════════════════════════════════ */

.ass-wrap {
    border-radius: 14px;
    box-shadow: 0 4px 28px rgba(0,0,0,.10);
    overflow: hidden;
    margin: 28px 0;
    border: 1px solid #e2e8f0;
    border-left: 1px solid #e2e8f0 !important; /* override theme blockquote/div border */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.ass-embed { margin: 20px 0; border-left: 1px solid #e2e8f0 !important; }

/* ── Embed header ── */
.ass-embed-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; font-size: 13px;
}
.ass-embed-icon  { font-size: 15px; }
.ass-embed-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ass-embed-link  {
    font-size: 12px; text-decoration: none; white-space: nowrap;
    border-width: 1px; border-style: solid; border-radius: 4px;
    padding: 3px 10px; flex-shrink: 0; transition: opacity .2s;
}
.ass-embed-link:hover { opacity: .75; }

/* ── Player bar ── */
.ass-player-bar {
    padding: 13px 18px;
    display: flex; align-items: center; gap: 12px;
    user-select: none;
}

/* Play button */
.ass-btn-play {
    flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 2px 10px rgba(233,69,96,.45); padding: 0;
}
.ass-btn-play:hover { transform: scale(1.07); box-shadow: 0 4px 18px rgba(233,69,96,.6); }

/* Time display */
.ass-time-wrap { display: flex; align-items: center; gap: 3px; font-size: 12px; font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* Progress bar */
.ass-prog-wrap  { flex: 1; cursor: pointer; padding: 10px 0; position: relative; }
.ass-prog-track {
    height: 3px; background: rgba(255,255,255,.15);
    border-radius: 3px; position: relative; transition: height .2s;
}
.ass-prog-wrap:hover .ass-prog-track { height: 5px; }
.ass-prog-fill  { height: 100%; width: 0%; border-radius: 3px; pointer-events: none; transition: width .1s linear; }
.ass-prog-thumb {
    position: absolute; top: 50%; right: 0;
    width: 13px; height: 13px; border-radius: 50%;
    transform: translate(50%,-50%) scale(0);
    transition: transform .2s;
    pointer-events: none;
}
.ass-prog-wrap:hover .ass-prog-thumb { transform: translate(50%,-50%) scale(1); }

/* Speed */
.ass-speed-wrap { position: relative; flex-shrink: 0; }
.ass-btn-speed  {
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px; padding: 4px 9px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: background .2s, color .2s;
}
.ass-btn-speed:hover { background: rgba(255,255,255,.16); color: #fff !important; }

.ass-speed-menu {
    display: none; position: absolute; bottom: calc(100% + 8px); right: 0;
    background: #1e293b; border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px; overflow: hidden; min-width: 76px;
    box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 200;
}
.ass-speed-menu.open { display: block; }
.ass-speed-menu button {
    display: block; width: 100%; background: none; border: none;
    color: #94a3b8; padding: 7px 14px; text-align: center;
    font-size: 13px; cursor: pointer; transition: background .2s;
}
.ass-speed-menu button:hover { background: rgba(255,255,255,.08); color: #fff !important; }

/* Volume */
.ass-vol-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ass-btn-mute {
    background: none; border: none; cursor: pointer;
    padding: 3px; display: flex; align-items: center; transition: opacity .2s;
}
.ass-btn-mute:hover { opacity: .75; }
.ass-btn-mute svg { width: 17px; height: 17px; }
.ass-btn-mute.muted .ass-vol-lines { display: none; }

.ass-vol-slider {
    -webkit-appearance: none; appearance: none;
    width: 68px; height: 3px; background: rgba(255,255,255,.2);
    border-radius: 3px; outline: none; cursor: pointer;
}
.ass-vol-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; cursor: pointer; }
.ass-vol-slider::-moz-range-thumb     { width: 12px; height: 12px; border: none; border-radius: 50%; cursor: pointer; }

/* ── Loading / Error ── */
.ass-state-loading {
    border-top: 1px solid #e2e8f0;
    padding: 28px; display: flex; align-items: center; justify-content: center; gap: 10px;
    color: #94a3b8; font-size: 14px;
}
.ass-spinner {
    width: 20px; height: 20px; flex-shrink: 0;
    border: 3px solid rgba(0,0,0,.08);
    border-radius: 50%; animation: ass-spin .7s linear infinite;
}
@keyframes ass-spin { to { transform: rotate(360deg); } }

.ass-state-error {
    background: #fff5f5; border-top: 1px solid #fed7d7;
    padding: 14px 20px; color: #c53030; font-size: 14px;
}

/* ── Content area ── */
.ass-content-area { border-top: 1px solid #e2e8f0; }
.ass-subtitle-lines { padding: 20px 24px 20px; }

/* ── Subtitle lines — structure only; colours set by JS ── */
.ass-line {
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 6px;
    margin: 2px 0;
    border-left: none;
    transition: background .25s ease, transform .15s ease;
}
.ass-line:hover  { background: rgba(0,0,0,.04) !important; }

/* Subtitle lines not yet seekable (audio not ready) */
.ass-wrap:not(.ass-ready) .ass-line { cursor: pointer; }
.ass-wrap.ass-ready .ass-line       { cursor: pointer; }
.ass-line.ass-active { /* highlight applied via JS */ }

/* Allow HTML formatting inside lines */
.ass-line b, .ass-line strong { font-weight: 700; }
.ass-line i, .ass-line em     { font-style: italic; }
.ass-line u                   { text-decoration: underline; }
.ass-line .vocab { background: rgba(233,69,96,.12); padding: 1px 5px; border-radius: 3px; font-weight: 600; }
.ass-line .note  { font-size: .88em; font-style: italic; opacity: .7; }

/* Article body (single post, below subtitles) */
.ass-article-body {
    padding: 24px 24px 28px;
    border-top: 1px dashed #e2e8f0;
}
.ass-article-body p:first-child { margin-top: 0; }
.ass-article-body p:last-child  { margin-bottom: 0; }

/* ── Collapse mode (opt-in via collapse="true") ── */
.ass-collapsed .ass-content-area {
    max-height: 200px; overflow: hidden; position: relative;
    transition: max-height .35s ease;
}
.ass-collapsed .ass-content-area.ass-expanded {
    max-height: 2000px; overflow-y: auto;
}
.ass-collapsed .ass-content-area:not(.ass-expanded)::after {
    content: ''; display: block;
    position: absolute; bottom: 0; left: 0; right: 0; height: 56px;
    background: linear-gradient(transparent, #fff); /* JS overwrites with actual bg */
    pointer-events: none;
}
.ass-embed-toggle {
    padding: 6px 24px 14px; text-align: center;
    border-top: 1px solid #e2e8f0;
}
.ass-btn-expand {
    background: none; border: none;
    font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 10px;
    transition: opacity .2s;
}
.ass-btn-expand:hover { opacity: .75; }

/* ── Responsive ── */
@media (max-width: 560px) {
    .ass-vol-wrap        { display: none; }
    .ass-time-wrap       { font-size: 11px; }
    .ass-player-bar      { gap: 8px; padding: 12px 14px; }
    .ass-subtitle-lines  { padding: 14px 14px 14px; }
    .ass-article-body    { padding: 16px 14px 20px; }
}
