/* LochStudios custom HTML5 audio player.
 *
 * Used wherever we render a recording - admin CRM call detail page,
 * CMS Media Library AV edit page, and any future surface that emits the
 * .ls-audio markup. Pair with /assets/js/audio-player.js which auto-binds
 * every .ls-audio[data-ls-audio] on the page.
 */
/* Dark theme is the default (matches the project's convention: light is
 * opt-in via <html data-theme="light">, no attribute = dark). */
.ls-audio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line, #1B2530);
    border-radius: 6px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px;
    color: var(--paper, #FFFFFF);
}

/* Light theme override - boost the surface so it doesn't look
 * see-through against a white page. */
[data-theme="light"] .ls-audio {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #334155;
}

.ls-audio .ic { vertical-align: middle; }

.ls-audio-toggle,
.ls-audio-mute,
.ls-audio-rate,
.ls-audio-dl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(93, 211, 255, 0.10);
    border: 1px solid rgba(93, 211, 255, 0.45);
    color: #cdeefd;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    padding: 0;
    text-decoration: none;
}
[data-theme="light"] .ls-audio-toggle,
[data-theme="light"] .ls-audio-mute,
[data-theme="light"] .ls-audio-rate,
[data-theme="light"] .ls-audio-dl {
    color: #0f8dc2;
}
.ls-audio-toggle:hover,
.ls-audio-mute:hover,
.ls-audio-rate:hover,
.ls-audio-dl:hover {
    background: rgba(93, 211, 255, 0.20);
}
.ls-audio-rate { width: auto; padding: 0 10px; }

.ls-audio-toggle .ic-pause,
.ls-audio-mute .ic-mute { display: none; }
.ls-audio.is-playing .ls-audio-toggle .ic-play { display: none; }
.ls-audio.is-playing .ls-audio-toggle .ic-pause { display: inline; }
.ls-audio.is-muted .ls-audio-mute .ic-vol { display: none; }
.ls-audio.is-muted .ls-audio-mute .ic-mute { display: inline; }

.ls-audio-time {
    min-width: 42px;
    text-align: center;
    color: inherit;
    font-variant-numeric: tabular-nums;
}

.ls-audio-track {
    flex: 1;
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
}
[data-theme="light"] .ls-audio .ls-audio-track {
    background: rgba(0, 0, 0, 0.08);
}
.ls-audio-track:focus { outline: 1px solid #1AA4DF; outline-offset: 2px; }

.ls-audio-buffered,
.ls-audio-progress {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 3px;
}
.ls-audio-buffered { background: rgba(255, 255, 255, 0.10); width: 0; }
[data-theme="light"] .ls-audio .ls-audio-buffered {
    background: rgba(0, 0, 0, 0.10);
}
.ls-audio-progress { background: linear-gradient(90deg, #5DD3FF, #19A7E0); width: 0; }

.ls-audio-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    transform: translateY(-50%);
    background: #5DD3FF;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(93, 211, 255, 0.25);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
}
.ls-audio:hover .ls-audio-thumb,
.ls-audio.is-playing .ls-audio-thumb { opacity: 1; }

.ls-audio.is-error .ls-audio-track { background: rgba(255, 89, 89, 0.15); }
.ls-audio.is-error .ls-audio-progress { background: rgba(255, 89, 89, 0.45); }
.ls-audio.is-error .ls-audio-toggle { opacity: .5; cursor: not-allowed; }

.ls-audio-vol-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ls-audio-vol-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 45px;
    height: 4px;
    background: linear-gradient(90deg, #5DD3FF var(--vp, 100%), rgba(255, 255, 255, 0.2) var(--vp, 100%));
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
[data-theme="light"] .ls-audio-vol-slider {
    background: linear-gradient(90deg, #19A7E0 var(--vp, 100%), rgba(0, 0, 0, 0.15) var(--vp, 100%));
}
.ls-audio-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cdeefd;
    border: 1px solid rgba(93, 211, 255, 0.45);
}
[data-theme="light"] .ls-audio-vol-slider::-webkit-slider-thumb {
    background: #0f8dc2;
    border: none;
}
