/* ==============================================
   PLAYER STYLES
   - Podcast Player Overlay (Apple Music Style)
   - Waveform, Controls, Transcript
   - Replay Recommendations
   ============================================== */

/* Replay Controls Base */
.replay-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.4));
    padding: 0;
    overflow: hidden;
}

.podcast-player-view {
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.waveform-container {
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.replay-timer {
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0 4px;
}

.replay-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.main-playback-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.play-pause-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--gold);
    color: #000;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 12px 24px var(--gold-glow);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-pause-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 16px 40px var(--gold-glow);
}

.player-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.player-btn.secondary {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.2rem;
}

.player-btn.tertiary {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1rem;
}

.player-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.skip-btn {
    position: relative;
}

.skip-btn span {
    position: absolute;
    font-size: 0.6rem;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 800;
    color: var(--gold);
}

/* Recommendation Section */
.replay-recommendations {
    display: none;
    padding: 24px 32px;
    background: rgba(0, 0, 0, 0.1);
}

.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;
}

.rec-avatar {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rec-info .title {
    font-size: 0.85rem;
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.rec-info .meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Transcript Panel */
.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;
    scroll-behavior: smooth;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

.transcript-item {
    padding: 20px;
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    opacity: 0.3;
    filter: blur(1px);
    transform: scale(0.95);
}

.transcript-item:hover {
    opacity: 0.6;
    filter: none;
}

.transcript-item.active {
    opacity: 1;
    filter: none;
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.05);
}

.lyrics-line {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lyrics-text {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: color 0.3s;
}

.transcript-item.active .lyrics-text {
    color: var(--gold);
}

/* --- PODCAST PLAYER OVERLAY (Apple Music Style) --- */
.podcast-player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 2000;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(50px);
    display: flex;
    flex-direction: column;
    /* Removed slideUp animation - it caused opacity:0 issues when toggling display */
}

/* Player Header */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent);
    transition: opacity 0.5s ease, transform 0.5s ease;
    z-index: 100;
}

.idle-hide .player-header {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.1);
}

.player-meta {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-room-title {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}

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

/* Player Content (Art & Lyrics) */
.player-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Aligned to top for scrolling */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    width: 100%;
}

/* Artwork */
.artwork-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1/1;
    transition: transform 0.4s ease, opacity 0.4s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.artwork-container.shrunk {
    display: 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: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Lyrics */
.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 {
    /* Apple Podcast Transcript Style */
    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;
    /* No blur - always readable */
    filter: none;
    transform: none;
    opacity: 1;
    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-line:not(.active) {
    /* No blur for readability */
    filter: none;
}

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

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

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

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

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

/* Player Controls Area */
.player-controls-area {
    background: rgba(20, 20, 30, 0.6);
    backdrop-filter: blur(30px);
    padding: 24px 32px 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 20;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.waveform-wrapper {
    height: 32px;
    /* Reduced from 48px since it's just a slider */
    width: 100%;
    display: flex;
    align-items: center;
    position: relative;
    margin-bottom: 8px;
}

/* Apple-style Slider */
.player-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: height 0.2s;
}

.player-slider:hover {
    height: 6px;
}

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

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

/* For played/unplayed distinction via JS background-size or similar */
/* We'll update the background via JS: linear-gradient(to right, gold 0%, gold var(--progress), rgba(...) var(--progress), rgba(...) 100%) */

.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;
    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);
}

/* Rec Stripe */
.rec-stripe {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}

/* Utils */
.art-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: rgba(255, 255, 255, 0.05);
}

.art-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    /* Make them circular in the grid if desired, or keep square */
    /* Many podcats use circular avatars for guests */
    max-width: 160px;
    max-height: 160px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Visualizer Overlay */
.visualizer-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 3px;
    height: 60px;
    z-index: 5;
    transition: opacity 0.3s;
    pointer-events: none;
}

.visualizer-overlay.hidden {
    display: none;
}

.visualizer-overlay .v-bar {
    width: 4px;
    height: 6px;
    background: linear-gradient(to top, var(--pink) 0%, var(--gold) 100%);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(243, 194, 106, 0.3);
}

.podcast-playing .v-bar {
    animation: bounce 1s ease-in-out infinite;
}

/* 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;
    white-space: nowrap;
}

.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);
}

.visualizer-overlay .v-bar:nth-child(1),
.visualizer-overlay .v-bar:nth-child(14) {
    height: 8px;
    animation-duration: 1.1s;
}

.visualizer-overlay .v-bar:nth-child(2),
.visualizer-overlay .v-bar:nth-child(13) {
    height: 14px;
    animation-duration: 0.9s;
    animation-delay: 0.1s;
}

.visualizer-overlay .v-bar:nth-child(3),
.visualizer-overlay .v-bar:nth-child(12) {
    height: 22px;
    animation-duration: 1.3s;
    animation-delay: 0.2s;
}

.visualizer-overlay .v-bar:nth-child(4),
.visualizer-overlay .v-bar:nth-child(11) {
    height: 30px;
    animation-duration: 1.0s;
    animation-delay: 0.3s;
}

.visualizer-overlay .v-bar:nth-child(5),
.visualizer-overlay .v-bar:nth-child(10) {
    height: 38px;
    animation-duration: 1.2s;
    animation-delay: 0.4s;
}

.visualizer-overlay .v-bar:nth-child(6),
.visualizer-overlay .v-bar:nth-child(9) {
    height: 46px;
    animation-duration: 0.8s;
    animation-delay: 0.5s;
}

.visualizer-overlay .v-bar:nth-child(7),
.visualizer-overlay .v-bar:nth-child(8) {
    height: 55px;
    animation-duration: 1.4s;
    animation-delay: 0.6s;
}

@keyframes bounce {

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

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

/* Transcript Button Active State */
.icon-btn.active {
    background: var(--gold) !important;
    color: #000 !important;
    box-shadow: 0 0 15px rgba(243, 194, 106, 0.6);
}