/* ============================ BASE / TEMA BRASIL 61 ============================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --amarelo: #FFAF38;
  --cinza: #2F2F2F;
  --cinza-2: #262626;
  --cinza-3: #1c1c1c;
  --fg: #f4f4f4;
  --muted: #9a9a9a;
  --border: rgba(255, 255, 255, 0.08);
  --panel-w: 360px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
html, body { height: 100%; background: #000; color: var(--fg); overflow: hidden; }
svg { fill: currentColor; }
button { font-family: inherit; }

/* ============================ LOADER ============================ */
.loader {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; background: var(--cinza); transition: opacity .5s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
.loader-logo { width: 190px; height: auto; }
.loader-spin {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(255, 175, 56, 0.2); border-top-color: var(--amarelo);
  animation: spin 0.9s linear infinite;
}
.loader p { color: var(--muted); font-size: 13px; letter-spacing: .03em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ MAPA ============================ */
.map { position: fixed; inset: 0; z-index: 1; background: #0a0f14; }
/* Atribuição do mapa mais discreta e legível sobre satélite */
.maplibregl-ctrl-attrib { font-size: 10px; background: rgba(0,0,0,0.55) !important; }
.maplibregl-ctrl-attrib a { color: #cfcfcf !important; }
.maplibregl-ctrl-bottom-right { z-index: 5; }

/* ============================ RETÍCULA (círculo central fixo) ============================ */
.reticle {
  position: fixed; top: 50%; left: calc(50% + var(--panel-w) / 2);
  transform: translate(-50%, -50%); z-index: 10; pointer-events: none;
}
.reticle-ring {
  width: 74px; height: 74px; border-radius: 50%;
  border: 2px solid var(--amarelo);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35), 0 0 22px rgba(255,175,56,0.55);
  animation: retpulse 2.4s ease-in-out infinite;
}
@keyframes retpulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: .8; }
}
.reticle-dot {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 6px; height: 6px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.9);
}

/* Dica de 1º acesso (mostrada via JS só no mobile) */
.dica-inicial {
  display: none; position: fixed; z-index: 29;
  left: 50%; top: 61%; transform: translateX(-50%);
  background: var(--amarelo); color: var(--cinza); pointer-events: none;
  font-weight: 700; font-size: 13px; padding: 9px 16px; border-radius: 999px;
  box-shadow: var(--shadow); white-space: nowrap;
  animation: dicaPulse 1.7s ease-in-out infinite;
}
@keyframes dicaPulse {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

/* ============================ PAINEL ============================ */
.panel {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 20;
  width: var(--panel-w); max-width: 92vw;
  background: var(--cinza); border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
}
.panel.collapsed { transform: translateX(-100%); }

.panel-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  background: var(--cinza-2);
}
.brand-logo { height: 30px; width: auto; }
.panel-top-right { display: flex; align-items: center; gap: 10px; }
.clock { color: var(--amarelo); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

/* Estrela do catálogo Brasil 61 (só na lista lateral) */
.star-inline { color: var(--amarelo); font-size: 13px; margin-right: 2px; }

.panel-place { padding: 18px 18px 12px; }
.place-head { display: flex; align-items: center; gap: 10px; }
.place-head h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.panel-place h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.panel-place p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.btn-noticias {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: rgba(255,175,56,0.15); color: var(--amarelo); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.btn-noticias:hover { background: rgba(255,175,56,0.28); }

/* Filtros (UF / tipo) */
.filtros { display: flex; gap: 8px; align-items: center; padding: 0 18px 12px; }
.filtro-sel {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 9px; cursor: pointer;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--fg);
  font-size: 13px; outline: none;
}
.filtro-sel:focus { border-color: var(--amarelo); }
.filtro-sel option { background: var(--cinza); color: var(--fg); }
.filtro-limpar {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  background: rgba(255,175,56,0.15); border: 1px solid var(--border); color: var(--amarelo);
  font-size: 14px; font-weight: 700;
}
.filtro-limpar:hover { background: rgba(255,175,56,0.28); }

.panel-scroll { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 6px 18px 8px;
}

.station-list { list-style: none; }
.station-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; cursor: pointer;
  border-left: 3px solid transparent; transition: background .15s, border-color .15s;
}
.station-item:hover { background: rgba(255,255,255,0.04); }
.station-item.active {
  background: rgba(255,175,56,0.14); border-left-color: var(--amarelo);
}
.station-logo {
  width: 38px; height: 38px; border-radius: 8px; flex-shrink: 0;
  background: rgba(255,255,255,0.08) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: var(--muted);
}
.station-body { flex: 1; min-width: 0; }
.station-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-tags { color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-dist { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.station-badge {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 6px; border-radius: 5px; flex-shrink: 0;
  background: var(--amarelo); color: var(--cinza);
}
.empty-msg { padding: 20px 18px; color: var(--muted); font-size: 13px; }

/* ============================ PLAYER ============================ */
.player {
  border-top: 1px solid var(--border); background: var(--cinza-3);
  padding: 12px 18px;
}
.player-info { min-width: 0; margin-bottom: 10px; }
.player-name { display: block; font-weight: 700; font-size: 14px; color: var(--amarelo);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-place { display: block; color: var(--muted); font-size: 12px; }
.player-controls { display: flex; align-items: center; gap: 10px; }
.pbtn {
  background: none; border: none; color: var(--fg); cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.pbtn svg { width: 22px; height: 22px; }
.pbtn:hover { background: rgba(255,255,255,0.08); }
.pbtn-main {
  width: 42px; height: 42px; background: var(--amarelo); color: var(--cinza);
}
.pbtn-main:hover { background: #ffbf5c; }
.pbtn-main.loading { animation: spin 0.9s linear infinite; }
.pbtn-main svg { width: 24px; height: 24px; }
.volume-wrap { flex: 1; display: flex; align-items: center; min-width: 40px; }
#volume { width: 100%; accent-color: var(--amarelo); cursor: pointer; }
.player-status { font-size: 11px; color: var(--amarelo); min-width: 46px; text-align: right; }

/* ============================ BUSCA ============================ */
.searchbar { position: relative; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--cinza-2); }
#search {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--fg); font-size: 13px; outline: none; transition: border-color .2s;
}
#search::placeholder { color: var(--muted); }
#search:focus { border-color: var(--amarelo); }
.search-results {
  position: absolute; bottom: calc(100% + 6px); left: 14px; right: 14px;
  background: var(--cinza); border: 1px solid var(--border); border-radius: 10px;
  max-height: 320px; overflow-y: auto; display: none; box-shadow: var(--shadow);
}
.search-results.open { display: block; }
.search-item {
  padding: 10px 14px; cursor: pointer; font-size: 13px;
  display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: rgba(255,175,56,0.14); }
.search-item .si-sub { color: var(--muted); font-size: 11px; }

/* ============================ TOGGLE PAINEL ============================ */
.panel-toggle {
  position: fixed; top: 14px; left: 14px; z-index: 30; display: none;
  width: 42px; height: 42px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--cinza); color: var(--amarelo); font-size: 18px;
  box-shadow: var(--shadow);
}

/* alça de arrastar/fechar (só no mobile) */
.panel-grab { display: none; }

/* Mini player (só mobile — regras completas na media query) */
.mini-player { display: none; }

/* ============================ RESPONSIVO (MOBILE) ============================ */
@media (max-width: 720px) {
  .reticle { left: 50%; }               /* círculo no centro da tela */
  .panel-toggle { display: block; }

  /* Painel vira "bottom sheet": sobe de baixo ao tocar no mapa */
  .panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: 100%; height: 62vh;
    border-right: none; border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
  }
  .panel.collapsed { transform: translateY(100%); }  /* fechado = desce (some) */

  .panel-grab {
    display: block; height: 20px; flex-shrink: 0; cursor: pointer; position: relative;
  }
  .panel-grab::before {
    content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 44px; height: 5px; border-radius: 999px; background: rgba(255,255,255,0.28);
  }
  .panel-top { padding-top: 6px; }

  /* Botão "sugerir" vira ícone no topo-direito (não colide com a busca) */
  .btn-sugerir { top: 11px; right: 10px; padding: 0; width: 44px; height: 44px; justify-content: center; border-radius: 12px; }
  .btn-sugerir .bs-txt { display: none; }
  .btn-sugerir .bs-ico { font-size: 24px; }

  /* (1) Busca no TOPO, ao lado do ☰ (fora da aba → mais espaço p/ a lista) */
  .searchbar.mobile-top {
    position: fixed; top: 12px; left: 64px; right: 64px; z-index: 31;
    padding: 0; margin: 0; background: transparent; border: none;
  }
  .searchbar.mobile-top #search {
    background: rgba(18,18,18,0.92); border-color: rgba(255,255,255,0.18);
    box-shadow: var(--shadow);
  }
  .searchbar.mobile-top .search-results {   /* dropdown abre PARA BAIXO */
    top: calc(100% + 6px); bottom: auto; left: 0; right: 0;
  }

  /* (2) Retícula no centro da área VISÍVEL do mapa quando a aba está aberta */
  body.sheet-aberto .reticle { top: 19%; }

  /* Arraste: o TOPO INTEIRO do painel puxa a aba (não rola a página no gesto) */
  .panel-grab, .panel-top { touch-action: none; }
  .panel-top { cursor: grab; }
  .panel.dragging { transition: none; }        /* segue o dedo sem "atraso" */

  /* ---- Mini player (aba recolhida) ---- */
  .mini-player {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 19;
    background: var(--cinza-2); border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0; box-shadow: var(--shadow);
    transform: translateY(130%); pointer-events: none;
    transition: transform .3s cubic-bezier(.22,.61,.36,1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    touch-action: none;
  }
  body.sheet-mini .mini-player { transform: translateY(0); pointer-events: auto; }
  .mini-player.dragging { transition: none; }

  .mini-grab { height: 16px; position: relative; }
  .mini-grab::before {
    content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.28);
  }
  .mini-main {
    display: flex; align-items: center; gap: 12px;
    padding: 2px 12px 12px; cursor: pointer;
  }
  .mini-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .mini-name {
    font-weight: 700; font-size: 14px; color: var(--fg, #fff);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mini-place {
    font-size: 12px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mini-toggle {
    flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: none;
    background: var(--amarelo); color: var(--cinza); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
  }
  .mini-toggle svg { width: 22px; height: 22px; fill: currentColor; }
  .mini-toggle .i-loading { animation: dicaSpin 0.8s linear infinite; }

  /* Barrinhas "equalizer" = marca (animam quando tocando) */
  .mini-eq { flex-shrink: 0; display: flex; align-items: flex-end; gap: 3px; height: 20px; }
  .mini-eq i { width: 3px; height: 7px; border-radius: 2px; background: var(--amarelo); }
  body.tocando .mini-eq i { animation: miniEq 0.9s ease-in-out infinite; }
  body.tocando .mini-eq i:nth-child(2) { animation-delay: .15s; }
  body.tocando .mini-eq i:nth-child(3) { animation-delay: .3s; }
  body.tocando .mini-eq i:nth-child(4) { animation-delay: .45s; }
  @keyframes miniEq { 0%,100% { height: 6px; } 50% { height: 18px; } }
  @keyframes dicaSpin { to { transform: rotate(360deg); } }
}

/* ============================ Botão fixo "Sugerir emissora" ============================ */
.btn-sugerir {
  position: fixed; top: 16px; right: 16px; z-index: 30; cursor: pointer; border: none;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--amarelo); color: var(--cinza); font-weight: 700; font-size: 13px;
  padding: 9px 14px; border-radius: 999px; box-shadow: var(--shadow);
}
.btn-sugerir:hover { background: #ffbf5c; }
.btn-sugerir .bs-ico { font-size: 15px; font-weight: 800; line-height: 1; }

/* ============================ CTA "sugerir" (link no dropdown) ============================ */
.cta-link {
  display: inline-block; margin-top: 6px; padding: 0; border: none; background: none;
  color: var(--amarelo); font-size: 12px; font-weight: 600; cursor: pointer; text-align: left;
}
.cta-link:hover { text-decoration: underline; }

/* ============================ MODAL SUGESTÃO ============================ */
.modal {
  position: fixed; inset: 0; z-index: 120; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
}
.modal.open { display: flex; }
.modal-card {
  position: relative; width: 100%; max-width: 420px;
  background: var(--cinza); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px 22px; box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--fg); }
.modal-card h2 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.modal-sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
#sug-form { display: flex; flex-direction: column; gap: 10px; }
#sug-form input, #sug-form select {
  width: 100%; padding: 11px 13px; border-radius: 10px; font-size: 14px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--fg); outline: none;
}
#sug-form input:focus, #sug-form select:focus { border-color: var(--amarelo); }
#sug-form input::placeholder { color: var(--muted); }
.sug-row { display: flex; gap: 10px; }
.sug-row #sug-uf { max-width: 80px; text-transform: uppercase; }
.sug-row #sug-genero { max-width: 110px; }
.sug-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sug-submit {
  margin-top: 4px; padding: 12px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--amarelo); color: var(--cinza); font-weight: 800; font-size: 14px;
}
.sug-submit:hover { background: #ffbf5c; }
.sug-submit:disabled { opacity: .6; cursor: default; }
.sug-msg { font-size: 13px; margin: 4px 0 0; min-height: 18px; }
.sug-msg.ok { color: #7CE0B0; }
.sug-msg.erro { color: #ff8a8a; }
@media (max-width: 720px) { .modal { align-items: flex-end; padding: 0; } .modal-card { max-width: 100%; border-radius: 16px 16px 0 0; } }

/* Convite: adicionar à tela inicial */
.a2hs-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.a2hs-icon { width: 56px; height: 56px; border-radius: 14px; flex-shrink: 0; }
.a2hs-head h2 { font-size: 18px; font-weight: 800; }
.a2hs-passos { margin: 4px 0 16px; padding-left: 20px; color: var(--fg); font-size: 14px; line-height: 1.7; }
.a2hs-passos b { color: var(--amarelo); }
.a2hs-share { vertical-align: -3px; color: var(--amarelo); }
