/* =====================================================
   Oniversus Radio — v1.0.0
   Theme-aware: tokens inherit from WP block theme
   --wp--preset--color--* (theme.json)
   ===================================================== */

#oniversus-radio-grid {
    /* ── Design tokens (same system as M3U player) ── */
    --onv-accent:    var(--wp--preset--color--primary,  #926AA6);
    --onv-accent-fg: #ffffff;
    --onv-bg:        var(--wp--preset--color--base,     #1A1B1E);
    --onv-card-bg:   color-mix(in srgb, var(--onv-bg) 80%, white 20%);
    --onv-text-hi:   var(--wp--preset--color--contrast, #ffffff);
    --onv-text-lo:   rgba(255, 255, 255, 0.50);
    --onv-border:    rgba(255, 255, 255, 0.10);

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding: 4px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* ─────────────────────────────────────────
   Card
───────────────────────────────────────── */
.onv-radio-card {
    background: var(--onv-bg);
    border: 1px solid var(--onv-border);
    border-radius: 16px;
    padding: 24px 20px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    transition: box-shadow 0.25s, border-color 0.25s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}
.onv-radio-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.onv-radio-card.playing {
    border-color: var(--onv-accent);
    box-shadow: 0 0 0 1px var(--onv-accent), 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ─────────────────────────────────────────
   Logo
───────────────────────────────────────── */
.onv-radio-logo {
    position: relative;
    width: 90px;
    height: 90px;
    flex-shrink: 0;
}

.onv-radio-logo img,
.onv-logo-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid var(--onv-border);
    transition: transform 0.3s ease;
}

.onv-logo-placeholder {
    background: linear-gradient(135deg, var(--onv-accent), var(--onv-bg));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--onv-accent-fg);
    text-transform: uppercase;
}

/* Spinning logo when playing */
.onv-radio-card.playing .onv-radio-logo img,
.onv-radio-card.playing .onv-logo-placeholder {
    animation: onv-spin 8s linear infinite;
    border-color: var(--onv-accent);
}

@keyframes onv-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* LIVE badge */
.onv-live-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #e53;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1.4;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.onv-radio-card.playing .onv-live-badge {
    opacity: 1;
    transform: scale(1);
}

/* ─────────────────────────────────────────
   Station info
───────────────────────────────────────── */
.onv-radio-info {
    text-align: center;
    width: 100%;
    min-width: 0;
}

.onv-radio-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--onv-text-hi);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.onv-radio-card.playing .onv-radio-name {
    color: var(--onv-accent);
}

.onv-radio-link {
    font-size: 11px;
    color: var(--onv-text-lo);
    text-decoration: none;
    transition: color 0.15s;
    display: inline-block;
}
.onv-radio-link:hover { color: var(--onv-accent); text-decoration: underline; }

/* ─────────────────────────────────────────
   Volume row
───────────────────────────────────────── */
.onv-vol-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.onv-mute-btn {
    background: none;
    border: none;
    color: var(--onv-text-lo);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.onv-mute-btn:hover  { color: var(--onv-text-hi); }
.onv-mute-btn:focus  { outline: none; }
.onv-mute-btn.muted  { color: var(--onv-accent); }

.onv-vol-range {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    outline: none;
    cursor: pointer;
    --vol-fill: 80%;
}
.onv-vol-range::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        var(--onv-accent) var(--vol-fill),
        rgba(255, 255, 255, 0.20) var(--vol-fill)
    );
}
.onv-vol-range::-moz-range-track {
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        var(--onv-accent) var(--vol-fill),
        rgba(255, 255, 255, 0.20) var(--vol-fill)
    );
}
.onv-vol-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--onv-text-hi);
    cursor: pointer;
    margin-top: -4px;
}
.onv-vol-range::-moz-range-thumb {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--onv-text-hi);
    cursor: pointer;
    border: none;
}

/* ─────────────────────────────────────────
   Play button
───────────────────────────────────────── */
.onv-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--onv-text-hi);
    color: #111;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, background 0.15s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
.onv-play-btn:hover  { transform: scale(1.08); }
.onv-play-btn:active { transform: scale(0.95); }
.onv-play-btn:focus  { outline: none; }

.onv-radio-card.playing .onv-play-btn {
    background: var(--onv-accent);
    color: var(--onv-accent-fg);
}

/* ─────────────────────────────────────────
   Mobile
───────────────────────────────────────── */
@media (max-width: 480px) {
    #oniversus-radio-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .onv-radio-logo,
    .onv-radio-logo img,
    .onv-logo-placeholder {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 320px) {
    #oniversus-radio-grid {
        grid-template-columns: 1fr;
    }
}
