/* ==========================================================================
   CINEMATIC AUDIO PLAYER — Premium Dark Design System
   ========================================================================== */

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

/* ── Page Shell ─────────────────────────────────────────────────────────── */
.listen-page {
    font-family: 'Inter', var(--font-ui, sans-serif);
    background: #080604;
    color: #fff;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Ambient glow behind waveform */
.listen-page::before {
    content: '';
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 70vw;
    height: 70vh;
    background: radial-gradient(ellipse, rgba(200,150,62,0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Dot-grid texture */
.listen-page::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.016) 1px, transparent 1px);
    background-size: 36px 36px;
    pointer-events: none;
    z-index: 0;
}
.listen-page > * { position: relative; z-index: 1; }

/* ── Sticky Top Bar ─────────────────────────────────────────────────────── */
.listen-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.6);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    transition: all 0.25s ease;
}
.back-link:hover {
    color: var(--accent, #c8963e);
    border-color: rgba(200,150,62,0.4);
    background: rgba(200,150,62,0.08);
    transform: translateX(-3px);
}

/* ── Book Info Strip (topbar right) ─────────────────────────────────────── */
.listen-book-strip {
    display: flex;
    align-items: center;
    gap: 14px;
}
.listen-book-strip img {
    width: 40px;
    height: 57px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
    flex-shrink: 0;
}
.listen-book-strip-info h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 2px;
}
.listen-book-strip-info p {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
    margin: 0;
}
.genre-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(200,150,62,0.14);
    color: var(--accent, #c8963e);
    border: 1px solid rgba(200,150,62,0.3);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ── Theater Layout ─────────────────────────────────────────────────────── */
.listen-theater-wrap {
    display: grid;
    grid-template-columns: 1fr 340px;
    min-height: calc(100vh - 68px);
    align-items: start;
}

/* ── Left: Player Panel ─────────────────────────────────────────────────── */
.listen-player-panel {
    padding: 36px 36px 40px 40px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Now Playing label */
.now-listening-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent, #c8963e);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent, #c8963e);
    animation: pulseDot 1.5s ease-in-out infinite;
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(200,150,62,0.5); }
    50%       { opacity: 0.5; transform: scale(0.7); box-shadow: 0 0 0 6px rgba(200,150,62,0); }
}

.current-track-name {
    font-size: 1.7rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin: 4px 0 0;
    letter-spacing: -0.3px;
}

/* Waveform box */
.audio-player-box {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 28px 28px 22px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 30px 70px rgba(0,0,0,0.5);
}

#waveform {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 22px;
}

/* Controls row */
.audio-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}

.ctrl-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.88rem;
    cursor: pointer;
    color: rgba(255,255,255,0.75);
    transition: all 0.2s;
    font-family: inherit;
    letter-spacing: 0.3px;
}
.ctrl-btn:hover {
    border-color: rgba(200,150,62,0.5);
    color: var(--accent, #c8963e);
    background: rgba(200,150,62,0.08);
}

.play-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c8963e 0%, #a87030 100%);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 6px 24px rgba(200,150,62,0.4), 0 0 0 0 rgba(200,150,62,0);
    flex-shrink: 0;
}
.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(200,150,62,0.55), 0 0 0 8px rgba(200,150,62,0.08);
}
.play-btn:active { transform: scale(0.96); }

.speed-select {
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    font-family: inherit;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s;
}
.speed-select:hover { border-color: rgba(200,150,62,0.4); }
.speed-select option { background: #1a0f05; color: #fff; }

/* Progress bar */
.audio-time {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    font-variant-numeric: tabular-nums;
}
#progress-track {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c8963e, #e8b55a);
    border-radius: 2px;
    transition: width 0.3s linear;
    width: 0%;
}

/* ── Right: Playlist Panel ──────────────────────────────────────────────── */
.listen-playlist-panel {
    border-left: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.015);
    min-height: calc(100vh - 68px);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.playlist-header {
    padding: 22px 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.playlist-header h3 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.45);
    margin: 0;
}
.playlist-count {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.28);
    background: rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 2px 10px;
}

.playlist-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    scrollbar-width: thin;
    scrollbar-color: rgba(200,150,62,0.3) transparent;
}
.playlist-scroll::-webkit-scrollbar { width: 4px; }
.playlist-scroll::-webkit-scrollbar-track { background: transparent; }
.playlist-scroll::-webkit-scrollbar-thumb { background: rgba(200,150,62,0.3); border-radius: 4px; }

/* ── Playlist Item ──────────────────────────────────────────────────────── */
.playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.22s ease;
    position: relative;
    overflow: hidden;
    background: transparent;
    list-style: none;
}
.playlist-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(200,150,62,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.22s ease;
}
.playlist-item:hover {
    border-color: rgba(200,150,62,0.3);
    transform: translateX(3px);
}
.playlist-item:hover::before { opacity: 1; }
.playlist-item.active {
    border-color: rgba(200,150,62,0.5);
    background: rgba(200,150,62,0.08);
}
.playlist-item.active::before { opacity: 1; }

.playlist-num {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: var(--accent, #c8963e);
    font-size: 0.73rem;
    font-weight: 700;
    transition: all 0.22s;
}
.playlist-item.active .playlist-num {
    background: var(--accent, #c8963e);
    color: #1a0f05;
}

.playlist-info { flex: 1; min-width: 0; }
.playlist-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}
.playlist-item.active .playlist-title { color: #fff; }
.playlist-item:hover .playlist-title { color: #fff; }

/* Animated bars when playing */
.bar-indicator {
    display: none;
    gap: 2px;
    align-items: flex-end;
    height: 16px;
    flex-shrink: 0;
}
.playlist-item.active .bar-indicator { display: flex; }
.bar-indicator span {
    display: block;
    width: 3px;
    background: var(--accent, #c8963e);
    border-radius: 2px;
    animation: barBounce 0.9s ease-in-out infinite alternate;
}
.bar-indicator span:nth-child(1) { height: 6px;  animation-delay: 0s; }
.bar-indicator span:nth-child(2) { height: 13px; animation-delay: 0.18s; }
.bar-indicator span:nth-child(3) { height: 8px;  animation-delay: 0.35s; }
@keyframes barBounce {
    from { transform: scaleY(0.3); }
    to   { transform: scaleY(1); }
}

.download-link {
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.4);
    font-size: 0.78rem;
    text-decoration: none;
    transition: all 0.2s;
}
.download-link:hover {
    background: rgba(200,150,62,0.15);
    color: var(--accent, #c8963e);
}

/* Empty state */
.audio-empty-state {
    text-align: center;
    padding: 60px 30px;
}
.audio-empty-state h3 { color: rgba(255,255,255,0.8); font-size: 1.3rem; margin-bottom: 10px; }
.audio-empty-state p  { color: rgba(255,255,255,0.4); font-size: 0.95rem; max-width: 360px; margin: 0 auto 24px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .listen-theater-wrap {
        grid-template-columns: 1fr;
    }
    .listen-playlist-panel {
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.07);
        min-height: auto;
    }
    .playlist-scroll { max-height: 320px; }
    .listen-topbar   { padding: 14px 18px; }
    .listen-player-panel { padding: 24px 18px; }
}
@media (max-width: 640px) {
    .listen-book-strip { display: none; }
    .current-track-name { font-size: 1.3rem; }
}
