/* ============================================================
   THARADIO PLAYER PLUGIN — player.css
   Styles for tharadio/hero-player and tharadio/mini-player blocks
   ============================================================ */

/* ── CSS Variables ── */
.tharadio-hero,
.tharadio-mini {
    --tr-red:        #e02020;
    --tr-red2:       #ff4444;
    --tr-red-dim:    rgba(220,30,30,0.15);
    --tr-glow:       rgba(220,30,30,0.6);
    --tr-black:      #050505;
    --tr-dark:       #0f0f0f;
    --tr-panel:      #1a1a1a;
    --tr-white:      #ffffff;
    --tr-dim:        rgba(255,255,255,0.5);
    --tr-border:     rgba(255,255,255,0.08);
    font-family: 'Rajdhani', sans-serif;
}

/* ============================================================
   HERO PLAYER
   ============================================================ */
.tharadio-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--tr-black);
    color: var(--tr-white);
}

/* Blurred album art background */
.tr-bg-art {
    position: absolute;
    inset: -60px;
    z-index: 0;
    background-size: cover;
    background-position: center;
    filter: blur(60px) brightness(0.25) saturate(1.5);
    opacity: 0;
    transition: opacity 1s ease, background-image 1.5s ease;
}
.tr-bg-art.loaded { opacity: 1; }

/* Grain overlay */
.tharadio-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Inner grid */
.tr-hero-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1400px;
    padding: 60px 40px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 60px;
}

/* ── SPEAKERS ── */
.tr-speaker-col {
    display: flex;
    justify-content: center;
    align-items: center;
}
.tr-speaker-wrap {
    width: 280px;
    height: 280px;
    flex-shrink: 0;
}
.tr-spk-outer {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 28%,
        #f0f0f0 0%, #e0e0e0 15%, #cccccc 35%,
        #b8b8b8 55%, #a0a0a0 75%, #888 100%);
    border: 1px solid #bbb;
    box-shadow:
        0 0 0 2px #aaa,
        0 0 0 5px #1a1a1a,
        0 12px 50px rgba(0,0,0,0.95),
        0 4px 20px rgba(0,0,0,0.8),
        inset 0 3px 6px rgba(255,255,255,0.7),
        inset 0 -3px 6px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: box-shadow 0.15s;
    overflow: hidden;
}
.tr-spk-outer::before { display: none; } /* no bolts */
.tr-spk-outer::after {
    content: '';
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    border: 1px solid rgba(220,30,30,0.12);
    animation: tr-spk-ring 3s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}
.tr-speaker-col.playing .tr-spk-outer {
    box-shadow:
        0 0 0 2px #bbb,
        0 0 0 5px #1a1a1a,
        0 12px 50px rgba(0,0,0,0.95),
        0 0 100px rgba(220,30,30,0.45),
        0 0 40px rgba(220,30,30,0.3),
        inset 0 3px 6px rgba(255,255,255,0.7),
        inset 0 -3px 6px rgba(0,0,0,0.25);
    animation: tr-spk-pulse 0.12s ease-in-out infinite alternate;
}
@keyframes tr-spk-pulse { from { transform: scale(1); } to { transform: scale(1.012); } }
@keyframes tr-spk-ring  { 0%,100%{opacity:.3;transform:scale(.97);}50%{opacity:1;transform:scale(1.02);} }

.tr-spk-surround {
    width: 86%; height: 86%; border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%,
            transparent 52%, #080808 53%, #1a1a1a 60%, #0a0a0a 68%, transparent 69%),
        radial-gradient(circle at 42% 38%,
            #e8e8e8 0%, #d0d0d0 25%, #c0c0c0 45%, #a8a8a8 65%, #888 85%, #555 100%);
    box-shadow: inset 0 4px 16px rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; position: relative;
}
.tr-spk-cone {
    width: 68%; height: 68%; border-radius: 50%;
    background: radial-gradient(ellipse at 42% 36%,
        #fff 0%, #f0f0f0 20%, #e0e0e0 40%, #ccc 60%, #b0b0b0 80%, #909090 100%);
    box-shadow:
        inset 0 4px 20px rgba(255,255,255,.6),
        inset 0 -6px 20px rgba(0,0,0,.2),
        0 2px 8px rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center; position: relative;
}
.tr-spk-cap {
    width: 36%; height: 36%; border-radius: 50%;
    background: radial-gradient(ellipse at 38% 32%,
        #fff 0%, #f8f8f8 25%, #e8e8e8 50%, #ccc 75%, #aaa 100%);
    box-shadow:
        0 4px 16px rgba(0,0,0,.35),
        0 2px 6px rgba(0,0,0,.25),
        inset 0 2px 4px rgba(255,255,255,.9);
}

/* ── CENTER CONSOLE ── */
.tr-console {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 340px;
}

/* Now Playing label */
.tr-now-playing-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 38px;
    letter-spacing: 8px;
    line-height: 1;
    color: var(--tr-dim);
    text-transform: uppercase;
}

/* Album art */
.tr-art-wrap {
    position: relative;
    width: 220px; height: 220px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.8), 0 0 0 1px var(--tr-border);
    flex-shrink: 0;
}
.tr-art-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity 0.8s ease;
    opacity: 0;
}
.tr-art-img.loaded { opacity: 1; }
.tr-art-placeholder {
    position: absolute; inset: 0;
    background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
    display: flex; align-items: center; justify-content: center;
}
.tr-art-placeholder svg { width: 60px; height: 60px; opacity: 0.2; }
.tr-art-spin {
    position: absolute; inset: 0; border-radius: 12px;
    background: conic-gradient(from 0deg, transparent 0%, rgba(220,30,30,.3) 10%, transparent 20%);
    animation: tr-spin 3s linear infinite;
    opacity: 0; transition: opacity 0.3s;
}
.playing .tr-art-spin { opacity: 1; }
@keyframes tr-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Track info — fixed height prevents layout shift */
.tr-track-info {
    text-align: center;
    width: 100%;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.tr-track-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px; letter-spacing: 2px; line-height: 1.2;
    color: var(--tr-white);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    width: 320px; max-width: 100%; min-height: 26px;
}
.tr-track-artist {
    font-size: 13px; font-weight: 600; letter-spacing: 2px;
    color: var(--tr-red); text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    width: 320px; max-width: 100%; min-height: 18px;
}
.tr-track-album {
    font-size: 11px; letter-spacing: 1px; font-style: italic;
    color: var(--tr-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    width: 300px; max-width: 100%; min-height: 16px;
}
.tr-live-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'Orbitron', monospace; font-size: 10px; letter-spacing: 3px;
    color: var(--tr-red); margin-top: 4px;
}
.tr-live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--tr-red); box-shadow: 0 0 8px var(--tr-red);
    animation: tr-live-blink 1.2s ease-in-out infinite;
}
@keyframes tr-live-blink { 0%,100%{opacity:1;} 50%{opacity:.2;} }

/* Controls */
.tr-controls { display: flex; align-items: center; gap: 16px; }
.tr-btn-play {
    width: 72px; height: 72px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, var(--tr-red), #aa0000);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 40px var(--tr-glow), 0 8px 30px rgba(0,0,0,.6);
    transition: all 0.2s; flex-shrink: 0;
}
.tr-btn-play:hover  { transform: scale(1.08); box-shadow: 0 0 60px var(--tr-glow), 0 8px 30px rgba(0,0,0,.6); }
.tr-btn-play:active { transform: scale(0.95); }
.tr-btn-play svg    { width: 28px; height: 28px; pointer-events: none; }
.tr-btn-ctrl {
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--tr-border);
    background: rgba(255,255,255,.04);
    color: var(--tr-dim); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; backdrop-filter: blur(10px);
}
.tr-btn-ctrl:hover { border-color: rgba(255,255,255,.2); color: #fff; background: rgba(255,255,255,.08); }
.tr-btn-ctrl svg   { width: 16px; height: 16px; pointer-events: none; }

/* Volume */
.tr-volume-row { display: flex; align-items: center; gap: 12px; width: 100%; }
.tr-vol-icon   { color: var(--tr-dim); flex-shrink: 0; }
.tr-vol-icon svg { width: 16px; height: 16px; }
.tr-vol-slider {
    -webkit-appearance: none; appearance: none;
    flex: 1; height: 3px; border-radius: 2px; outline: none; cursor: pointer;
    background: linear-gradient(to right, var(--tr-red) 50%, rgba(255,255,255,.15) 50%);
}
.tr-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.5); cursor: pointer;
}
.tr-vol-pct {
    font-family: 'Orbitron', monospace; font-size: 10px;
    color: var(--tr-dim); min-width: 32px; text-align: right;
}

/* EQ bars */
.tr-eq-wrap { display: flex; align-items: flex-end; gap: 3px; height: 32px; width: 100%; }
.tr-eq-b {
    flex: 1; min-width: 2px; border-radius: 1px 1px 0 0; height: 4px;
    background: linear-gradient(to top, rgba(255,255,255,.9), rgba(255,255,255,.3));
    animation: tr-eq-idle 2s ease-in-out infinite alternate;
}
.tr-eq-b:nth-child(odd)  { animation-duration: 0.9s; }
.tr-eq-b:nth-child(3n)   { animation-duration: 1.4s; }
.tr-eq-b:nth-child(4n)   { animation-duration: 0.7s; }
@keyframes tr-eq-idle { from{height:3px;opacity:.3} to{height:18px;opacity:.7} }
@keyframes tr-eq-play { from{height:4px;opacity:.7} to{height:30px;opacity:1}  }
.tr-eq-wrap.playing .tr-eq-b { animation-name: tr-eq-play; }

/* Stream error */
.tr-stream-err {
    display: none;
    font-family: 'Orbitron', monospace; font-size: 10px;
    color: #ff5555; letter-spacing: 2px; text-align: center; padding: 6px;
}

/* Hidden SAM widgets */
.tr-sam-hidden {
    position: fixed; left: -9999px; top: 0;
    width: 400px; height: 200px; overflow: hidden;
    pointer-events: none;
}

/* ── MOBILE STICKY BAR ── */
.tr-sticky-bar {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
    background: rgba(8,8,8,.97);
    border-top: 1px solid var(--tr-border);
    backdrop-filter: blur(20px);
    padding: 10px 20px 14px;
    flex-direction: column; gap: 8px;
}
.tr-sticky-row { display: flex; align-items: center; gap: 12px; }
.tr-sticky-art {
    width: 44px; height: 44px; border-radius: 6px;
    overflow: hidden; flex-shrink: 0; background: #1a1a1a;
    position: relative;
}
.tr-sticky-art img { width: 100%; height: 100%; object-fit: cover; }
.tr-sticky-meta  { flex: 1; min-width: 0; }
.tr-sticky-title  {
    font-family: 'Bebas Neue', sans-serif; font-size: 16px; letter-spacing: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff;
}
.tr-sticky-artist {
    font-size: 11px; font-weight: 600; color: var(--tr-red); letter-spacing: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-sticky-time {
    font-family: 'Orbitron', monospace; font-size: 12px;
    color: rgba(255,255,255,.5); flex-shrink: 0;
}
.tr-sticky-play {
    width: 44px; height: 44px; border-radius: 50%; border: none; flex-shrink: 0;
    background: linear-gradient(135deg, var(--tr-red), #aa0000);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.tr-sticky-play svg { width: 18px; height: 18px; pointer-events: none; }
.tr-sticky-prog { width: 100%; height: 2px; background: rgba(255,255,255,.1); border-radius: 1px; }
.tr-sticky-prog-fill {
    height: 100%; width: 0%;
    background: var(--tr-red); border-radius: 1px;
    transition: width 1s linear;
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
    .tr-hero-inner   { gap: 30px; }
    .tr-speaker-wrap { width: 200px; height: 200px; }
}
@media (max-width: 800px) {
    .tr-hero-inner   { grid-template-columns: 1fr; justify-items: center; gap: 20px; padding: 20px 20px 80px; }
    .tr-speaker-col  { display: none; }
    .tr-sticky-bar   { display: flex; }
}
@media (max-width: 480px) {
    .tr-now-playing-label { font-size: 28px; }
    .tr-art-wrap          { width: 180px; height: 180px; }
}

/* ============================================================
   MINI PLAYER
   ============================================================ */
.tharadio-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(5,5,5,.9);
    backdrop-filter: blur(20px);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.06);
    min-width: 240px;
    max-width: 400px;
}
.tr-mini-art-wrap {
    width: 44px; height: 44px;
    border-radius: 6px; overflow: hidden;
    background: #1a1a1a; flex-shrink: 0;
    position: relative;
}
.tr-mini-art {
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity .5s;
}
.tr-mini-art.loaded { opacity: 1; }
.tr-mini-art-placeholder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
}
.tr-mini-art-placeholder svg { width: 20px; height: 20px; opacity: .2; }
.tr-mini-meta  { flex: 1; min-width: 0; }
.tr-mini-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 15px; letter-spacing: 1px; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-mini-artist {
    display: flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600; letter-spacing: 1px;
    color: #e02020; text-transform: uppercase;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-mini-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: #e02020; box-shadow: 0 0 6px #e02020; flex-shrink: 0;
    animation: tr-live-blink 1.2s ease-in-out infinite;
}
.tr-mini-play-btn {
    width: 36px; height: 36px; border-radius: 50%; border: none; flex-shrink: 0;
    background: linear-gradient(135deg, #e02020, #aa0000);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 16px rgba(220,30,30,.4);
    transition: all .2s;
}
.tr-mini-play-btn:hover  { transform: scale(1.1); }
.tr-mini-play-btn:active { transform: scale(0.95); }
.tr-mini-play-btn svg    { width: 14px; height: 14px; pointer-events: none; }

/* ============================================================
   SITE-WIDE DYNAMIC BACKGROUND
   Applied to body when mini player is on non-hero pages
   ============================================================ */

/* Injected pseudo-element carries the blurred gradient */
body.tr-bg-active::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: var(--tr-page-bg-img, none);
    background-size: cover;
    background-position: center top;
    filter: blur(80px) brightness(0.22) saturate(2);
    transform: scale(1.15); /* prevent blur edge bleed */
    transition: opacity 1.5s ease;
    opacity: 1;
}

/* Solid dark fallback behind the blur */
body.tr-bg-active {
    background-color: #050505;
    transition: background-color 1.5s ease;
}

/* When art changes, fade out then back in */
body.tr-bg-fade::before {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* ── Beaver Builder / Beaver Themer compatibility ── */
body.tr-bg-active::before {
    z-index: -9999; /* ensure it stays behind all BB layers */
}

/* Strip BB's own background so album art shows through */
body.tr-bg-active .fl-page,
body.tr-bg-active .fl-page-content,
body.tr-bg-active .fl-content,
body.tr-bg-active .fl-page-bg-photo,
body.tr-bg-active .fl-page-bg-overlay {
    background-color: transparent !important;
    background-image: none !important;
}

/* Transparent header for Themer */
body.tr-bg-active .fl-builder-content[data-type="header"],
body.tr-bg-active .fl-theme-builder-header {
    background: transparent !important;
}
