/* RAOstreio - estilos e tokens compartilhados entre todas as páginas.
   Cada página só deve ter CSS específico do seu próprio layout. */

:root {
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #d1d5db;
  --row-border: #f3f4f6;
  --input-bg: #ffffff;
  --shadow: 0 1px 4px rgba(0,0,0,0.1);
  --btn-secondary-bg: #e5e7eb;
  --btn-secondary-text: #111827;
  --link-box-bg: #f3f4f6;
  --link-color: #2563eb;
  --brand-red: #dc2626;
  --switch-track: #e5e7eb;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
html[data-theme="dark"] {
  --bg: #0f1115;
  --card-bg: #1c1f26;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --border: #333844;
  --row-border: #2a2e37;
  --input-bg: #262a33;
  --shadow: 0 2px 10px rgba(0,0,0,0.5);
  --btn-secondary-bg: #2a2e37;
  --btn-secondary-text: #f3f4f6;
  --link-box-bg: #111827;
  --link-color: #93c5fd;
  --brand-red: #ef4444;
  --switch-track: #333844;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; justify-content: center; margin: 0 0 16px; }
.brand img { width: 100%; max-width: 300px; height: auto; display: block; }

/* ---------- Switch de tema (Claro | Escuro) ---------- */
.themeSwitchWrap {
  display: flex; align-items: center; gap: 6px;
  background: var(--card-bg); box-shadow: var(--shadow);
  border: 1px solid var(--border); border-radius: 19px; padding: 6px 10px;
}
.switchLabel { font-size: 11px; font-weight: 700; color: var(--text-muted); user-select: none; }
.switchLabel.active { color: var(--text); }
.themeSwitch {
  width: 42px; height: 22px; border-radius: 11px; background: var(--switch-track);
  border: none; position: relative; cursor: pointer; padding: 0; margin: 0; flex-shrink: 0;
  display: block; line-height: 0; font-size: 0; vertical-align: middle;
  -webkit-appearance: none; appearance: none;
}
.themeSwitchKnob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand-red); transition: transform 0.2s ease;
}
.themeSwitch[aria-checked="true"] .themeSwitchKnob { transform: translateX(20px); }

/* ---------- Componentes de formulário / cartões ---------- */
.card { max-width: 480px; margin: 0 auto 16px; background: var(--card-bg); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
h1 { font-size: 20px; margin: 0 0 12px; color: var(--text); }
h2 { font-size: 16px; margin: 0 0 10px; color: var(--text); }
label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--text-muted); }
input {
  width: 100%; box-sizing: border-box; padding: 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text); font-size: 16px;
}
/* Evita que o autopreenchimento do navegador (usuário/senha salvos) force um fundo
   claro por cima do tema escuro. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  box-shadow: 0 0 0 1000px var(--input-bg) inset !important;
  transition: background-color 9999s ease-in-out 0s, color 9999s ease-in-out 0s;
  caret-color: var(--text) !important;
  font-size: 16px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif !important;
  /* Força o Chrome a recalcular o estilo de autofill assim que a página carrega,
     em vez de só ao focar/clicar no campo. */
  animation-name: onAutoFillStart;
  animation-duration: 0.001s;
}
@keyframes onAutoFillStart { from {} to {} }
button {
  margin-top: 12px; padding: 12px 16px; border: none; border-radius: 8px;
  background: var(--brand-red); color: #ffffff; font-weight: 700; cursor: pointer; font-size: 16px;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); }
button.small { padding: 6px 10px; font-size: 12px; margin-top: 0; }

.muted { color: var(--text-muted); font-size: 13px; }
.error { color: #ef4444; font-size: 13px; margin-top: 6px; }
