/* ==========================================================================
   LNM Radio — Shortcode [lnm_radio]
   ========================================================================== */

.lnm-radio-app {
    --radio-red:    #e53935;
    --radio-red-dk: #b71c1c;
    --radio-dark:   #1a1a2e;
    --radio-mid:    #16213e;
    --radio-border: #e2e8f0;
    --radio-bg:     #f8f9fc;
    --radio-white:  #ffffff;
    --radio-text:   #1e293b;
    --radio-muted:  #64748b;
    --radio-light:  #f1f5f9;
    --radio-accent: #6366f1;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: var(--radio-text);
    background: var(--radio-bg);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--radio-border);
    box-shadow: 0 4px 32px rgba(0,0,0,0.09);
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

/* ── Reset ──────────────────────────────────────────────────── */
.lnm-radio-app *, .lnm-radio-app *::before, .lnm-radio-app *::after {
    box-sizing: border-box;
}
.lnm-radio-app button { cursor: pointer; }
.lnm-radio-app a { text-decoration: none; }
.lnm-radio-app h4 {
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--radio-muted);
}

/* ── Header ─────────────────────────────────────────────────── */
.lnm-radio-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 24px;
    background: var(--radio-white);
    border-bottom: 1px solid var(--radio-border);
    flex-shrink: 0;
}

.lnm-radio-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 17px;
    font-weight: 600;
    color: var(--radio-dark);
    white-space: nowrap;
    flex-shrink: 0;
}
.lnm-radio-logo strong { color: var(--radio-red); }
.lnm-radio-logo-icon { font-size: 20px; }

.lnm-radio-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--radio-light);
    border: 1px solid var(--radio-border);
    border-radius: 10px;
    overflow: visible;
    flex: 1;
    max-width: 420px;
    margin-left: auto;
}
.lnm-radio-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--radio-text);
    outline: none;
    min-width: 0;
}
.lnm-radio-search-input::placeholder { color: var(--radio-muted); }
.lnm-radio-search-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    color: var(--radio-muted);
    display: flex;
    align-items: center;
}
.lnm-radio-search-btn:hover { color: var(--radio-red); }

.lnm-radio-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--radio-white);
    border: 1px solid var(--radio-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
    z-index: 500;
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
}

/* ── Body grid ───────────────────────────────────────────────── */
.lnm-radio-body {
    display: grid;
    grid-template-columns: 230px 1fr 268px;
    flex: 1;
    overflow: hidden;
}

/* ── Left sidebar ───────────────────────────────────────────── */
.lnm-radio-left {
    background: var(--radio-white);
    border-right: 1px solid var(--radio-border);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 14px;
    overflow-y: auto;
    max-height: 580px;
}

/* Nav tabs */
.lnm-radio-nav {
    display: flex;
    gap: 3px;
    background: var(--radio-light);
    border-radius: 10px;
    padding: 3px;
    flex-shrink: 0;
}
.lnm-radio-nav-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 7px 5px;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 600;
    color: var(--radio-muted);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lnm-radio-nav-btn.active {
    background: var(--radio-white);
    color: var(--radio-dark);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Stats box */
.lnm-radio-stats-box {
    background: var(--radio-light);
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid var(--radio-border);
    flex-shrink: 0;
}
.lnm-radio-stats-nums { display: flex; gap: 20px; }
.lnm-radio-stat { display: flex; flex-direction: column; gap: 2px; }
.lnm-radio-stat-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--radio-dark);
    line-height: 1;
}
.lnm-radio-stat-label {
    font-size: 8px;
    font-weight: 700;
    color: var(--radio-muted);
    letter-spacing: 0.6px;
}

/* ── Station rows (shared) ───────────────────────────────────── */
.lnm-radio-station-list { display: flex; flex-direction: column; gap: 2px; }

.lnm-radio-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.14s;
    position: relative;
}
.lnm-radio-row:hover { background: var(--radio-light); }
.lnm-radio-row.playing {
    background: #eff6ff;
    border-left: 3px solid var(--radio-red);
    padding-left: 6px;
}
.lnm-radio-row-flag { font-size: 20px; flex-shrink: 0; line-height: 1; }
.lnm-radio-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.lnm-radio-row-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--radio-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lnm-radio-row-sub {
    font-size: 10px;
    color: var(--radio-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lnm-radio-row-actions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.14s;
}
.lnm-radio-row:hover .lnm-radio-row-actions,
.lnm-radio-row.playing .lnm-radio-row-actions { opacity: 1; }

.lnm-radio-fav-btn,
.lnm-radio-play-row-btn {
    background: none;
    border: none;
    padding: 4px 5px;
    border-radius: 5px;
    font-size: 13px;
    color: var(--radio-muted);
    transition: background 0.14s, color 0.14s;
    line-height: 1;
}
.lnm-radio-fav-btn:hover { background: #fee2e2; color: var(--radio-red); }
.lnm-radio-fav-btn.active { color: var(--radio-red); opacity: 1; }
.lnm-radio-play-row-btn:hover { background: var(--radio-light); color: var(--radio-text); }

.lnm-radio-loading {
    font-size: 12px;
    color: var(--radio-muted);
    padding: 10px 8px;
    font-style: italic;
}
.lnm-radio-empty {
    font-size: 12px;
    color: var(--radio-muted);
    padding: 10px 8px;
    font-style: italic;
    line-height: 1.5;
}

/* ── Center (3D Globe) ───────────────────────────────────────── */
.lnm-radio-center {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    overflow: hidden;
    background: #0a0f1e;
}

/* Globe container fills the center panel */
.lnm-radio-globe-container {
    flex: 1;
    width: 100%;
    min-height: 480px;
    position: relative;
    z-index: 0;
    overflow: hidden;
}

/* Loading overlay */
.lnm-radio-globe-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #0a0f1e;
    color: #94a3b8;
    font-size: 12px;
    pointer-events: none;
    z-index: 500;
}

/* Spinner (shared with loading overlays) */
.lnm-radio-globe-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(100,140,220,0.2);
    border-top-color: #e53935;
    border-radius: 50%;
    animation: lnm-radio-spin 0.8s linear infinite;
}
@keyframes lnm-radio-spin { to { transform: rotate(360deg); } }

/* ── Station list panel (appears when a cluster is clicked) ─── */
.lnm-globe-station-panel {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 250px;
    max-height: 340px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.20), 0 2px 8px rgba(0,0,0,0.10);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.07);
    animation: lnm-panel-pop 0.18s ease-out;
}
@keyframes lnm-panel-pop {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);   }
}
.lnm-globe-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px 10px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    flex-shrink: 0;
}
.lnm-globe-panel-title {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
}
.lnm-globe-panel-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
    line-height: 1;
}
.lnm-globe-panel-close:hover { background: rgba(255,255,255,0.30); }
.lnm-globe-panel-list {
    overflow-y: auto;
    flex: 1;
    padding: 6px 0;
}
.lnm-globe-panel-list::-webkit-scrollbar { width: 4px; }
.lnm-globe-panel-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
.lnm-globe-panel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    cursor: default;
    transition: background 0.12s;
    border-bottom: 1px solid #f8f9fa;
}
.lnm-globe-panel-item:last-child { border-bottom: none; }
.lnm-globe-panel-item:hover { background: #f8faff; }
.lnm-globe-panel-item--playing { background: #fff5f0; }
.lnm-globe-panel-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}
.lnm-globe-panel-item-flag { font-size: 18px; flex-shrink: 0; }
.lnm-globe-panel-item-text { min-width: 0; }
.lnm-globe-panel-item-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.lnm-globe-panel-item-country {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 1px;
}
.lnm-globe-panel-item-play {
    background: #e53935;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 10px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.12s;
}
.lnm-globe-panel-item-play:hover { background: #b71c1c; transform: scale(1.1); }
.lnm-globe-panel-item-play.active { background: #ff6b35; }
.lnm-globe-panel-more {
    padding: 8px 12px;
    font-size: 10px;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
}

/* ── D3 Globe cluster circles + single-station pins ─────────── */
/* These are SVG elements — pointer-events are native DOM events */
.lnm-globe-cluster { /* styled via JS d3 attr calls */ }
.lnm-globe-pin     { /* styled via JS d3 attr calls */ }

/* Footer bar: wave + hint */
.lnm-radio-center-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 16px;
    background: #0d1320;
    border-top: 1px solid #1e2d45;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.lnm-radio-center-hint {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
}

/* Wave bars */
.lnm-radio-wave-bars {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 28px;
    flex-shrink: 0;
}
.lnm-radio-wave-bar {
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(to top, #e53935, #ef9a9a);
    animation: lnm-radio-wave calc(0.55s + var(--i) * 0.04s) ease-in-out infinite alternate;
    opacity: 0.8;
    min-height: 3px;
}
.lnm-radio-wave-bars.paused .lnm-radio-wave-bar {
    animation-play-state: paused;
    height: 4px !important;
}
@keyframes lnm-radio-wave {
    from { height: 4px; }
    to   { height: 24px; }
}

/* ── Right sidebar ───────────────────────────────────────────── */
.lnm-radio-right {
    background: var(--radio-white);
    border-left: 1px solid var(--radio-border);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 14px;
    overflow-y: auto;
    max-height: 580px;
}

/* Country box */
.lnm-radio-country-box {
    background: var(--radio-light);
    border-radius: 12px;
    padding: 12px 12px 10px;
    border: 1px solid var(--radio-border);
}
.lnm-radio-country-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.lnm-radio-country-emoji { font-size: 22px; flex-shrink: 0; }
.lnm-radio-country-select {
    flex: 1;
    border: 1px solid var(--radio-border);
    border-radius: 7px;
    padding: 6px 8px;
    font-size: 12px;
    background: var(--radio-white);
    color: var(--radio-text);
    cursor: pointer;
    min-width: 0;
}
.lnm-radio-country-select:focus { outline: 2px solid var(--radio-accent); }

/* Country station cards */
.lnm-radio-country-stations { display: flex; flex-direction: column; gap: 6px; }

.lnm-radio-cstation {
    background: var(--radio-white);
    border: 1px solid var(--radio-border);
    border-radius: 9px;
    padding: 10px 11px;
    cursor: pointer;
    transition: border-color 0.14s, box-shadow 0.14s;
}
.lnm-radio-cstation:hover,
.lnm-radio-cstation.playing {
    border-color: var(--radio-red);
    box-shadow: 0 2px 10px rgba(229,57,53,0.12);
}
.lnm-radio-cstation-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}
.lnm-radio-cstation-flag { font-size: 18px; flex-shrink: 0; }
.lnm-radio-cstation-info { flex: 1; min-width: 0; }
.lnm-radio-cstation-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--radio-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.lnm-radio-cstation-sub {
    font-size: 10px;
    color: var(--radio-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.lnm-radio-live-dot {
    background: var(--radio-red);
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    animation: lnm-radio-blink 2s ease-in-out infinite;
}
@keyframes lnm-radio-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}
.lnm-radio-cstation-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 6px 10px;
    background: var(--radio-red);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    transition: background 0.14s;
}
.lnm-radio-cstation-play-btn:hover { background: var(--radio-red-dk); }
.lnm-radio-cstation.playing .lnm-radio-cstation-play-btn {
    background: #1d4ed8;
}
.lnm-radio-cstation.playing .lnm-radio-cstation-play-btn:hover { background: #1e40af; }

/* Most listened */
.lnm-radio-most-box h4 { margin-bottom: 10px; }

/* ── Now Playing bar ────────────────────────────────────────── */
.lnm-radio-player {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--radio-dark);
    border-top: 2px solid var(--radio-red);
    flex-shrink: 0;
}
.lnm-radio-player-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.lnm-radio-player-flag { font-size: 26px; flex-shrink: 0; }
.lnm-radio-player-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.lnm-radio-now-label {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.lnm-radio-player-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lnm-radio-player-loc {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lnm-radio-player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.lnm-radio-ctrl-btn {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.14s;
}
.lnm-radio-play-btn {
    background: var(--radio-red);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 7px;
}
.lnm-radio-play-btn:hover { background: var(--radio-red-dk); }
.lnm-radio-live-pill {
    background: rgba(255,255,255,0.22);
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 1px;
}
.lnm-radio-stop-btn {
    background: rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px 12px;
    font-size: 15px;
}
.lnm-radio-stop-btn:hover { background: rgba(255,255,255,0.2); }
.lnm-radio-vol-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255,255,255,0.5);
}
.lnm-radio-vol-wrap input[type="range"] {
    width: 80px;
    cursor: pointer;
    accent-color: var(--radio-red);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 960px) {
    /* Stack: globe first, then left sidebar, then right sidebar */
    .lnm-radio-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .lnm-radio-center {
        display: flex;
        order: 1;
    }
    .lnm-radio-globe-container { min-height: 340px; }
    .lnm-radio-left {
        order: 2;
        max-height: 260px;
        border-right: none;
        border-bottom: 1px solid var(--radio-border);
    }
    .lnm-radio-right {
        order: 3;
        border-left: none;
        border-top: 1px solid var(--radio-border);
        max-height: 260px;
    }
}
@media (max-width: 620px) {
    .lnm-radio-globe-container { min-height: 280px; }
    /* Station panel: full-width on small screens */
    .lnm-globe-station-panel {
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
    }
    /* Bigger touch targets in the station panel list */
    .lnm-globe-panel-item { padding: 11px 12px; }
    .lnm-globe-panel-item-play { width: 36px; height: 36px; font-size: 12px; }
    .lnm-radio-header { flex-wrap: wrap; order: 1; }
    .lnm-radio-player { order: 2; flex-direction: column; gap: 12px; align-items: stretch; }
    .lnm-radio-body   { order: 3; }
    .lnm-radio-search-wrap { max-width: 100%; width: 100%; }
    .lnm-radio-player-left { min-width: 0; }
    .lnm-radio-player-controls { justify-content: center; }
}
