/* OUVIR UI — camada avançada de interface.
   Ativada por body.ofx-ui (páginas de plataforma). Temas das rádios e a home
   customizada não recebem o skin; recebem apenas recursos globais (barra de
   leitura, toasts e atalhos).
   Padrões inspirados em ReactBits/Aceternity/Magic UI/Uiverse, reescritos em
   CSS e JavaScript nativos, sem dependências. */

body.ofx-ui {
  --ofx-ui-radius: 18px;
  --ofx-ui-border: rgba(94, 207, 255, .22);
  --ofx-ui-glow: 0 0 0 1px rgba(32, 217, 255, .18), 0 18px 48px rgba(1, 8, 18, .45);
}

/* Entrada suave do conteúdo */
body.ofx-ui .pd-main,
body.ofx-ui .public-shell > main,
body.ofx-ui main.container {
  animation: ofx-ui-enter .32s var(--ofx-ease-out) both;
}
@keyframes ofx-ui-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Superfícies */
body.ofx-ui :is(.card, .station-card) {
  border-color: var(--ofx-ui-border);
  box-shadow: 0 10px 30px rgba(1, 8, 18, .35);
  transition: border-color var(--ofx-dur-base) var(--ofx-ease),
              box-shadow var(--ofx-dur-base) var(--ofx-ease),
              transform var(--ofx-dur-base) var(--ofx-ease);
}
body.ofx-ui :is(.card, .station-card):hover {
  border-color: rgba(94, 207, 255, .48);
  box-shadow: var(--ofx-ui-glow);
  transform: translateY(-2px);
}
body.ofx-ui .pd-surface {
  border-color: var(--ofx-ui-border);
  box-shadow: 0 10px 30px rgba(1, 8, 18, .3);
}
body.ofx-ui :is(.fm-plan-card, .asbs-contract) {
  border-color: var(--ofx-ui-border);
  box-shadow: 0 10px 30px rgba(1, 8, 18, .3);
  transition: border-color var(--ofx-dur-base) var(--ofx-ease),
              box-shadow var(--ofx-dur-base) var(--ofx-ease),
              transform var(--ofx-dur-base) var(--ofx-ease);
}
body.ofx-ui :is(.fm-plan-card, .asbs-contract):hover {
  border-color: rgba(94, 207, 255, .48);
  box-shadow: var(--ofx-ui-glow);
  transform: translateY(-2px);
}

/* Títulos de cartão com régua luminosa */
body.ofx-ui .card > h2:first-child::after {
  content: "";
  display: block;
  width: 46px;
  height: 2px;
  margin-top: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--ofx-cyan), var(--ofx-violet));
  opacity: .85;
}

/* Campos */
body.ofx-ui :is(input, select, textarea):focus-visible {
  outline: none;
  border-color: var(--ofx-focus);
  box-shadow: 0 0 0 3px rgba(32, 217, 255, .22);
}

/* Botões: sem trocar a identidade, só resposta tátil */
body.ofx-ui :is(.button, .btn, button):not(.ofx-no-skin):active {
  transform: translateY(1px) scale(.99);
}
body.ofx-ui :is(.button, .btn, button):not(.ofx-no-skin):focus-visible {
  outline: 2px solid var(--ofx-focus);
  outline-offset: 3px;
}

/* Tabelas */
body.ofx-ui table tbody tr {
  transition: background-color var(--ofx-dur-fast) var(--ofx-ease);
}
body.ofx-ui table tbody tr:hover {
  background: rgba(32, 217, 255, .05);
}

/* Componentes novos -------------------------------------------------- */

.ofx-glass {
  background: linear-gradient(160deg, rgba(16, 35, 56, .78), rgba(7, 20, 39, .72));
  border: 1px solid rgba(148, 215, 255, .18);
  border-radius: var(--ofx-ui-radius, 18px);
  box-shadow: 0 18px 50px rgba(1, 8, 18, .45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.ofx-gradient-border {
  position: relative;
  border: 1px solid transparent;
  border-radius: var(--ofx-ui-radius, 18px);
  background: linear-gradient(160deg, #0b1626, #071427) padding-box,
              conic-gradient(from var(--ofx-angle, 0deg), var(--ofx-cyan), var(--ofx-violet), var(--ofx-mint), var(--ofx-cyan)) border-box;
}
@supports (background: paint(something)) {
  .ofx-gradient-border { animation: ofx-border-spin 9s linear infinite; }
}
@keyframes ofx-border-spin {
  to { --ofx-angle: 360deg; }
}

.ofx-spotlight {
  position: relative;
  isolation: isolate;
}
.ofx-spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--ofx-dur-base) var(--ofx-ease);
  background: radial-gradient(260px circle at var(--ofx-sx, 50%) var(--ofx-sy, 50%),
              rgba(32, 217, 255, .18), transparent 62%);
  z-index: 0;
}
.ofx-spotlight:hover::after { opacity: 1; }

.ofx-lamp {
  position: relative;
  overflow: hidden;
}
.ofx-lamp::before {
  content: "";
  position: absolute;
  top: -38%;
  left: 50%;
  width: 70%;
  height: 90%;
  transform: translateX(-50%);
  background: conic-gradient(from 180deg at 50% 0%, transparent 40%, rgba(32, 217, 255, .28) 50%, transparent 60%);
  filter: blur(22px);
  pointer-events: none;
  opacity: .8;
}

.ofx-bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}
.ofx-bento > * { grid-column: span 4; min-width: 0; }
.ofx-bento > .ofx-span-6 { grid-column: span 6; }
.ofx-bento > .ofx-span-8 { grid-column: span 8; }
.ofx-bento > .ofx-span-12 { grid-column: span 12; }
@media (max-width: 960px) {
  .ofx-bento > * { grid-column: span 6; }
  .ofx-bento > .ofx-span-8 { grid-column: span 12; }
}
@media (max-width: 620px) {
  .ofx-bento > * { grid-column: span 12; }
}

.ofx-meteors {
  position: relative;
  overflow: hidden;
  background-image:
    radial-gradient(1.4px 1.4px at 20% 30%, rgba(32, 217, 255, .55), transparent 60%),
    radial-gradient(1.2px 1.2px at 64% 12%, rgba(167, 139, 250, .5), transparent 60%),
    radial-gradient(1.6px 1.6px at 82% 70%, rgba(150, 247, 179, .45), transparent 60%),
    radial-gradient(1.2px 1.2px at 38% 84%, rgba(255, 212, 121, .4), transparent 60%);
  background-size: 220px 220px, 260px 260px, 300px 300px, 240px 240px;
  animation: ofx-meteors-drift 28s linear infinite;
}
@keyframes ofx-meteors-drift {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 220px 220px, -260px 260px, 300px -300px, -240px 240px; }
}

.ofx-ticker {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.ofx-shiny {
  position: relative;
  overflow: hidden;
}
.ofx-shiny::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, .32) 50%, transparent 68%);
  transform: translateX(-130%);
  transition: transform .75s var(--ofx-ease);
  pointer-events: none;
}
.ofx-shiny:hover::after { transform: translateX(130%); }

[data-ofx-tip] { position: relative; }
[data-ofx-tip]:hover::after,
[data-ofx-tip]:focus-visible::after {
  content: attr(data-ofx-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 8px;
  background: #04101d;
  border: 1px solid rgba(148, 215, 255, .3);
  color: var(--ofx-text);
  font: 600 12px/1.3 var(--ofx-font-sans);
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(1, 8, 18, .5);
  z-index: 120;
  pointer-events: none;
}

/* Barra de leitura (todas as páginas) */
.ofx-ui-scroll {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 2147483000;
  pointer-events: none;
  background: transparent;
}
.ofx-ui-scroll > i {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--ofx-cyan), var(--ofx-violet), var(--ofx-mint));
  box-shadow: 0 0 10px rgba(32, 217, 255, .5);
}

/* Toasts */
.ofx-toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 2147483000;
  width: min(92vw, 420px);
  pointer-events: none;
}
.ofx-toast {
  pointer-events: auto;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 215, 255, .28);
  border-left: 3px solid var(--ofx-cyan);
  background: rgba(5, 13, 25, .94);
  color: var(--ofx-text);
  box-shadow: 0 18px 40px rgba(1, 8, 18, .55);
  font: 500 14px/1.45 var(--ofx-font-sans);
  animation: ofx-toast-in .24s var(--ofx-ease-out) both;
}
.ofx-toast--ok { border-left-color: var(--ofx-ok); }
.ofx-toast--warn { border-left-color: var(--ofx-warn); }
.ofx-toast--danger { border-left-color: var(--ofx-danger); }
.ofx-toast.is-out { animation: ofx-toast-out .2s ease both; }
@keyframes ofx-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes ofx-toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* Paleta de comandos */
.ofx-cmd-trigger {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 2147482000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 215, 255, .25);
  background: rgba(5, 13, 25, .82);
  color: var(--ofx-muted);
  font: 700 12px/1 var(--ofx-font-sans);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(1, 8, 18, .45);
}
.ofx-cmd-trigger:hover { color: var(--ofx-text); border-color: var(--ofx-focus); }
.ofx-cmd-trigger kbd {
  font: 700 10px/1 var(--ofx-font-mono);
  padding: 3px 5px;
  border-radius: 5px;
  border: 1px solid rgba(148, 215, 255, .3);
  background: rgba(16, 35, 56, .8);
  color: var(--ofx-text);
}

dialog.ofx-cmd {
  width: min(92vw, 620px);
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid rgba(148, 215, 255, .28);
  border-radius: 16px;
  background: linear-gradient(160deg, #0a1728, #050d19);
  color: var(--ofx-text);
  box-shadow: 0 40px 100px rgba(1, 8, 18, .7);
}
dialog.ofx-cmd::backdrop {
  background: rgba(2, 7, 14, .62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ofx-cmd__head {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid rgba(148, 215, 255, .16);
}
.ofx-cmd__head input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 215, 255, .25);
  background: rgba(7, 20, 39, .9);
  color: var(--ofx-text);
  font: 500 15px/1 var(--ofx-font-sans);
}
.ofx-cmd__list {
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 8px;
  display: grid;
  gap: 4px;
}
.ofx-cmd__item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--ofx-muted);
  text-decoration: none;
  font: 600 14px/1.3 var(--ofx-font-sans);
}
.ofx-cmd__item:hover,
.ofx-cmd__item.is-active {
  background: rgba(32, 217, 255, .2);
  color: var(--ofx-text);
  text-decoration: none;
}
.ofx-cmd__item small { color: var(--ofx-muted); font-size: 11px; }
.ofx-cmd__empty { padding: 18px 12px; color: var(--ofx-muted); font-size: 13px; }

@media (max-width: 720px) {
  .ofx-cmd-trigger { bottom: 84px; left: 12px; padding: 0 12px; font-size: 11px; }
  .ofx-cmd-trigger kbd { display: none; }
  .ofx-toasts { bottom: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  body.ofx-ui .pd-main,
  body.ofx-ui .public-shell > main,
  body.ofx-ui main.container { animation: none !important; }
  .ofx-meteors,
  .ofx-gradient-border { animation: none !important; }
}
