/**
 * Audio Player Styles
 * Dark grey theme with orange accents, animated waveform
 */

/* === Player Container === */
.amplitude-player {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #333333;
    border-radius: 12px;
    padding: 20px 24px;
    color: #e0e0e0;
    max-width: 820px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    margin: 0 auto;
}

/* === Waveform === */
.amplitude-waveform-wrap {
    position: relative;
    width: 100%;
    height: 80px;
    background: #2a2a2a;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

#ap-waveform {
    display: block;
    width: 100%;
    height: 80px;
}

/* === Song Info (Title + Playlist, no cover) === */
.amplitude-song-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    min-height: 260px;
}

/* Cover image and its note-symbol placeholder are no longer shown —
   the title and playlist are the focus of the player window now. */
.amplitude-song-info .cover-art {
    display: none !important;
}

.amplitude-song-info .song-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.amplitude-song-info .song-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 4px;
    line-height: 1.25;
    /* Let long titles wrap inside the player window instead of
       clipping at one line — the title is the visual centerpiece now. */
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.amplitude-song-info .song-artist {
    font-size: 0.95rem;
    color: #a0a0c0;
    margin: 0 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Genre Playlist (capped height, scrolls internally) === */
.amplitude-song-info .com-music-playlist {
    margin-top: 0;
    min-width: 0;
    max-width: none;
    /* Fixed height on desktop: ~10 visible songs (~300px) with a scrollbar
       for the rest. The flex children (filter, heading) are non-shrinking,
       and the <ol> inside scrolls within the max-height box. */
    flex: 0 0 auto;
    max-height: 300px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #2a2a2a;
    border-radius: 6px;
    padding: 8px 10px;
    box-shadow: inset 0 0 0 1px #3a3a3a;
}

.amplitude-song-info .com-music-playlist-filter {
    flex-shrink: 0;
    width: 100%;
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #d0d0e0;
    font: inherit;
    font-size: 0.78rem;
    padding: 5px 8px;
    margin: 0 0 8px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.12s, background 0.12s;
}

.amplitude-song-info .com-music-playlist-filter::placeholder {
    color: #606078;
}

.amplitude-song-info .com-music-playlist-filter:focus {
    border-color: #f14833;
    background: #252525;
}

.amplitude-song-info .com-music-playlist-list {
    overflow-y: auto;
    flex: 1 1 auto;
    margin: 0 -4px 0 0;
    padding: 0 4px 0 0;
}

.amplitude-song-info .com-music-playlist-empty {
    color: #5a5a78;
    font-size: 0.78rem;
    font-style: italic;
    padding: 4px 6px;
}

.amplitude-song-info .com-music-playlist-item.is-hidden {
    display: none;
}

.amplitude-song-info .com-music-playlist-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8080a0;
    margin: 0 0 6px;
    font-weight: 600;
}

.amplitude-song-info .com-music-playlist-count {
    color: #5a5a78;
    font-weight: 400;
    margin-left: 2px;
}

.amplitude-song-info .com-music-playlist-list {
    list-style: none;
    counter-reset: pls;
}

.amplitude-song-info .com-music-playlist-item {
    counter-increment: pls;
    margin: 0;
    padding: 0;
}

.amplitude-song-info .com-music-playlist-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 4px;
    color: #c0c0d0;
    text-decoration: none;
    font-size: 0.825rem;
    line-height: 1.3;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amplitude-song-info .com-music-playlist-link::before {
    content: counter(pls);
    flex-shrink: 0;
    width: 18px;
    text-align: right;
    color: #5a5a78;
    font-variant-numeric: tabular-nums;
    font-size: 0.72rem;
}

.amplitude-song-info .com-music-playlist-link:hover {
    background: #383838;
    color: #ffffff;
}

.amplitude-song-info .com-music-playlist-link.is-current {
    background: #4a2a22;
    color: #ff9a86;
    font-weight: 600;
    cursor: default;
}

.amplitude-song-info .com-music-playlist-link.is-current::before {
    color: #f14833;
}

.amplitude-song-info .com-music-playlist-glyph {
    display: none;
}

.amplitude-song-info .com-music-playlist-item.is-current .com-music-playlist-glyph {
    display: inline;
    color: #f14833;
    font-size: 0.72rem;
    flex-shrink: 0;
    width: 18px;
    text-align: right;
}

.amplitude-song-info .com-music-playlist-item.is-current {
    counter-reset: none;
}

.amplitude-song-info .com-music-playlist-item.is-current .com-music-playlist-link::before {
    content: '';
}

/* === Main Controls === */
.amplitude-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.amplitude-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #a0a0c0;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.amplitude-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.amplitude-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.amplitude-btn-play {
    width: 44px;
    height: 44px;
    background: #f14833;
    border-radius: 50%;
    color: #ffffff !important;
    padding: 0;
}

.amplitude-btn-play:hover {
    background: #ff6b55;
    transform: scale(1.05);
}

.amplitude-btn-play svg {
    width: 18px;
    height: 18px;
}

.amplitude-btn-skip {
    width: 32px;
    height: 32px;
}

.amplitude-btn-skip svg {
    width: 16px;
    height: 16px;
}

/* === Progress Bar === */
.amplitude-progress-wrapper {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    cursor: pointer;
    margin-bottom: 8px;
}

.amplitude-progress-wrapper:hover {
    height: 6px;
}

.amplitude-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 2px;
    pointer-events: none;
    transition: width 0.1s linear;
}

.amplitude-progress-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.amplitude-progress-wrapper:hover .amplitude-progress-thumb {
    opacity: 1;
}

/* === Time Display === */
.amplitude-time {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #7070a0;
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}

/* === Volume === */
.amplitude-volume-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.amplitude-volume-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #a0a0c0;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.amplitude-volume-btn:hover {
    color: #ffffff;
}

.amplitude-volume-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

.amplitude-volume-slider {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.amplitude-volume-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #f14833;
    border-radius: 2px;
    pointer-events: none;
}

/* === Metadata under Player === */
.player-info {
    max-width: 600px;
    margin: 16px auto 0;
    padding: 12px 16px;
    background: #2a2a2a;
    border-radius: 8px;
    color: #c0c0c0;
    font-size: 0.85rem;
}

.player-info-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 16px;
}

.player-info dt {
    color: #888;
    white-space: nowrap;
    font-weight: 400;
}

.player-info dd {
    margin: 0;
    color: #e0e0e0;
}

/* === Playlist === */
.amplitude-playlist {
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.amplitude-playlist::-webkit-scrollbar {
    width: 4px;
}

.amplitude-playlist::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.amplitude-playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}

.amplitude-playlist-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.amplitude-playlist-item.active {
    background: rgba(241, 72, 51, 0.15);
}

.amplitude-playlist-item.active .amplitude-playlist-item-title {
    color: #ff9a8b;
}

.amplitude-playlist-play-btn {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #a0a0c0;
}

.amplitude-playlist-item.active .amplitude-playlist-play-btn {
    background: #f14833;
    color: #ffffff;
}

.amplitude-playlist-play-btn svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
}

.amplitude-playlist-meta {
    min-width: 0;
    flex: 1;
}

.amplitude-playlist-item-title {
    font-size: 0.875rem;
    color: #d0d0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amplitude-playlist-item-artist {
    font-size: 0.75rem;
    color: #7070a0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amplitude-playlist-item-duration {
    font-size: 0.75rem;
    color: #606080;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* === Rating Stars (preserved) === */
.amplitude-rating {
    display: inline-flex;
    gap: 2px;
    margin-top: 4px;
}

.mod-music-star {
    color: #fbbf24;
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

/* === Responsive === */
@media (max-width: 480px) {
    .amplitude-player {
        padding: 16px;
        border-radius: 0;
    }
    /* Mobile: cap the playlist at ~10 visible songs with a scrollbar
       for the rest, instead of letting it stretch across the whole
       player window. The list itself still scrolls inside the box
       because .com-music-playlist-list already has overflow-y: auto.

       Breakdown of the height: filter (~32px) + heading (~22px) +
       10 items × 28px + paddings = roughly 360px. */
    .amplitude-song-info .com-music-playlist {
        flex: 0 0 auto;
        max-height: 360px;
    }
}
