/* ============================================
   Lo Divertido Radio - Web Player Styles
   ============================================ */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0D0D1A;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --accent-cyan: #00E5FF;
    --accent-purple: #7C4DFF;
    --accent-gradient: linear-gradient(135deg, #00E5FF, #7C4DFF);
    --text-primary: #FFFFFF;
    --text-secondary: #B0BEC5;
    --status-live: #00E676;
    --status-connecting: #FFD600;
    --status-offline: #FF1744;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 16px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Background */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://mgx-backend-cdn.metadl.com/generate/images/1095140/2026-04-06/ea455363-b49e-4e55-9371-20b9807c7ff9.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
}

.bg-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, var(--bg-primary) 70%);
}

/* Player Container */
.player-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin: 20px;
    padding: 32px 28px;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--bg-card-border);
    border-radius: 24px;
    box-shadow: 
        0 0 40px rgba(0, 229, 255, 0.08),
        0 0 80px rgba(124, 77, 255, 0.05),
        0 24px 48px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.player-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.player-banner-wrapper {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.15);
    animation: bannerNeonPulse 3s ease-in-out infinite;
}

@keyframes bannerNeonPulse {
    0% {
        border-color: rgba(0, 229, 255, 0.15);
        box-shadow: 0 4px 20px rgba(0, 229, 255, 0.1),
                    inset 0 0 10px rgba(0, 229, 255, 0.0);
    }
    33% {
        border-color: rgba(0, 229, 255, 0.5);
        box-shadow: 0 4px 30px rgba(0, 229, 255, 0.25),
                    0 0 15px rgba(0, 229, 255, 0.15),
                    inset 0 0 15px rgba(0, 229, 255, 0.05);
    }
    66% {
        border-color: rgba(124, 77, 255, 0.5);
        box-shadow: 0 4px 30px rgba(124, 77, 255, 0.25),
                    0 0 15px rgba(124, 77, 255, 0.15),
                    inset 0 0 15px rgba(124, 77, 255, 0.05);
    }
    100% {
        border-color: rgba(0, 229, 255, 0.15);
        box-shadow: 0 4px 20px rgba(0, 229, 255, 0.1),
                    inset 0 0 10px rgba(0, 229, 255, 0.0);
    }
}

/* Shimmer light sweep across the banner */
.player-banner-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 229, 255, 0.06),
        rgba(255, 255, 255, 0.08),
        rgba(124, 77, 255, 0.06),
        transparent
    );
    z-index: 2;
    pointer-events: none;
    animation: bannerShimmer 4s ease-in-out infinite;
}

@keyframes bannerShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

.player-banner-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to top, rgba(13, 13, 26, 0.9), transparent);
    pointer-events: none;
    z-index: 3;
}

.player-banner {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 100px;
}

.player-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 0;
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--status-offline);
    box-shadow: 0 0 8px var(--status-offline);
    transition: background var(--transition), box-shadow var(--transition);
}

.status-dot.live {
    background: var(--status-live);
    box-shadow: 0 0 12px var(--status-live);
    animation: pulse 1.5s infinite;
}

.status-dot.connecting {
    background: var(--status-connecting);
    box-shadow: 0 0 8px var(--status-connecting);
    animation: pulse 0.8s infinite;
}

.status-dot.offline {
    background: var(--status-offline);
    box-shadow: 0 0 8px var(--status-offline);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

.status-text {
    color: var(--text-secondary);
}

/* Visualizer */
.visualizer-wrapper {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

#visualizer {
    width: 100%;
    height: 100%;
    display: block;
}

/* Now Playing */
.now-playing {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 229, 255, 0.04);
    border: 1px solid rgba(0, 229, 255, 0.1);
    border-radius: var(--radius);
    overflow: hidden;
}

.now-playing-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.now-playing-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.now-playing-label {
    font-size: 0.7rem;
    color: var(--accent-cyan);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.now-playing-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing-title.scrolling {
    animation: marquee 12s linear infinite;
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 3px;
}

.btn-play {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-gradient);
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.3), 0 0 40px rgba(124, 77, 255, 0.15);
}

.btn-play:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 30px rgba(0, 229, 255, 0.4), 0 0 60px rgba(124, 77, 255, 0.2);
}

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

.btn-stop,
.btn-mute {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-stop:hover,
.btn-mute:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: scale(1.05);
}

.btn-stop:active,
.btn-mute:active {
    transform: scale(0.92);
}

.btn-stop svg,
.btn-mute svg {
    width: 20px;
    height: 20px;
}

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

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 8px;
}

.volume-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
    cursor: pointer;
    transition: transform var(--transition);
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
    cursor: pointer;
    border: none;
}

.volume-slider:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

.volume-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-cyan);
    min-width: 36px;
    text-align: right;
}

/* Listeners */
.listeners {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.listeners-icon {
    font-size: 1rem;
}

#listenersCount {
    font-weight: 700;
    color: var(--accent-cyan);
}

/* ============================================
   Recent Songs (Collapsible)
   ============================================ */

.recent-songs-section {
    width: 100%;
}

.recent-songs-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.recent-songs-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 229, 255, 0.2);
    color: var(--text-primary);
}

.recent-songs-toggle:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

.recent-songs-toggle[aria-expanded="true"] {
    border-color: rgba(0, 229, 255, 0.25);
    background: rgba(0, 229, 255, 0.06);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.recent-songs-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.recent-songs-label {
    flex: 1;
    text-align: left;
}

.recent-songs-chevron {
    flex-shrink: 0;
    transition: transform var(--transition);
    opacity: 0.6;
}

.recent-songs-toggle[aria-expanded="true"] .recent-songs-chevron {
    transform: rotate(180deg);
    opacity: 1;
    color: var(--accent-cyan);
}

.recent-songs-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                padding 0.3s ease;
    opacity: 0;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: none;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    padding: 0 12px;
}

.recent-songs-list.open {
    max-height: 400px;
    opacity: 1;
    padding: 12px;
}

.recent-songs-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 16px 0;
    opacity: 0.6;
}

.recent-songs-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recent-song-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    animation: songSlideIn 0.3s ease-out;
}

@keyframes songSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.recent-song-item:hover {
    background: rgba(0, 229, 255, 0.06);
    border-color: rgba(0, 229, 255, 0.15);
}

.recent-song-item:first-child {
    border-color: rgba(0, 229, 255, 0.2);
    background: rgba(0, 229, 255, 0.05);
}

.recent-song-number {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-purple);
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 77, 255, 0.15);
    border-radius: 50%;
    flex-shrink: 0;
}

.recent-song-item:first-child .recent-song-number {
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.15);
}

.recent-song-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-song-title {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-song-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
    flex-shrink: 0;
}

/* ============================================
   Share Button & Dropdown
   ============================================ */

.share-wrapper {
    position: relative;
    flex-shrink: 0;
}

.btn-share {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    font-family: var(--font-family);
}

.btn-share:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.3);
    color: var(--accent-cyan);
    transform: scale(1.1);
}

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

.btn-share:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
}

.share-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 150px;
    background: rgba(20, 20, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
                0 0 20px rgba(0, 229, 255, 0.08);
}

.share-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.share-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.share-option:hover {
    background: rgba(0, 229, 255, 0.1);
    color: var(--text-primary);
}

.share-option:active {
    background: rgba(0, 229, 255, 0.18);
}

.share-option svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.share-option:hover svg {
    opacity: 1;
}

/* Copy Toast */
.copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 20px;
    background: rgba(0, 229, 255, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 12px;
    color: var(--accent-cyan);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.2);
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Footer */
.player-footer {
    margin-top: 4px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 480px) {
    .player-container {
        margin: 12px;
        padding: 24px 20px;
        border-radius: 20px;
        gap: 16px;
    }

    .player-banner-wrapper {
        width: 100%;
        border-radius: 14px;
    }

    .player-banner {
        max-height: 150px;
    }

    .btn-play {
        width: 64px;
        height: 64px;
    }

    .btn-stop,
    .btn-mute {
        width: 44px;
        height: 44px;
    }

    .visualizer-wrapper {
        height: 64px;
    }
}

@media (max-width: 360px) {
    .player-container {
        margin: 8px;
        padding: 20px 16px;
    }

    .player-banner-wrapper {
        width: 100%;
        border-radius: 12px;
    }

    .player-banner {
        max-height: 120px;
    }

    .btn-play {
        width: 56px;
        height: 56px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        align-items: flex-start;
    }

    .player-container {
        margin: 8px;
        padding: 16px 20px;
        gap: 10px;
    }

    .visualizer-wrapper {
        height: 50px;
    }

    .btn-play {
        width: 52px;
        height: 52px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast */
@media (prefers-contrast: high) {
    .player-container {
        border: 2px solid var(--text-primary);
    }

    .btn-play {
        border: 2px solid var(--text-primary);
    }
}