/* ==========================================================================
   RadioKing • Spotify Theme (full) - MOBILE ENHANCED
   Save as: /assets/css/theme.spotify.css
   Works with body.theme-spotify and your --the-* CSS variables.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0) Base Tokens (fallbacks only; real values come from --the-*)
   -------------------------------------------------------------------------- */
:root {
    --spotify-bg: #191414;
    --spotify-surface: #191414;
    --spotify-ink: #ffffff;
    --spotify-muted: #b3b3b3;
    --spotify-line: #282828;
    --spotify-accent: #ffffff;
    /* Spotify green */
    --spotify-accent-2: #fdfdfd;
    /* lighter hover */
    --spotify-danger: #ef4444;
    --spotify-warning: #f59e0b;
    --spotify-info: #38bdf8;
    --spotify-success: #ffffff;

    --rk-radius: calc(var(--the-radius, 12) * 1px);
    --rk-card-radius: calc(var(--the-cardRadius, 12) * 1px);
    --rk-btn-radius: calc(var(--the-buttonRadius, 8) * 1px);
    --rk-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    --rk-shadow-sm: 0 4px 16px rgba(0, 0, 0, .22);
    --rk-shadow-xs: 0 2px 8px rgba(0, 0, 0, .18);

    --rk-transition: .2s ease;
    --rk-transition-slow: .35s ease;

    /* Mobile enhancements */
    --rk-sidebar-w-mobile: min(86vw, 320px);
    --rk-header-h-mobile: 60px;
    --rk-player-h-mobile: 80px;
}

/* --------------------------------------------------------------------------
   1) Global + Theme Root
   -------------------------------------------------------------------------- */
body.theme-spotify {
    background-color: var(--the-bg, var(--spotify-bg));
    color: var(--the-ink, var(--spotify-ink));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Hide desktop header in Spotify theme by default */
.theme-spotify .rp-header {
    display: none !important;
}

.theme-spotify .rp-scrim,
.theme-spotify .rp-mobile-nav {
    display: none !important;
}

/* Links */
body.theme-spotify a {
    color: var(--the-brand, var(--spotify-accent));
    text-decoration: none;
    transition: color var(--rk-transition);
}

body.theme-spotify a:hover {
    color: color-mix(in srgb, var(--the-brand, var(--spotify-accent)) 85%, white 15%);
}

/* Horizontal rules & borders */
body.theme-spotify hr,
body.theme-spotify .divider,
body.theme-spotify .is-divider {
    background: var(--the-line, var(--spotify-line));
    border: 0;
    height: 1px;
    opacity: .9;
}

/* Scrollbar */
body.theme-spotify ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

body.theme-spotify ::-webkit-scrollbar-track {
    background: #111;
}

body.theme-spotify ::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 8px;
    border: 2px solid #111;
}

body.theme-spotify ::-webkit-scrollbar-thumb:hover {
    background: #333;
}

/* Selection */
body.theme-spotify ::selection {
    background: color-mix(in srgb, var(--the-brand, var(--spotify-accent)) 40%, black 60%);
    color: #fff;
}

/* Muted text */
body.theme-spotify .has-text-muted,
body.theme-spotify .is-muted,
body.theme-spotify .help,
body.theme-spotify .subtitle,
body.theme-spotify .label .is-small {
    color: var(--the-muted, var(--spotify-muted)) !important;
}

/* --------------------------------------------------------------------------
   2) Shell • Sidebar + Content - MOBILE FIRST
   -------------------------------------------------------------------------- */
.theme-spotify .rk-shell {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
    background: var(--the-bg, var(--spotify-bg));
    padding-bottom: var(--rk-player-height, 90px);
}

/* Desktop layout */
@media (min-width: 1025px) {
    .theme-spotify .rk-shell {
        grid-template-columns: var(--rk-sidebar-w, 260px) 1fr;
        padding-bottom: var(--rk-player-height, 90px);
    }
}

/* Sidebar */
.theme-spotify .rk-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: var(--rk-sidebar-w-mobile);
    background: color-mix(in srgb, var(--the-surface, var(--spotify-surface)) 96%, black 4%);
    border-right: 1px solid var(--the-line, var(--spotify-line));
    color: var(--the-ink, var(--spotify-ink));
    padding: 16px 12px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--rk-transition-slow);
    z-index: 1200;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}

.theme-spotify .rk-sidebar.is-open {
    transform: translateX(0);
}

/* Desktop sidebar */
@media (min-width: 1025px) {
    .theme-spotify .rk-sidebar {
        position: sticky;
        transform: translateX(0);
        width: var(--rk-sidebar-w, 260px);
        box-shadow: none;
    }
}

/* Brand */
.theme-spotify .rk-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    margin-bottom: 12px;
    border-radius: 10px;
    transition: background var(--rk-transition), transform var(--rk-transition);
}

.theme-spotify .rk-brand:hover {
    background: rgba(255, 255, 255, .03);
    transform: translateY(-1px);
}

.theme-spotify .rk-brand img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 10px;
    flex-shrink: 0;
    transition: transform .25s ease, filter .25s ease;
}

.theme-spotify .rk-brand:hover img {
    transform: scale(1.04);
    filter: brightness(1.08);
}

.theme-spotify .rk-brand .rk-brand-title {
    font-size: 1.25rem;
    line-height: 1;
    font-weight: 700;
}

/* Mobile brand adjustments */
@media (max-width: 480px) {
    .theme-spotify .rk-brand {
        padding: 8px 8px;
    }

    .theme-spotify .rk-brand img {
        width: 44px;
        height: 44px;
    }

    .theme-spotify .rk-brand .rk-brand-title {
        font-size: 1.15rem;
    }
}

/* Compact sidebar */
.theme-spotify .rk-sidebar.is-compact {
    width: var(--rk-sidebar-w-compact, 76px);
}

.theme-spotify .rk-sidebar.is-compact .rk-brand-title,
.theme-spotify .rk-sidebar.is-compact .rk-navlink span,
.theme-spotify .rk-sidebar.is-compact .rk-mini span {
    display: none;
}

.theme-spotify .rk-sidebar.is-compact .rk-brand {
    justify-content: center;
}

/* Navrail */
.theme-spotify .rk-navrail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.theme-spotify .rk-navlink {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--the-ink, var(--spotify-ink));
    padding: 10px 12px;
    border-radius: 10px;
    transition: background var(--rk-transition), transform var(--rk-transition), color var(--rk-transition);
}

.theme-spotify .rk-navlink i {
    width: 18px;
    text-align: center;
    opacity: .95;
}

.theme-spotify .rk-navlink:hover {
    background: rgba(255, 255, 255, .06);
    transform: translateX(2px);
}

.theme-spotify .rk-navlink.active,
.theme-spotify .rk-navlink[aria-current="page"] {
    background: rgba(29, 185, 84, .18);
    color: var(--the-ink, #fff);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

/* Mobile navlink adjustments */
@media (max-width: 480px) {
    .theme-spotify .rk-navlink {
        padding: 12px 14px;
    }

    .theme-spotify .rk-navlink i {
        width: 20px;
        font-size: 1.1rem;
    }
}

/* Sidebar footer */
.theme-spotify .rk-sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--the-line, var(--spotify-line));
}

.theme-spotify .rk-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--the-ink, var(--spotify-ink));
    transition: background var(--rk-transition);
}

.theme-spotify .rk-mini:hover {
    background: rgba(255, 255, 255, .06);
}

/* Content */
.theme-spotify .rk-content {
    min-height: 100vh;
    background: radial-gradient(1400px 400px at 0% -10%, rgba(29, 185, 84, .12), transparent 40%),
        radial-gradient(1000px 300px at 100% -15%, rgba(30, 215, 96, .10), transparent 35%),
        var(--the-bg, var(--spotify-bg));
    padding-top: 0px;
}

/* Desktop content adjustments */
@media (min-width: 1025px) {
    .theme-spotify .rk-content {
        padding-top: 0;
    }
}

/* --------------------------------------------------------------------------
   4) Cards, Boxes, Panels - MOBILE FRIENDLY
   -------------------------------------------------------------------------- */
.theme-spotify .card,
.theme-spotify .box,
.theme-spotify .panel,
.theme-spotify .dropdown-content,
.theme-spotify .menu,
.theme-spotify .navbar,
.theme-spotify .notification {
    background: color-mix(in srgb, var(--the-surface, var(--spotify-surface)) 94%, black 6%) !important;
    color: var(--the-ink, var(--spotify-ink)) !important;
    border: 1px solid var(--the-line, var(--spotify-line)) !important;
    border-radius: var(--rk-card-radius);
    box-shadow: var(--rk-shadow-xs);
}

.theme-spotify .card:hover,
.theme-spotify .box:hover {
    transform: translateY(-2px);
    box-shadow: var(--rk-shadow-sm);
}

/* Mobile card adjustments */
@media (max-width: 768px) {

    .theme-spotify .card,
    .theme-spotify .box {
        margin-left: .5rem;
        margin-right: .5rem;
        border-radius: calc(var(--rk-card-radius) - 2px);
    }

    .theme-spotify .card:hover,
    .theme-spotify .box:hover {
        transform: none;
        /* Disable hover effects on mobile for better performance */
    }
}

/* --------------------------------------------------------------------------
   8) Tabs – FIXED contrast on hover & active + MOBILE FRIENDLY
   -------------------------------------------------------------------------- */
.theme-spotify .tabs li a,
.theme-spotify .card .tabs li a {
    color: var(--the-muted, var(--spotify-muted));
    transition: background var(--rk-transition), color var(--rk-transition);
}

.theme-spotify .tabs li a:hover,
.theme-spotify .card .tabs li a:hover {
    color: #ffffff !important;
    background: color-mix(in srgb, var(--the-brand, #1DB954) 12%, transparent 88%) !important;
    border-color: var(--the-brand, #1DB954);
    text-shadow: 0 0 1px rgba(0, 0, 0, .35);
}

.theme-spotify .tabs li.is-active a,
.theme-spotify .card .tabs li.is-active a {
    color: #ffffff !important;
    border-bottom-color: var(--the-brand, #1DB954) !important;
}

.theme-spotify .tabs.is-boxed li.is-active a,
.theme-spotify .tabs.is-toggle li.is-active a,
.theme-spotify .card .tabs.is-boxed li.is-active a,
.theme-spotify .card .tabs.is-toggle li.is-active a {
    background: color-mix(in srgb, var(--the-brand, #1DB954) 22%, transparent 78%) !important;
    color: #ffffff !important;
    border-color: var(--the-brand, #1DB954) !important;
}

.theme-spotify .tabs.is-boxed li a:hover,
.theme-spotify .tabs.is-toggle li a:hover,
.theme-spotify .card .tabs.is-boxed li a:hover,
.theme-spotify .card .tabs.is-toggle li a:hover {
    color: #ffffff !important;
    background: color-mix(in srgb, var(--the-brand, #1DB954) 12%, transparent 88%) !important;
    border-color: var(--the-brand, #1DB954) !important;
}

/* Mobile tabs */
@media (max-width: 768px) {
    .theme-spotify .tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .theme-spotify .tabs ul {
        flex-wrap: nowrap;
        gap: .25rem;
        padding-bottom: 4px;
    }

    .theme-spotify .tabs li a {
        padding: 0.5em 0.75em;
        font-size: 0.9rem;
    }
}

/* --------------------------------------------------------------------------
   18) GDPR Banner (theme-proof inside Spotify theme)
   -------------------------------------------------------------------------- */
body.theme-spotify #rk-gdpr {
    --rk-bg: var(--rk-gdpr-bg, #0b1220e6);
    --rk-fg: var(--rk-gdpr-fg, #ffffff);
    --rk-btn: var(--rk-gdpr-btn, #1DB954);
    --rk-btnInk: var(--rk-gdpr-btnInk, #0b1220);
    --rk-btnHov: var(--rk-gdpr-btnHov, #18a246);
    --rk-link: var(--rk-gdpr-link, #93c5fd);
    --rk-border: var(--rk-gdpr-border, #1f2937);
    isolation: isolate;
}

body.theme-spotify #rk-gdpr button {
    all: unset;
    display: inline-block;
    cursor: pointer;
    line-height: 1.25;
    font-weight: 600;
    border-radius: 10px;
}

body.theme-spotify #rk-gdpr a {
    color: var(--rk-link) !important;
    text-decoration: underline !important;
}

body.theme-spotify #rk-gdpr .rk-wrap {
    background: var(--rk-bg) !important;
    color: var(--rk-fg) !important;
    border: 1px solid var(--rk-border) !important;
    border-radius: 10px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .35);
}

body.theme-spotify #rk-gdpr .rk-actions .rk-btn {
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--rk-fg) !important;
}

body.theme-spotify #rk-gdpr .rk-actions .rk-btn--ghost {
    border-color: var(--rk-border) !important;
    background: transparent !important;
}

body.theme-spotify #rk-gdpr .rk-actions .rk-btn--primary {
    background: var(--rk-btn) !important;
    color: var(--rk-btnInk) !important;
    border-color: var(--rk-btn) !important;
}

body.theme-spotify #rk-gdpr .rk-actions .rk-btn--primary:hover {
    background: var(--rk-btnHov) !important;
    border-color: var(--rk-btnHov) !important;
}

@media (max-width: 640px) {
    body.theme-spotify #rk-gdpr .rk-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    body.theme-spotify #rk-gdpr .rk-actions {
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: wrap;
    }
}

/* =======================================================================
   MOBILE ENHANCEMENTS - Spotify Theme
   ======================================================================= */

/* Mobile Header for Spotify Theme */
.theme-spotify .rk-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--rk-header-h-mobile);
    background: color-mix(in srgb, var(--the-surface, var(--spotify-surface)) 96%, black 4%);
    border-bottom: 1px solid var(--the-line, var(--spotify-line));
    padding: 0 1rem;
    z-index: 1100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.theme-spotify .rk-mobile-header .rk-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--the-ink, var(--spotify-ink));
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.theme-spotify .rk-mobile-header .rk-mobile-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
}

.theme-spotify .rk-mobile-header .rk-mobile-menu-btn {
    background: none;
    border: none;
    color: var(--the-ink, var(--spotify-ink));
    font-size: 1.25rem;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--rk-transition);
}

.theme-spotify .rk-mobile-header .rk-mobile-menu-btn:hover {
    background: rgba(255, 255, 255, .08);
}

/* Mobile scrim */
.theme-spotify .rk-mobile-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    backdrop-filter: blur(2px);
    z-index: 1150;
    display: none;
}

.theme-spotify .rk-sidebar.is-open~.rk-content .rk-mobile-scrim {
    display: block;
}

/* Hide mobile header on desktop */
@media (min-width: 1025px) {
    .theme-spotify .rk-mobile-header {
        display: none;
    }

    .theme-spotify .rk-mobile-scrim {
        display: none !important;
    }
}

/* Content area mobile padding */
@media (max-width: 1024px) {
    .theme-spotify .rk-content {
        padding-top: var(--rk-header-h-mobile);
        min-width: 0;
        overflow-x: hidden;
    }

    .theme-spotify .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Improved mobile typography and spacing */
@media (max-width: 768px) {

    .theme-spotify .rk-content,
    .theme-spotify .card *,
    .theme-spotify .box * {
        word-break: break-word;
        min-width: 0;
    }

    .theme-spotify .title {
        font-size: 1.5rem !important;
    }

    .theme-spotify .subtitle {
        font-size: 1.1rem !important;
    }

    .theme-spotify .section {
        padding: 1.5rem 0;
    }
}

/* Touch-friendly buttons and inputs */
@media (max-width: 480px) {

    .theme-spotify .button,
    .theme-spotify .input,
    .theme-spotify .select select,
    .theme-spotify .textarea {
        font-size: 16px;
        /* Prevent iOS zoom */
        min-height: 44px;
        /* Minimum touch target */
    }

    .theme-spotify .button {
        padding: 0.75em 1em;
    }
}

/* Safe area insets for notched devices */
@supports(padding: max(0px)) {
    .theme-spotify .rk-mobile-header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: env(safe-area-inset-top);
        height: calc(var(--rk-header-h-mobile) + env(safe-area-inset-top));
    }

    .theme-spotify .rk-content {
        padding-top: calc(var(--rk-header-h-mobile) + env(safe-area-inset-top));
    }

    .theme-spotify .rk-sidebar {
        padding-top: calc(16px + env(safe-area-inset-top));
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        height: calc(100dvh + env(safe-area-inset-top));
    }
}

/* Body lock when sidebar is open */
.theme-spotify body.is-locked {
    overflow: hidden;
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    .theme-spotify .rk-sidebar {
        transition: transform var(--rk-transition-slow);
        will-change: transform;
    }

    .theme-spotify .rk-mobile-scrim {
        transition: opacity var(--rk-transition);
        will-change: opacity;
    }
}