/* =============================================================================
 * Merion Presentation — rebrand v2 (evolução visual do DS + shadcn, tema dark)
 * Carregar DEPOIS de merion-ds/*.css e app-shell.css. Só sobrescreve valores;
 * classes e estrutura permanecem as mesmas.
 *
 * Fonte: docs/new_mockups/rebrand/merion-v2.css (bloco 1, verbatim salvo onde
 * anotado). O bloco 2 são complementos nossos: ajustes de especificidade que o
 * mockup estático não precisava e as animações que o mockup não definia.
 * ========================================================================== */

/* ═══════════════════════ 1. SPEC (rebrand/merion-v2.css) ═══════════════════ */

[data-theme="dark"] {
  --background: #081A1F;
  --sidebar: #061519;
  --card: #0B2127;
  --card-gradient: linear-gradient(180deg, #0D262D 0%, #0A1F25 100%);
  --border: rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.12);
  --muted-foreground: rgba(255,255,255,.55);
  --foreground-2: rgba(255,255,255,.62);
  --brand: #00FFD4;
  --brand-tint: rgba(0,255,212,.09);
  --brand-tint-border: rgba(0,255,212,.25);
  --brand-hover: #5CFFE2;
  --warning: #FFC24B;
  --destructive: #FF3D7F;
  --radius: 8px; --radius-md: 12px; --radius-lg: 14px;
  --glow-card: 0 0 0 1px rgba(0,255,212,.12), 0 12px 36px rgba(0,255,212,.10), 0 10px 30px rgba(0,0,0,.4);
  --glow-btn: 0 0 0 1px rgba(0,255,212,.3), 0 6px 20px rgba(0,255,212,.25);
  --glow-icon: drop-shadow(0 0 7px rgba(0,255,212,.8));
  --ease: cubic-bezier(.4,0,.2,1);
}

/* labels em caixa alta (kicker / th / badge) */
.ds-kicker, .table thead th, .m-label { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }

/* cards */
.card { background: var(--card-gradient); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: none; transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease; }
.card.is-interactive:hover, .kpi:hover, .usage-card:hover { border-color: rgba(0,255,212,.4); box-shadow: var(--glow-card); transform: translateY(-3px); }
.kpi-val, .usage-card-value { font-size: 30px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-tint); color: var(--brand); }

/* entrada */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.enter { animation: fadeUp .5s ease both; }
.enter:nth-child(2) { animation-delay: .05s } .enter:nth-child(3) { animation-delay: .1s }
.enter:nth-child(4) { animation-delay: .15s } .enter:nth-child(5) { animation-delay: .2s }

/* skeleton */
@keyframes shimmer { from { background-position: -400px 0 } to { background-position: 400px 0 } }
.skeleton { border-radius: 6px; background: linear-gradient(90deg, #122E35 0%, #1A3C44 50%, #122E35 100%); background-size: 800px 100%; animation: shimmer 1.4s linear infinite; }

/* sidebar — `width` 248⇄68 e a transição vivem em app-shell.css: lá a mesma
   regra precisa conviver com o drawer do mobile (transform, não width). */
.dapp-side { background: var(--sidebar); border-right: 1px solid var(--border); }
.dapp-navlabel { font-size: 10px; letter-spacing: .14em; color: rgba(255,255,255,.4); }
.dapp-navitem { height: 40px; padding: 0 12px; border-radius: 9px; font-size: 13.5px; color: var(--foreground-2); transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.dapp-navitem:hover { background: rgba(255,255,255,.05); color: #fff; }
.dapp-navitem:hover .ic { filter: drop-shadow(0 0 5px rgba(0,255,212,.35)); }
.dapp-navitem[data-active="true"] { background: var(--brand-tint); color: var(--brand); box-shadow: inset 0 0 0 1px rgba(0,255,212,.14); }
.dapp-navitem[data-active="true"] .ic { filter: var(--glow-icon); }
.dapp-nav .dapp-navitem[data-active="true"]::before { box-shadow: 0 0 10px rgba(0,255,212,.9); transition: transform .28s var(--ease), opacity .2s ease; }
.ws-tile { background: linear-gradient(135deg, #00FFD4, #31A592); color: #081A1F; box-shadow: 0 0 14px rgba(0,255,212,.35); }
.dapp-ws { border-radius: 10px; background: rgba(255,255,255,.02); transition: all .2s ease; }
.dapp-ws:hover { border-color: rgba(0,255,212,.35); background: rgba(0,255,212,.05); }

/* topbar — `min-height` e não `height`: o .dapp-top do DS faz wrap no mobile. */
.dapp-top { padding: 0 24px; min-height: 58px; background: rgba(8,26,31,.7); backdrop-filter: blur(10px); }
.command-trigger, .dapp-menu-btn { height: 36px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); transition: all .18s ease; }
/* No celular a busca encolhe até ~150px e o placeholder quebrava em três
   linhas dentro de um botão de 36px. Corta com reticências. */
.dapp-search { min-width: 0; }
.command-trigger span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.command-trigger:hover, .dapp-menu-btn:hover { border-color: rgba(0,255,212,.35); background: rgba(0,255,212,.04); color: var(--brand); }

/* botões */
.btn { height: 38px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.btn-brand { font-weight: 700; box-shadow: var(--glow-btn); }
.btn-brand:hover { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(0,255,212,.5), 0 8px 28px rgba(0,255,212,.4); }
.btn-outline { border-color: var(--border-strong); color: rgba(255,255,255,.85); }
.btn-outline:hover { border-color: rgba(0,255,212,.45); color: var(--brand); background: rgba(0,255,212,.05); }

/* badges de status */
.badge { height: 24px; padding: 0 10px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.badge .badge-dot { box-shadow: 0 0 6px currentColor; }
.badge-success { background: rgba(0,255,212,.1); color: #00FFD4; border-color: rgba(0,255,212,.25); }
.badge-warning { background: rgba(255,194,75,.1); color: #FFC24B; border-color: rgba(255,194,75,.3); }
.badge-destructive { background: rgba(255,61,127,.1); color: #FF3D7F; border-color: rgba(255,61,127,.3); }
.badge-muted { background: rgba(255,255,255,.06); color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.12); }

/* tabela */
.table-wrap { background: var(--card-gradient); border-radius: var(--radius-lg); }
.table thead th { background: transparent; color: rgba(255,255,255,.5); padding: 12px 22px; }
.table tbody td { padding: 13px 22px; border-color: rgba(255,255,255,.05); }
.table tbody tr { position: relative; transition: background .15s ease; }
.table tbody tr:hover { background: rgba(0,255,212,.035); box-shadow: inset 3px 0 0 #00FFD4; }

/* meter */
.usage-meter { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); }
.usage-meter-fill { background: linear-gradient(90deg, #31A592, #00FFD4); box-shadow: 0 0 10px rgba(0,255,212,.6); }

/* ═══════════════════════ 2. COMPLEMENTOS (nossos) ═══════════════════════════ */

/* --- Especificidade: o que o mockup, sendo estático, não precisava resolver --- */

/* `.btn` acima empata com as variantes de tamanho do DS e, carregado depois,
   ganharia delas — todo botão pequeno viraria 38px. Reafirmadas aqui. */
.btn-sm { height: 32px; font-size: 10.5px; padding: 0 12px; }
.btn-lg { height: 46px; font-size: 12px; padding: 0 22px; }
.btn-xl { height: 50px; font-size: 12.5px; }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-link { height: auto; text-transform: none; letter-spacing: 0; font-size: 13px; }
.btn-destructive:hover { box-shadow: 0 0 0 1px rgba(255,61,127,.4), 0 6px 20px rgba(255,61,127,.25); transform: translateY(-1px); }

/* Fundo do painel: luz ciano difusa no canto superior direito (mockup 01). */
.dapp-main { background: radial-gradient(1200px 500px at 70% -20%, rgba(0,255,212,.07), transparent 60%), var(--background); }

/* Sidebar: o globals.css pinta o hover com `--muted` num seletor mais
   específico que o do bloco 1; repetido com a mesma especificidade. */
.dapp-side .dapp-navitem:hover:not([data-active="true"]) { background: rgba(255,255,255,.05); color: #fff; }
.dapp-side .dapp-ws:hover:not(:disabled) { border-color: rgba(0,255,212,.35); background: rgba(0,255,212,.05); box-shadow: 0 0 0 1px rgba(0,255,212,.08), 0 6px 20px rgba(0,0,0,.35); }
.dapp-side .dapp-user:hover { background: rgba(255,255,255,.04); }
.dapp-ws .ws-plan { font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.dapp-head .separator { height: 1px; background: linear-gradient(90deg, rgba(0,255,212,0), rgba(0,255,212,.35), rgba(0,255,212,0)); }
.dapp-foot { border-top: 1px solid rgba(255,255,255,.06); }

/* Skeleton: o DS já anima um `::after` deslizante; com o shimmer de fundo do
   bloco 1 seriam dois brilhos. */
.skeleton::after { content: none; }

/* --- Animações que o mockup não definia --- */

/* Entrada da página: cada bloco direto do `.dash` sobe em cascata. Uma regra
   para todas as telas, sem tocar em markup. */
.dash > * { animation: fadeUp .5s ease both; }
.dash > :nth-child(2) { animation-delay: .06s }
.dash > :nth-child(3) { animation-delay: .12s }
.dash > :nth-child(4) { animation-delay: .18s }
.dash > :nth-child(5) { animation-delay: .24s }
.dash > :nth-child(n+6) { animation-delay: .3s }

/* Indicador do item ativo: nasce esticando de dentro para fora. Não é um
   `transition` porque o ::before só existe no item ativo. */
@keyframes indicatorIn { from { transform: translateY(-50%) scaleY(0); opacity: 0; } to { transform: translateY(-50%) scaleY(1); opacity: 1; } }
.dapp-nav .dapp-navitem[data-active="true"]::before { animation: indicatorIn .28s var(--ease) both; }
.dapp-navitem .ic { transition: filter .2s ease, transform .2s ease; }
.dapp-navitem:hover:not([data-active="true"]) .ic { transform: translateX(1px); }

/* Foco de campo com halo ciano (o DS só troca a cor da borda). */
.input:focus, .textarea:focus, .select-trigger:focus-visible {
  border-color: rgba(0,255,212,.55);
  box-shadow: 0 0 0 3px rgba(0,255,212,.14), 0 0 18px rgba(0,255,212,.10);
}
.input, .textarea, .select-trigger { background: rgba(255,255,255,.02); transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.input:hover:not(:focus):not(:disabled), .textarea:hover:not(:focus):not(:disabled) { border-color: var(--border-strong); }

/* Pressão do botão: afunda e encolhe um fio. */
.btn { transition: background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s var(--ease); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn-brand:active { box-shadow: var(--glow-btn); }

/* Menus e popovers entram com o `pop` do DS (o shadcn traz `animate-in`, que
   sem plugin não faz nada). */
[data-radix-menu-content][data-state="open"], [data-radix-popper-content-wrapper] [role="dialog"] { animation: pop .16s var(--ease) both; }
.select-menu { animation: pop .16s var(--ease) both; }
.select-item { transition: background .12s ease, color .12s ease; }

/* Badge: ponto pulsante em estado transitório ("publicando", "pendente"). */
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 5px transparent; } }
.badge-warning .badge-dot { animation: pulseDot 1.8s ease-out infinite; }

/* Tabs: o item ativo desliza a cor em vez de trocar seco. */
.tab { transition: background .18s ease, color .18s ease, box-shadow .18s ease; }

/* Medidor: a barra cresce no carregamento a partir de zero. */
@keyframes meterIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.usage-meter-fill { transform-origin: left; animation: meterIn .9s var(--ease) both; }

/* Quem pediu menos movimento recebe tudo no lugar, parado. */
@media (prefers-reduced-motion: reduce) {
  .enter, .dash > *, .dapp-nav .dapp-navitem[data-active="true"]::before, .usage-meter-fill,
  .select-menu, [data-radix-menu-content][data-state="open"], .badge-warning .badge-dot, .skeleton {
    animation: none !important;
  }
  .card, .btn, .dapp-navitem, .dapp-ws, .input, .textarea, .table tbody tr { transition: none !important; }
  .card.is-interactive:hover, .kpi:hover, .usage-card:hover, .btn-brand:hover, .btn:active { transform: none; }
}
