/* ════════════════════════════════════════════════════════════
   BAQE UI — Fundação compartilhada (design tokens, scrollbar,
   toast, skeleton, animações). Carregado por TODAS as páginas
   (index + login) — fonte única de verdade dos tokens da marca.
   ════════════════════════════════════════════════════════════ */

:root {
  /* ── Marca ── */
  --orange:  #FF5B00;  --orange2: #FF7A2E;  --orange3: #D44A00;
  --dark: #1A1C1A; --dark2: #212321; --dark3: #292B29; --dark4: #323432;
  --bg: #070707; --gray: #DBDBDB; --white: #FFFFFF; --text: #FFFFFF;

  /* ── Texto ── */
  --muted:        rgba(219,219,219,.45);  /* texto secundário ≥13px        */
  --muted-strong: rgba(219,219,219,.62);  /* labels pequenos 10-11px       */
  --border:  rgba(255,255,255,.07);
  --border2: rgba(255,91,0,.35);

  /* ── Status — fonte única (usar em TODO módulo) ── */
  --ok: #51cf66;       --ok-bg: rgba(47,158,68,.15);     --ok-bd: rgba(47,158,68,.40);
  --danger: #ff6b6b;   --danger-bg: rgba(229,62,62,.12); --danger-bd: rgba(229,62,62,.30);
  --warn: #ff9f43;     --warn-bg: rgba(255,159,67,.14);  --warn-bd: rgba(255,159,67,.35);
  --info: var(--orange2);

  /* ── Tipografia (escala) ── */
  --fs-2xs: 10px;  /* piso absoluto — nada abaixo disso */
  --fs-xs: 11px;   --fs-sm: 12px;  --fs-base: 13px;  --fs-md: 15px;
  --fs-lg: 17px;   --fs-xl: 22px;  --fs-2xl: 28px;   --fs-num: 40px;
  --fs-hero: 68px; /* números gigantes (assinatura BAQE) */
  --lh-tight: 1.1; --lh-base: 1.5; --lh-loose: 1.7;
  --track-caps: 1.2px; /* tracking padrão de labels caps */

  /* ── Espaçamento ── */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;

  /* ── Raio (escala fechada: só estes 3 + pill) ── */
  --radius: 6px; --radius-lg: 10px; --radius-xl: 14px; --radius-pill: 999px;

  /* ── Elevação ── */
  --shadow-card: 0 2px 14px rgba(0,0,0,.45);
  --shadow-pop:  0 8px 24px rgba(0,0,0,.5);
  --shadow-glow: 0 8px 28px rgba(255,91,0,.25);

  /* ── Movimento & camadas ── */
  --t-fast: .15s; --t-med: .25s; --t-slow: .4s;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --z-overlay: 900; --z-drawer: 901; --z-modal: 950; --z-toast: 1000;
}

/* ── Acessibilidade: focus ring da marca (teclado) ──────────── */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Scrollbar BAQE (utilitário único) ──────────────────────── */
.baqe-scroll { scrollbar-width: thin; scrollbar-color: var(--dark4) transparent; }
.baqe-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.baqe-scroll::-webkit-scrollbar-track { background: transparent; }
.baqe-scroll::-webkit-scrollbar-thumb { background: var(--dark4); border-radius: 3px; }
.baqe-scroll::-webkit-scrollbar-thumb:hover { background: var(--orange3); }

/* ── Transição entre views (fade global, só opacidade p/ não
   quebrar elementos position:fixed dentro da view) ──────────── */
@keyframes bqViewFade { from { opacity: 0; } to { opacity: 1; } }
.view.active { animation: bqViewFade var(--t-med) ease; }

/* ── Skeleton loader ────────────────────────────────────────── */
@keyframes bqShimmer { 0% { background-position: -300px 0; } 100% { background-position: 300px 0; } }
.bq-skel {
  background: linear-gradient(90deg, var(--dark2) 25%, var(--dark3) 37%, var(--dark2) 63%);
  background-size: 600px 100%;
  animation: bqShimmer 1.2s infinite linear;
  border-radius: 4px;
}
.bq-skel-row { height: 16px; margin: 10px 0; }

/* ── Estados de loading / vazio com logo BAQE ───────────────── */
.bq-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  text-align: center;
}
.bq-state img { height: 38px; width: auto; }
.bq-state.loading img { opacity: .5; animation: bqPulse 1.2s infinite ease-in-out; }
.bq-state.empty img { opacity: .22; filter: grayscale(1); }
@keyframes bqPulse {
  0%, 100% { opacity: .3; transform: scale(.96); }
  50%      { opacity: .65; transform: scale(1.02); }
}

/* ── Toast (substitui alert()) ──────────────────────────────── */
#bq-toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.bq-toast {
  pointer-events: auto;
  background: var(--dark2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  color: var(--text);
  padding: 11px 15px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  max-width: 340px;
  animation: bqToastIn var(--t-med) var(--ease);
}
.bq-toast.ok  { border-left-color: var(--ok); }
.bq-toast.err { border-left-color: var(--danger); }
.bq-toast.out { animation: bqToastOut var(--t-fast) ease forwards; }
@keyframes bqToastIn  { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes bqToastOut { to { opacity: 0; transform: translateX(24px); } }

/* ── Confirmação padrão (substitui confirm()) ───────────────── */
#bq-confirm-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.82); padding: 24px;
}
.bq-confirm-card {
  background: var(--dark2); border: 1px solid var(--border);
  border-top: 2px solid var(--orange); border-radius: 12px;
  width: min(400px, 94vw); padding: 22px;
  box-shadow: var(--shadow-pop);
  animation: bqConfirmIn .22s var(--ease);
  font-family: var(--font-sans);
}
@keyframes bqConfirmIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.bq-confirm-title {
  font: 800 15px/1.2 var(--font-display); letter-spacing: .5px;
  text-transform: uppercase; color: var(--white); margin-bottom: 8px;
}
.bq-confirm-msg { font-size: 13px; line-height: 1.55; color: var(--gray); white-space: pre-line; }
.bq-confirm-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.bq-confirm-btns button {
  border-radius: var(--radius); padding: 10px 18px;
  font: 700 12px/1 var(--font-sans); letter-spacing: .5px;
  text-transform: uppercase; cursor: pointer;
}
.bq-confirm-cancel { background: none; border: 1px solid var(--border); color: var(--muted-strong); }
.bq-confirm-cancel:hover { border-color: var(--orange); color: var(--orange); }
.bq-confirm-ok { background: var(--orange); border: 1px solid var(--orange); color: #1A1C1A; }
.bq-confirm-ok:hover { background: var(--orange2); border-color: var(--orange2); }
.bq-confirm-ok.danger { background: var(--danger); border-color: var(--danger); }

/* ── Marca: logo/monograma ──────────────────────────────────── */
.bq-brand {
  position: relative;
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  vertical-align: middle;
}
.bq-brand-mono {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}
.bq-brand img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

/* ── Acessibilidade: respeitar prefers-reduced-motion ───────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
