/* ============================================================
   HYDRA TECNOLOGIA — base.css
   Design tokens (cores, tipografia, espaçamento) e reset global.
   Compartilhado por TODAS as páginas do site.
   ============================================================ */

:root {
  /* Cores de marca */
  --navy-900: #0A1930;
  --navy-800: #10233F;
  --navy-700: #17324F;
  --navy-600: #204264;
  --teal-400: #2DD4C8;
  --teal-500: #14B8AA;
  --teal-600: #0EA5A0;
  --teal-700: #0B7F7B;
  --teal-100: #E6F7F6;

  /* Neutros / superfícies */
  --bg-app: #F4F6F8;
  --surface: #FFFFFF;
  --text-900: #101828;
  --text-600: #475467;
  --text-400: #98A2B3;
  --border: #E4E7EC;

  /* Estados / feedback */
  --red-bg: #FDEDED;
  --red-border: #F6C9C6;
  --red-700: #B42318;
  --red-500: #D92D20;
  --green-bg: #ECFDF3;
  --green-700: #027A48;
  --amber-bg: #FFFAEB;
  --amber-700: #B54708;
  --blue-bg: #EFF4FF;
  --blue-700: #3654B0;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(16,24,40,0.05);
  --shadow-md: 0 4px 16px rgba(16,24,40,0.07);
  --shadow-lg: 0 8px 24px rgba(10, 25, 48, 0.10);

  /* Tipografia */
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Layout do app interno (topo/sidebar) — usado em app-shell.css */
  --sidebar-w: 232px;
  --topbar-h: 60px;
}

/* ---------- Tema escuro (compartilhado por TODAS as páginas) ----------
   Sobrescreve só os tokens de superfície/texto/feedback. Como o resto do
   CSS do site inteiro já usa var(--...) em vez de cor fixa, isso basta
   pra virar o site inteiro pro escuro — não precisa duplicar regra por
   regra em cada arquivo. Ativado via [data-theme="dark"] na <html>,
   controlado pelo botão de sol/lua (ver js/theme.js). */
:root[data-theme="dark"] {
  --bg-app: #0B1626;
  --surface: #101C30;
  --text-900: #EDF1F7;
  --text-600: #9FAEC4;
  --text-400: #6B7A94;
  --border: #223047;
  --teal-100: rgba(45, 212, 200, 0.14);
  --red-bg: rgba(217, 45, 32, 0.14);
  --red-border: rgba(217, 45, 32, 0.4);
  --green-bg: rgba(2, 122, 72, 0.16);
  --amber-bg: rgba(181, 71, 8, 0.16);
  --blue-bg: rgba(54, 84, 176, 0.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text-900);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, color 0.15s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-ui); cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Logo Hydra (reutilizado via <svg class="logo-mark">) ---------- */
.logo-mark rect:first-child { fill: url(#hgrad); }

/* ---------- Botões compartilhados ---------- */
.btn-primary {
  width: 100%;
  padding: 12.5px;
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--teal-600), var(--teal-700));
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; filter: none; }

.btn-ghost {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600;
  color: var(--teal-700);
  background: var(--teal-100);
  border: none; padding: 7px 12px; border-radius: 8px;
}
.btn-ghost:hover { background: #D6F1EF; }

/* ---------- Campos de formulário compartilhados ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-900);
  margin-bottom: 6px;
}
.field input,
.field select {
  width: 100%;
  padding: 11px 13px;
  font-size: 14.5px;
  font-family: var(--font-ui);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-900);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder { color: var(--text-400); }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3.5px var(--teal-100);
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ---------- Badges ---------- */
.badge {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  letter-spacing: 0.01em;
}
.badge.module { background: var(--bg-app); color: var(--text-600); }
.badge.green { background: var(--green-bg); color: var(--green-700); }
.badge.amber { background: var(--amber-bg); color: var(--amber-700); }

/* ---------- Utilitários de estado (usados por api.js em qualquer página) ---------- */
.state-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-600);
  font-size: 13.5px;
}
.state-box.is-error { color: var(--red-700); }
.state-box svg { opacity: 0.7; }
.spinner {
  width: 26px; height: 26px;
  border-radius: 999px;
  border: 3px solid var(--border);
  border-top-color: var(--teal-500);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Botão de tema claro/escuro (sol/lua) — todas as páginas ---------- */
.theme-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 9px;
  color: var(--text-600);
}
.theme-toggle:hover { background: var(--bg-app); color: var(--text-900); }
.theme-toggle .theme-icon-sun { display: none; }
.theme-toggle .theme-icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }

/* Variante flutuante, usada na tela de login (sem topbar pra encaixar) */
.theme-toggle-floating {
  position: fixed; top: 16px; right: 16px; z-index: 60;
  background: rgba(120, 140, 165, 0.16);
}
.theme-toggle-floating:hover { background: rgba(120, 140, 165, 0.28); }

/* ---------- Rodapé das páginas internas (topbar + sidebar) ---------- */
.app-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-400);
  font-family: var(--font-mono);
}
.app-footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-600); }
.app-footer-brand .dragon-mark { width: 22px; height: 22px; flex: none; border-radius: 6px; }
.app-footer-cnpj { white-space: nowrap; }
