/* ============================================================
   RadiosLatinas v2 — tema maestro (Bootstrap 5.3 + variables)
   Marca: morado #5b3fd6. Fondo limpio, protagonismo de logos.
   ============================================================ */
:root, [data-bs-theme=light], [data-bs-theme=dark] {
  --bs-primary: #5b3fd6; --bs-primary-rgb: 91, 63, 214;
  --bs-link-color: #5b3fd6; --bs-link-color-rgb: 91, 63, 214;
  --bs-link-hover-color: #472fb0; --bs-link-hover-color-rgb: 71, 47, 176;
  --rl-primary-dark: #472fb0;
  --rl-radius: 14px;
  --rl-player-h: 84px;
  --rl-tabbar-h: 62px;
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-bs-theme=light] {
  --bs-body-bg: #fafafc; --bs-body-color: #1a1a2e;
  --rl-surface: #ffffff; --rl-border: #e8e8f0; --rl-muted: #6b6b80;
}
[data-bs-theme=dark] {
  --bs-body-bg: #0f1016; --bs-body-color: #ececf3;
  --rl-surface: #181925; --rl-border: #262838; --rl-muted: #9a9bb0;
}
.btn-primary { --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: var(--rl-primary-dark); --bs-btn-hover-border-color: var(--rl-primary-dark); --bs-btn-active-bg: var(--rl-primary-dark); --bs-btn-active-border-color: var(--rl-primary-dark); --bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary); }
.btn-outline-primary { --bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary); --bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary); }
.btn-outline-secondary.active { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--bs-primary); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .18); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-primary); }
.btn { border-radius: 10px; font-weight: 600; }
.btn-icon { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: transparent; border: 0; color: var(--bs-body-color); font-size: 1.15rem; }
.btn-icon:hover { background: rgba(var(--bs-primary-rgb), .1); color: var(--bs-primary); }
.btn-light { --bs-btn-bg: var(--rl-surface); --bs-btn-border-color: var(--rl-border); --bs-btn-color: var(--bs-body-color); --bs-btn-hover-bg: rgba(var(--bs-primary-rgb), .08); --bs-btn-hover-border-color: var(--rl-border); }
.form-control, .form-select { border-radius: 10px; border-color: var(--rl-border); background: var(--rl-surface); }
.card { border-color: var(--rl-border); border-radius: var(--rl-radius); background: var(--rl-surface); }

body.rl-front { padding-bottom: var(--rl-player-h); }
@media (max-width: 991.98px) { body.rl-front { padding-bottom: calc(var(--rl-tabbar-h) + var(--rl-player-h)); } }

/* ---------- Header ---------- */
.rl-header { position: sticky; top: 0; z-index: 1030; background: var(--rl-surface); border-bottom: 1px solid var(--rl-border); }
.rl-header-row { display: flex; align-items: center; gap: 16px; padding: 12px 24px; max-width: 1400px; margin: 0 auto; }
.rl-header-search { padding-top: 0; padding-bottom: 14px; }
.rl-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--bs-body-color); flex-shrink: 0; }
.rl-brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--bs-primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.rl-brand-text { font-size: 1.45rem; font-weight: 500; letter-spacing: -.02em; }
.rl-brand-text b { font-weight: 800; }
.rl-nav { gap: 8px; flex: 1; }
.rl-nav a { padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--bs-body-color); font-weight: 600; font-size: .98rem; }
.rl-nav a:hover { background: rgba(var(--bs-primary-rgb), .08); color: var(--bs-primary); }
.rl-nav a.active { color: var(--bs-primary); box-shadow: inset 0 -3px 0 var(--bs-primary); border-radius: 0; }
.rl-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.rl-avatar-btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 30px; }
.rl-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.rl-search { flex: 1; max-width: 860px; margin: 0 auto; position: relative; }
.rl-search i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--rl-muted); font-size: 1.1rem; }
.rl-search input { width: 100%; height: 50px; border-radius: 12px; border: 1px solid var(--rl-border); background: var(--bs-body-bg); padding: 0 16px 0 46px; font-size: 1rem; color: var(--bs-body-color); }
.rl-search input:focus { outline: none; border-color: var(--bs-primary); box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), .12); background: var(--rl-surface); }
.rl-tagline { color: var(--rl-muted); text-align: right; line-height: 1.25; font-size: .95rem; }

/* ---------- Shell: sidebar + main ---------- */
.rl-shell { display: flex; max-width: 1400px; margin: 0 auto; min-height: 60vh; }
.rl-sidebar { width: 210px; flex-shrink: 0; padding: 22px 12px 40px 18px; border-right: 1px solid var(--rl-border); position: sticky; top: 132px; align-self: flex-start; max-height: calc(100vh - 132px - var(--rl-player-h)); overflow-y: auto; }
.rl-side-title { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--rl-muted); margin: 18px 10px 8px; }
.rl-side-title:first-child { margin-top: 0; }
.rl-side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--bs-body-color); font-size: .95rem; }
.rl-side-link i { color: var(--rl-muted); width: 20px; text-align: center; }
.rl-side-link:hover { background: rgba(var(--bs-primary-rgb), .08); color: var(--bs-primary); }
.rl-side-link.active { background: rgba(var(--bs-primary-rgb), .12); color: var(--bs-primary); font-weight: 600; }
.rl-side-link.active i { color: var(--bs-primary); }
.rl-side-more { font-size: .85rem; color: var(--bs-primary); }
.rl-flag { font-size: 1.1rem; width: 20px; text-align: center; }
.rl-main { flex: 1; min-width: 0; padding: 26px 28px 40px; }
@media (max-width: 767.98px) { .rl-main { padding: 16px 14px 30px; } .rl-header-row { padding: 10px 14px; gap: 10px; } .rl-search input { height: 44px; } }

/* ---------- Hero / secciones ---------- */
.rl-hero h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -.03em; margin: 0 0 4px; }
.rl-hero p { color: var(--rl-muted); font-size: 1.1rem; margin-bottom: 14px; }
.rl-hero-sm h1 { font-size: 1.7rem; }
@media (max-width: 767.98px) { .rl-hero h1 { font-size: 1.7rem; } .rl-hero-sm h1 { font-size: 1.35rem; } }
.rl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.rl-chips-sm { margin-top: -8px; }
.rl-chips-sm .rl-chip { padding: 5px 12px; font-size: .85rem; }
.rl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--rl-border); background: var(--rl-surface); color: var(--bs-body-color); text-decoration: none; font-weight: 600; font-size: .92rem; white-space: nowrap; }
.rl-chip:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.rl-chip.active { background: rgba(var(--bs-primary-rgb), .12); border-color: var(--bs-primary); color: var(--bs-primary); }
.rl-chip-sm { padding: 4px 10px; font-size: .82rem; border-radius: 8px; }
.rl-dropdown-scroll { max-height: 320px; overflow-y: auto; }
.rl-section { margin-top: 26px; }
.rl-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.rl-section-head h2 { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.rl-section-head > a { font-weight: 700; text-decoration: none; }

/* ---------- Grid de emisoras ---------- */
.rl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 16px; }
@media (max-width: 767.98px) { .rl-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; } }
.rl-card { min-width: 0; }
.rl-card-cover { position: relative; display: block; aspect-ratio: 1; border-radius: var(--rl-radius); overflow: hidden; background: var(--rl-surface); border: 1px solid var(--rl-border); }
.rl-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.rl-card:hover .rl-card-cover img { transform: scale(1.04); }
.rl-card-play { position: absolute; right: 8px; bottom: 8px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0,0,0,.72); color: #fff; font-size: 1.25rem; display: flex; align-items: center; justify-content: center; transition: background .2s, transform .2s; }
.rl-card-play:hover { background: var(--bs-primary); transform: scale(1.08); }
.rl-card.is-playing .rl-card-cover { outline: 3px solid var(--bs-primary); outline-offset: 2px; }
.rl-card.is-playing .rl-card-play { background: var(--bs-primary); }
.rl-card-body { display: flex; align-items: flex-start; gap: 6px; padding-top: 9px; }
.rl-card-text { min-width: 0; flex: 1; }
.rl-card-name { display: block; font-weight: 700; font-size: .95rem; color: var(--bs-body-color); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-card-name:hover { color: var(--bs-primary); }
.rl-card-sub { font-size: .82rem; color: var(--rl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-fav { border: 0; background: transparent; color: var(--rl-muted); font-size: 1.15rem; padding: 0 2px; line-height: 1; }
.rl-fav:hover, .rl-fav.is-on { color: #e0356b; }
.btn.rl-fav { color: var(--bs-primary); }
.btn.rl-fav.is-on { background: #fde8ef; border-color: #e0356b; color: #e0356b; }

/* ---------- Géneros ---------- */
.rl-genre-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.rl-genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
@media (max-width: 767.98px) { .rl-genre-row, .rl-genre-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.rl-genre { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px; border-radius: 12px; background: var(--g, var(--bs-primary)); color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; transition: filter .2s, transform .2s; }
.rl-genre:hover { color: #fff; filter: brightness(1.08); transform: translateY(-2px); }
.rl-genre small { opacity: .8; font-weight: 600; }
@media (max-width: 767.98px) { .rl-genre { padding: 16px 14px; font-size: 1rem; } }

/* ---------- Tiles países ---------- */
.rl-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
@media (max-width: 767.98px) { .rl-tiles { grid-template-columns: repeat(2, 1fr); } }
.rl-tile { display: flex; flex-direction: column; align-items: center; padding: 20px 10px; border-radius: 14px; background: var(--rl-surface); border: 1px solid var(--rl-border); text-decoration: none; color: var(--bs-body-color); transition: border-color .2s, transform .2s; }
.rl-tile:hover { border-color: var(--bs-primary); transform: translateY(-2px); }
.rl-tile.is-empty { opacity: .55; }
.rl-tile-flag { font-size: 2.2rem; line-height: 1; margin-bottom: 8px; }
.rl-tile-name { font-weight: 700; }
.rl-tile-count { font-size: .8rem; color: var(--rl-muted); }

/* ---------- Perfil de emisora ---------- */
.rl-breadcrumb { font-size: .85rem; color: var(--rl-muted); margin-bottom: 12px; }
.rl-breadcrumb a { text-decoration: none; color: var(--rl-muted); }
.rl-station-hero { display: flex; gap: 22px; align-items: flex-start; padding: 24px; border-radius: 18px; background: var(--rl-surface); border: 1px solid var(--rl-border); position: relative; overflow: hidden; }
.rl-station-hero[style*="--cover"]::before { content: ""; position: absolute; inset: 0; background: var(--cover) center/cover; opacity: .18; filter: blur(12px); }
.rl-station-hero > * { position: relative; }
.rl-station-logo { width: 180px; height: 180px; border-radius: 16px; object-fit: cover; border: 1px solid var(--rl-border); flex-shrink: 0; background: var(--rl-surface); }
.rl-station-info { min-width: 0; flex: 1; }
.rl-station-info h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.rl-station-sub { color: var(--rl-muted); }
.rl-station-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.rl-station-stats { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; font-size: .88rem; color: var(--rl-muted); }
@media (max-width: 767.98px) { .rl-station-hero { flex-direction: column; align-items: center; text-align: center; padding: 18px; } .rl-station-logo { width: 150px; height: 150px; } .rl-station-actions, .rl-station-stats, .rl-station-hero .rl-chips { justify-content: center; } .rl-station-info h1 { font-size: 1.5rem; } .rl-btn-play { width: 100%; } }
.rl-station-cols { display: grid; grid-template-columns: 1fr 320px; gap: 22px; margin-top: 22px; }
@media (max-width: 991.98px) { .rl-station-cols { grid-template-columns: 1fr; } }
.rl-box { padding: 20px; border-radius: 16px; background: var(--rl-surface); border: 1px solid var(--rl-border); margin-bottom: 18px; }
.rl-box h2 { font-size: 1.1rem; font-weight: 800; margin: 0 0 12px; }
.rl-prose { line-height: 1.65; }
.rl-onair { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px; background: rgba(var(--bs-primary-rgb), .1); border: 1px solid rgba(var(--bs-primary-rgb), .3); margin-bottom: 18px; }
.rl-live { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 800; letter-spacing: .06em; color: #1aa251; }
.rl-live i { font-size: .55rem; animation: rl-pulse 1.4s infinite; }
@keyframes rl-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
.rl-programs { display: flex; flex-direction: column; gap: 8px; }
.rl-program { display: flex; gap: 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rl-border); }
.rl-program.is-live { border-color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), .06); }
.rl-program-time { font-weight: 800; min-width: 52px; line-height: 1.15; color: var(--bs-primary); }
.rl-program-time small { display: block; font-weight: 500; color: var(--rl-muted); }
.rl-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.rl-member { display: flex; gap: 12px; align-items: flex-start; }
.rl-member img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

/* ---------- Estado vacío, CTA, footer ---------- */
.rl-empty { text-align: center; padding: 50px 20px; color: var(--rl-muted); }
.rl-empty i { font-size: 3rem; color: var(--bs-primary); opacity: .5; }
.rl-empty-lg { padding: 90px 20px; }
.rl-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 34px; padding: 26px 28px; border-radius: 18px; background: linear-gradient(135deg, var(--bs-primary), #8b5cf6); color: #fff; }
.rl-cta h3 { font-weight: 800; margin: 0 0 4px; }
.rl-cta p { margin: 0; opacity: .9; }
.rl-cta .btn-primary { background: #fff; color: var(--bs-primary); border-color: #fff; }
.rl-footer { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--rl-border); font-size: .85rem; color: var(--rl-muted); }
.rl-footer a { color: var(--rl-muted); text-decoration: none; }
.rl-footer a:hover { color: var(--bs-primary); }

/* ---------- Reproductor fijo ---------- */
.rl-player { position: fixed; left: 0; right: 0; bottom: 0; height: var(--rl-player-h); z-index: 1040; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding: 0 24px; background: var(--rl-surface); border-top: 1px solid var(--rl-border); box-shadow: 0 -6px 24px rgba(0,0,0,.06); }
.rl-player[hidden] { display: none; }
.rl-player-station { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--bs-body-color); min-width: 0; }
.rl-player-logo { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; border: 1px solid var(--rl-border); }
.rl-player-meta { min-width: 0; }
.rl-player-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-player-sub { font-size: .82rem; color: var(--rl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-player-center { display: flex; align-items: center; gap: 22px; }
.rl-play-big { width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--bs-primary); color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(var(--bs-primary-rgb), .35); transition: transform .15s; }
.rl-play-big:hover { transform: scale(1.05); }
.rl-play-big.is-loading i { animation: rl-spin 1s linear infinite; }
@keyframes rl-spin { to { transform: rotate(360deg) } }
.rl-player-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.rl-volume { width: 170px; }
.rl-volume::-webkit-slider-thumb { background: var(--bs-primary); }
.rl-volume::-moz-range-thumb { background: var(--bs-primary); }
.rl-player.is-error .rl-live { color: #d33; }
.rl-player.is-error .rl-live i { animation: none; }
@media (max-width: 991.98px) {
  .rl-player { bottom: var(--rl-tabbar-h); height: 72px; grid-template-columns: 1fr auto; padding: 0 12px; gap: 8px; box-shadow: none; }
  .rl-player-center { gap: 10px; }
  .rl-player-center .rl-live { font-size: .68rem; }
  .rl-play-big { width: 52px; height: 52px; font-size: 1.7rem; }
  .rl-player-right { display: none; }
  .rl-player-logo { width: 48px; height: 48px; }
}

/* ---------- Tab bar móvil ---------- */
.rl-tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--rl-tabbar-h); z-index: 1041; display: flex; background: var(--rl-surface); border-top: 1px solid var(--rl-border); padding-bottom: env(safe-area-inset-bottom); }
.rl-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--rl-muted); font-size: .7rem; font-weight: 600; }
.rl-tabbar a i { font-size: 1.35rem; }
.rl-tabbar a.active { color: var(--bs-primary); }

/* ---------- Página cargando (pjax) ---------- */
.rl-main.is-loading { opacity: .5; pointer-events: none; transition: opacity .15s; }

/* ---------- Banderas (flag-icons) ---------- */
.rl-flag-img { width: 22px; height: 16.5px; border-radius: 3px; object-fit: cover; vertical-align: -3px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.rl-tile-flag .rl-flag-img { width: 56px; height: 42px; border-radius: 6px; }
.rl-side-link .rl-flag-img { width: 20px; height: 15px; }
.rl-flag-lg { width: 40px; height: 30px; vertical-align: -4px; }

/* Logo con color de fondo propio (BD antigua) */
.rl-card-cover.has-bg img { object-fit: contain; padding: 6%; }
.rl-station-logo.has-bg { object-fit: contain; padding: 10px; }
.rl-rating { color: #f5a623; }
.rl-tv-modal video { width: 100%; background: #000; border-radius: 12px; aspect-ratio: 16/9; }
