/* =====================================================
   WP Radio Player v1.1 — radio-player.css
   Mobile-first, autoplay overlay, responsive
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Syne:wght@600;800&display=swap');

/* ── Dark theme ── */
.rp-theme-dark {
    --rp-bg:       #0d0d0f;
    --rp-surface:  #18181c;
    --rp-border:   #2a2a32;
    --rp-accent:   #e63946;
    --rp-text:     #f0f0f5;
    --rp-muted:    #6b6b80;
    --rp-glow:     rgba(230,57,70,0.35);
    --rp-track:    #2a2a32;
    --rp-overlay:  rgba(13,13,15,0.82);
}

/* ── Light theme ── */
.rp-theme-light {
    --rp-bg:       #f0f0f5;
    --rp-surface:  #ffffff;
    --rp-border:   #dde0e8;
    --rp-accent:   #e63946;
    --rp-text:     #111118;
    --rp-muted:    #8888a0;
    --rp-glow:     rgba(230,57,70,0.2);
    --rp-track:    #dde0e8;
    --rp-overlay:  rgba(240,240,245,0.88);
}

/* ── Reset & base ── */
.rp-wrapper *,
.rp-wrapper *::before,
.rp-wrapper *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ══════════════════════════════════════════
   WRAPPER  —  mobile-first grid
   ══════════════════════════════════════════ */
.rp-wrapper {
    font-family: 'Space Mono', monospace;
    background:   var(--rp-surface);
    border:       1px solid var(--rp-border);
    border-radius: 22px;
    padding: 20px 18px 18px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    display: grid;
    /* mobile: logo | info | play */
    grid-template-columns: 72px 1fr 58px;
    grid-template-rows: auto auto auto;
    gap: 12px 14px;
    align-items: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18),
                inset 0 1px 0 rgba(255,255,255,0.05);
    transition: box-shadow 0.4s;
}

/* ambient glow when playing */
.rp-wrapper::before {
    content: '';
    position: absolute;
    top: -80px; left: -80px;
    width: 240px; height: 240px;
    background: radial-gradient(circle, var(--rp-glow) 0%, transparent 68%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s;
}
.rp-wrapper.is-playing::before { opacity: 1; }

/* ── TAP-TO-LISTEN overlay ── */
.rp-tap-overlay {
    position: absolute;
    inset: 0;
    background: var(--rp-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    z-index: 10;
    border-radius: 22px;
    transition: opacity 0.35s;
    /* shown by default when autoplay is on */
}

.rp-tap-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.rp-tap-icon {
    font-size: 2.2rem;
    animation: rp-bounce 1.6s ease-in-out infinite;
}

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

.rp-tap-text {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--rp-text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Logo wrap ── */
.rp-logo-wrap {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    width: 66px;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rp-logo-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--rp-accent);
    border-right-color: var(--rp-accent);
    opacity: 0;
    animation: rp-spin 2.8s linear infinite;
    transition: opacity 0.4s;
}
.rp-wrapper.is-playing .rp-logo-ring { opacity: 1; }

@keyframes rp-spin { to { transform: rotate(360deg); } }

.rp-logo-inner {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--rp-bg);
    border: 1px solid var(--rp-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.rp-logo-img            { width:100%; height:100%; object-fit:cover; border-radius:50%; display:none; }
.rp-logo-img.has-logo   { display:block; }
.rp-logo-placeholder    { font-size:24px; line-height:1; }

/* EQ bars */
.rp-eq-bars {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 16px;
    opacity: 0;
    transition: opacity 0.4s;
}
.rp-wrapper.is-playing .rp-eq-bars { opacity: 1; }

.rp-eq-bars span {
    width: 3px;
    height: 5px;
    background: var(--rp-accent);
    border-radius: 2px;
    animation: rp-eq 0.75s ease-in-out infinite alternate;
}
.rp-eq-bars span:nth-child(1){animation-delay:0.00s}
.rp-eq-bars span:nth-child(2){animation-delay:0.15s}
.rp-eq-bars span:nth-child(3){animation-delay:0.05s}
.rp-eq-bars span:nth-child(4){animation-delay:0.20s}
.rp-eq-bars span:nth-child(5){animation-delay:0.10s}

@keyframes rp-eq {
    from { height: 4px; }
    to   { height: 14px; }
}

/* ── Info ── */
.rp-info {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

.rp-station-name {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--rp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rp-status {
    font-size: 0.66rem;
    color: var(--rp-muted);
    margin-top: 4px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color 0.3s;
}
.rp-wrapper.is-playing .rp-status { color: var(--rp-accent); }

/* ── Play button ── */
.rp-controls {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    justify-content: center;
}

.rp-play-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--rp-accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.3s;
    box-shadow: 0 0 0 0 var(--rp-glow);
    /* larger tap target on mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.rp-play-btn:hover  { transform: scale(1.08); box-shadow: 0 0 0 8px var(--rp-glow); }
.rp-play-btn:active { transform: scale(0.93); }

.rp-wrapper.is-playing .rp-play-btn {
    animation: rp-pulse 2.2s ease-in-out infinite;
}
@keyframes rp-pulse {
    0%,100% { box-shadow: 0 0 0 4px var(--rp-glow); }
    50%      { box-shadow: 0 0 0 16px transparent; }
}

/* loading spinner */
.rp-play-btn.is-loading::after {
    content: '';
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    animation: rp-spin 0.65s linear infinite;
}

.rp-icon-play, .rp-icon-pause {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* ── Volume row ── */
.rp-volume-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 2px;
}

/* mute toggle button */
.rp-mute-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.rp-vol-icon {
    width: 20px;
    height: 20px;
    color: var(--rp-muted);
    transition: color 0.2s;
}
.rp-mute-btn:hover .rp-vol-icon { color: var(--rp-text); }

/* range slider */
.rp-volume {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--rp-track);
    outline: none;
    cursor: pointer;
    background-image: linear-gradient(var(--rp-accent), var(--rp-accent));
    background-size: 80% 100%;
    background-repeat: no-repeat;
}
.rp-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--rp-accent);
    cursor: pointer;
    box-shadow: 0 0 6px var(--rp-glow);
    transition: transform 0.15s;
}
.rp-volume::-webkit-slider-thumb:hover { transform: scale(1.3); }
.rp-volume::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--rp-accent);
    border: none;
    cursor: pointer;
}

/* ── Station list ── */
.rp-station-list {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--rp-border);
}

.rp-station-btn {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid var(--rp-border);
    background: var(--rp-bg);
    color: var(--rp-muted);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.04em;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.rp-station-btn:hover,
.rp-station-btn:focus {
    border-color: var(--accent, var(--rp-accent));
    color: var(--accent, var(--rp-accent));
    outline: none;
}
.rp-station-btn.active {
    background: var(--accent, var(--rp-accent));
    border-color: var(--accent, var(--rp-accent));
    color: #fff;
}

/* ══════════════════════════════════════════
   RESPONSIVE — tablet / desktop
   ══════════════════════════════════════════ */

/* 480px+ : slightly bigger */
@media (min-width: 480px) {
    .rp-wrapper {
        padding: 26px 26px 20px;
        grid-template-columns: 84px 1fr 58px;
        gap: 14px 18px;
    }
    .rp-logo-wrap  { width: 78px; height: 78px; }
    .rp-logo-inner { width: 72px; height: 72px; }
    .rp-logo-placeholder { font-size: 28px; }
    .rp-station-name { font-size: 1.08rem; }
    .rp-play-btn { width: 54px; height: 54px; }
}

/* Very small phones */
@media (max-width: 359px) {
    .rp-wrapper {
        grid-template-columns: 58px 1fr 48px;
        padding: 16px 14px 14px;
        gap: 10px 10px;
    }
    .rp-logo-wrap  { width: 52px; height: 52px; }
    .rp-logo-inner { width: 48px; height: 48px; }
    .rp-station-name { font-size: 0.82rem; }
    .rp-play-btn { width: 44px; height: 44px; }
    .rp-tap-text { font-size: 0.75rem; }
}
