/**
 * EA Waveform Player – Front-end styles
 * Version: 1.18.0
 */

/* ── Container ── */
.eawp-player {
    --eawp-bg:          transparent;
    --eawp-bg-track:    transparent;
    --eawp-text:        #e0e0e0;
    --eawp-text-muted:  #888;
    --eawp-accent:      #ffffff;
    --eawp-wave:        #555555;
    --eawp-wave-prog:   #ffffff;
    --eawp-radius:      8px;
    --eawp-gap:         16px;

    display: flex;
    flex-direction: column;
    gap: var(--eawp-gap);
    background: var(--eawp-bg);
    padding: 20px;
    border-radius: var(--eawp-radius);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ── Single track card ── */
.eawp-track {
    background: var(--eawp-bg-track);
    border-radius: var(--eawp-radius);
    padding: 16px 20px;
    transition: background 0.2s ease;
}

.eawp-track.eawp-active {
    background: transparent;
}

/* ── Header: play button + title ── */
.eawp-track-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.eawp-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--eawp-accent);
    cursor: pointer;
    padding: 0;
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    transition: background 0.15s ease;
}

.eawp-play-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.eawp-play-btn:focus {
    outline: none !important;
    box-shadow: none !important;
    background: transparent;
}

.eawp-play-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.eawp-play-btn:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
    background: transparent;
}

.eawp-play-btn:active {
    background: rgba(0, 0, 0, 0.8);
}

.eawp-track.eawp-playing .eawp-play-btn {
    background: rgba(0, 0, 0, 0.6);
}

.eawp-track.eawp-playing .eawp-play-btn:focus:not(:focus-visible) {
    background: rgba(0, 0, 0, 0.6);
}

/* Icon toggle */
.eawp-icon-pause { display: none; }
.eawp-track.eawp-playing .eawp-icon-play  { display: none; }
.eawp-track.eawp-playing .eawp-icon-pause { display: inline; }

.eawp-track-title {
    color: var(--eawp-text);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Waveform ── */
.eawp-waveform {
    width: 100%;
    min-height: 64px;
    cursor: pointer;
    overflow: hidden;
    clip-path: inset(0 3px 0 0);
}

.eawp-waveform > div {
    border: none !important;
    outline: none !important;
}

/* Hide WaveSurfer cursor line and any progress edge artifacts */
.eawp-waveform ::part(cursor) {
    width: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    display: none !important;
}

.eawp-waveform ::part(progress) {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.eawp-waveform ::part(wrapper) {
    border: none !important;
    outline: none !important;
}

.eawp-waveform ::part(canvases) {
    border: none !important;
    outline: none !important;
}

/* ── Time row ── */
.eawp-time-row {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: var(--eawp-text-muted);
    font-variant-numeric: tabular-nums;
    user-select: none;
}

/* ── Loading state ── */
.eawp-track.eawp-loading .eawp-waveform {
    opacity: 0.4;
}

/* ── Show more toggle ── */
.eawp-track.eawp-hidden {
    display: none;
}

.eawp-show-more-wrap {
    text-align: left;
    padding-top: 4px;
}

.eawp-show-more-btn {
    display: inline-block;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.eawp-show-more-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.eawp-show-more-btn:focus {
    outline: none;
    background: transparent;
}

.eawp-show-more-btn:focus-visible {
    background: rgba(0, 0, 0, 0.6);
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

.eawp-show-more-btn:focus:not(:focus-visible) {
    outline: none;
    background: transparent;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .eawp-player {
        padding: 12px;
        gap: 12px;
    }
    .eawp-track {
        padding: 12px 14px;
    }
    .eawp-track-title {
        font-size: 13px;
    }
    .eawp-waveform {
        min-height: 48px;
    }
}
