/* ==============================================
   PREMIUM PLAYER STYLES
   - High-fidelity Glassmorphic Design
   - Organized by Component Layers
   ============================================== */

/* 1. MAIN OVERLAY CONTAINER */
.podcast-player-overlay {
    position: absolute;
    top: var(--top-bar-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--top-bar-height));
    z-index: 800;
    /* Below top-bar (900) */
    background: #050508;
    /* Darker solid background for better contrast */
    backdrop-filter: blur(60px);
    -webkit-backdrop-filter: blur(60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
    border: 1px solid var(--glass-border);
    border-top: none;
}

.player-scroll-content {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    position: relative;
    z-index: 1;
    scrollbar-width: none;
    /* Firefox */
}

.player-scroll-content::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* --- HERO SECTION --- */
.player-hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 70vh;
    background: #000;
    position: relative;
    overflow: hidden;
    /* Optional: subtle border/radius */
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 5;
    transition: opacity 0.3s ease;
}

.player-media-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 24px;
    width: 100%;
    height: 100%;
}


.player-bg-artwork {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.2;
    filter: blur(80px);
    background-size: cover;
    background-position: center;
    transition: background-image 1s ease;
}

/* 2. PLAYER HEADER (Removed from template, keeping for fallback) */
.player-header {
    display: none;
}

/* 2a. INFO SECTION (YouTube Style) */
.player-info-section {
    padding: 32px 5vw;
    width: 100%;
    text-align: left;
}

.player-room-title {
    color: #fff;
    font-weight: 800;
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    line-height: 1.2;
}

.player-room-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* SLEEK ACTION ROW */
.player-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 24px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.player-actions-row::-webkit-scrollbar {
    display: none;
}

.player-action-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border: none;
    height: 36px;
    padding: 0 16px;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    white-space: nowrap;
}

.player-action-pill:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.player-action-pill.active {
    background: #fff;
    color: #000;
}

/* DESCRIPTION BOX */
.player-description-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 32px;
    transition: background 0.3s;
}

.player-description-box:hover {
    background: rgba(255, 255, 255, 0.08);
    /* slight highlight like YouTube */
}

.player-room-description {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    font-size: 0.95rem;
}

.player-characters-list {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.character-sub-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 24px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s, transform 0.2s;
    text-align: center;
    gap: 16px;
}

.character-sub-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-4px);
}

.character-sub-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.character-sub-name {
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
    letter-spacing: -0.2px;
}

.btn-subscribe {
    background: #fff;
    color: #0f0f13;
    border: none;
    padding: 8px 24px;
    border-radius: 40px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, color 0.2s;
    width: 100%;
}

.btn-subscribe:hover {
    background: #e6e6e6;
    transform: scale(1.03);
}

.btn-subscribe.subscribed {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-subscribe.subscribed:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-subscribe:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(243, 194, 106, 0.3);
}

/* 3. CENTERED HERO & ARTWORK */
.player-hero {
    width: 100%;
    display: flex;
    justify-content: center;
}

.artwork-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1/1;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.artwork-container.shrunk {
    transform: scale(0.6) translateY(-140px);
    opacity: 0.5;
    filter: blur(4px);
    pointer-events: none;
}

.album-art {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #333, #111);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    align-content: center;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    gap: 16px;
}

.art-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    flex-shrink: 0;
    gap: 10px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.art-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background-color: rgba(20, 20, 30, 0.95);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(255, 255, 255, 0.06);
    border: 3px solid rgba(255, 255, 255, 0.08);
    max-width: 100%;
    max-height: 100%;
    animation: artAvatarBreathing 4s ease-in-out infinite;
    transition: border-color 0.4s ease, box-shadow 0.6s ease, transform 0.5s ease;
}

.art-avatar:hover .avatar-img {
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.04);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(243, 194, 106, 0.1);
}

/* Character Name Label */
.art-avatar-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.art-avatar:hover .art-avatar-name {
    color: rgba(255, 255, 255, 0.9);
}

/* Subtle Breathing Animation for Player Avatars */
@keyframes artAvatarBreathing {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.012);
    }
}

/* ━━━ ACTIVE SPEAKER HIGHLIGHT ━━━ */

/* Speaking Avatar — Golden Glow Ring + Scale Up */
.art-avatar.speaking .avatar-img {
    border-color: rgba(243, 194, 106, 0.7);
    box-shadow:
        0 0 0 4px rgba(243, 194, 106, 0.25),
        0 0 30px rgba(243, 194, 106, 0.2),
        0 0 60px rgba(243, 194, 106, 0.08),
        0 20px 50px rgba(0, 0, 0, 0.5);
    animation: speakingGlow 2s ease-in-out infinite, speakingScale 0.6s ease-out forwards;
}

.art-avatar.speaking .art-avatar-name {
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 0 12px rgba(243, 194, 106, 0.3), 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Non-speaking Avatars — Subtle Dim */
.art-avatar:not(.speaking) {
    opacity: 1;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Only dim when at least one avatar is speaking */
.album-art:has(.art-avatar.speaking) .art-avatar:not(.speaking) {
    opacity: 0.5;
    transform: scale(0.95);
}

.album-art:has(.art-avatar.speaking) .art-avatar:not(.speaking) .avatar-img {
    border-color: rgba(255, 255, 255, 0.04);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: none;
}

.album-art:has(.art-avatar.speaking) .art-avatar:not(.speaking) .art-avatar-name {
    color: rgba(255, 255, 255, 0.3);
}

/* Pulsating Golden Glow */
@keyframes speakingGlow {

    0%,
    100% {
        box-shadow:
            0 0 0 4px rgba(243, 194, 106, 0.25),
            0 0 30px rgba(243, 194, 106, 0.2),
            0 0 60px rgba(243, 194, 106, 0.08),
            0 20px 50px rgba(0, 0, 0, 0.5);
    }

    50% {
        box-shadow:
            0 0 0 6px rgba(243, 194, 106, 0.35),
            0 0 40px rgba(243, 194, 106, 0.25),
            0 0 80px rgba(243, 194, 106, 0.12),
            0 20px 50px rgba(0, 0, 0, 0.5);
    }
}

/* Bounce-In Scale for Speaker Activation */
@keyframes speakingScale {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1.04);
    }
}

/* 4. TRANSCRIPT / LYRICS LAYER */
.lyrics-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 40px 20px;
    animation: fadeIn 0.3s;
}

.lyrics-scroll-area {
    flex: 1;
    overflow-y: auto;
    text-align: left;
    padding: 60px 20px 100px;
    font-family: 'Inter', sans-serif;
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

.lyrics-scroll-area::-webkit-scrollbar {
    display: none;
}

.lyrics-line {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
}

.lyrics-line:hover {
    background: rgba(255, 255, 255, 0.08);
}

.lyrics-line.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(243, 194, 106, 0.15) 0%, rgba(243, 194, 106, 0.05) 100%);
    border-left: 3px solid var(--gold);
}

.lyrics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.lyrics-meta {
    font-size: 0.75rem;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    opacity: 0.9;
}

.lyrics-meta .avatar-img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.lyrics-timestamp {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
}

.lyrics-text {
    font-size: 1rem;
    line-height: 1.5;
}

/* 5. BOTTOM CONTROLS AREA (Floating Overlay) */
.player-controls-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 5vw 24px;
    z-index: 100;
    width: 100%;
    /* Gradient fade at the bottom of the hero video space */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    border: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.player-hero-section.idle .player-controls-area {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}



/* Custom Slider Styles */
.player-slider {
    width: 100%;
    margin: 10px 0;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    outline: none;
}

.player-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.player-slider:hover::-webkit-slider-thumb {
    opacity: 1;
    transform: scale(1.4);
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
    margin-bottom: 20px;
}

.control-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctrl-btn:hover {
    opacity: 0.8;
}

.ctrl-btn:active {
    transform: scale(0.95);
}

.ctrl-btn.sm {
    font-size: 1.2rem;
    color: var(--text-secondary);
    width: 40px;
}

.ctrl-btn.md {
    font-size: 1.8rem;
    height: 50px;
    width: 50px;
}

.ctrl-btn.lg.play-btn {
    font-size: 2rem;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fff;
    color: #000;
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.3);
}

.ctrl-btn.lg.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 255, 255, 0.4);
}

/* Speed Dropdown Menu */
.speed-control-wrapper {
    position: relative;
    display: inline-block;
}

.speed-menu {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 8px;
    min-width: 140px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.speed-menu.active {
    opacity: 1;
    pointer-events: all;
    transform: translateX(-50%) translateY(0);
}

.speed-option {
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.speed-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.speed-option.active {
    color: var(--gold);
    background: rgba(243, 194, 106, 0.1);
}

/* Removed legacy .player-interactions block */

/* 6. RECOMMENDATIONS SECTION */
.replay-recommendations {
    width: 100%;
    margin-top: 30px;
    padding: 0 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.replay-recommendations:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
}

.rec-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    padding-bottom: 20px;
}

.rec-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.rec-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.rec-avatar-wrapper {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rec-avatar-wrapper .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rec-info {
    flex: 1;
    overflow: hidden;
}

.rec-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.rec-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 7. COMMENTS SECTION (YouTube Style) */
.player-comments-section {
    margin: 32px 5vw 100px;
    background: rgba(15, 15, 25, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
}

.player-comments-section .panel-header {
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.player-comments-section .comment-input-wrap {
    padding: 20px 32px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.player-comments-section .comments-list {
    flex: 1;
    overflow-y: visible;
    /* Let the main container handle scroll */
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.comment-card {
    display: flex;
    gap: 16px;
    animation: slideUpFade 0.4s ease forwards;
}

.user-avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-avatar-md {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 4px;
}

.comment-author {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

.comment-field-group {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.comment-field-group input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px 0;
    font-size: 1rem;
    outline: none;
}

.comment-field-group input:focus {
    border-bottom-color: var(--ai-accent);
}

.btn-primary-sm {
    background: var(--ai-accent);
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.comment-btns {
    display: flex;
    justify-content: flex-end;
}

.comment-field-group .btn-primary-sm,
.comment-btns .btn-primary-sm {
    width: auto !important;
}

/* 8. COMMON ANIMATIONS */
@keyframes bounce {

    0%,
    100% {
        transform: scaleY(1);
        opacity: 0.7;
    }

    50% {
        transform: scaleY(1.5);
        opacity: 1;
        filter: brightness(1.2);
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* TRANSCRIPT PANEL FALLBACK (Sidebar style) */
.transcript-panel {
    position: absolute;
    top: 80px;
    right: 0;
    width: 320px;
    bottom: 180px;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(32px);
    border-left: 1px solid var(--glass-border);
    z-index: 100;
    display: none;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.transcript-panel.active {
    display: flex;
    transform: translateX(0);
}

.transcript-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--gold);
}

.transcript-list {
    flex: 1;
    overflow-y: auto;
    padding: 80px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Visualizer Bars Anim Speed & Delay */
.icon-btn.active {
    background: var(--gold) !important;
    color: #000 !important;
    box-shadow: 0 0 15px rgba(243, 194, 106, 0.6);
}