/* =====================================================================
   avalia+ — Estilos compartilhados de páginas de autenticação
   (login.php, senha.php e demais telas standalone)
   v1.0 - 2026-04-26
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --neon-blue: #38bdf8;
  --neon-purple: #818cf8;
  --bg-body: #020617;
  --auth-text: #f8fafc;
  --auth-text-dim: #64748b;
  --auth-card-bg: rgba(15, 23, 42, 0.75);
  --auth-border: rgba(255,255,255,.1);
  --auth-radius: 20px;
  --auth-input-radius: 12px;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--auth-text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

/* Background grid + ambient gradients */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(14,165,233,.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(129,140,248,.14) 0%, transparent 55%),
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* Wrapper genérico (login-wrap / senha-wrap) */
.auth-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

/* Brand header */
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #0ea5e9 0%, #818cf8 100%);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(14,165,233,.35);
}
.auth-brand-name {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}
.auth-brand-name strong { font-style: normal; -webkit-text-fill-color: var(--auth-text); }
.auth-brand-name em {
  font-style: normal;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Card padrão de auth */
.auth-card {
  background: var(--auth-card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  padding: 36px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.06) inset;
}
.auth-card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-card-title h1 { font-size: 1.25rem; font-weight: 800; color: var(--auth-text); }
.auth-card-sub { color: var(--auth-text-dim); font-size: 0.875rem; margin-bottom: 24px; }

/* Form group + input com prefixo */
.fg { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.fg label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--auth-text-dim);
}
.input-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 13px; top: 50%; transform: translateY(-50%);
  color: #475569;
  pointer-events: none;
  display: flex;
}
.input-wrap input {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--auth-input-radius);
  color: var(--auth-text);
  padding: 12px 16px 12px 42px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap input:focus,
.input-wrap input:focus-visible {
  outline: none;
  border-color: var(--neon-blue);
  box-shadow: 0 0 0 3px rgba(56,189,248,.18);
}
.input-wrap input::placeholder { color: #334155; }

/* Toggle de visibilidade de senha */
.toggle-vis {
  position: absolute;
  right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: #475569;
  padding: 4px;
  display: flex; align-items: center;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.toggle-vis:hover { color: #94a3b8; }
.toggle-vis:focus-visible {
  outline: none;
  color: var(--neon-blue);
  background: rgba(56,189,248,.1);
  box-shadow: 0 0 0 2px rgba(56,189,248,.35);
}

/* Indicador de força e match de senha */
.strength-bar { height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.strength-fill { height: 100%; width: 0; border-radius: 2px; transition: width .3s, background .3s; }
.strength-label { font-size: 0.75rem; margin-top: 4px; display: block; color: var(--auth-text-dim); }
.match-hint { font-size: 0.75rem; margin-top: 5px; display: block; }

/* Alertas */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.875rem;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert.error,
.alert:not(.success) {
  background: rgba(248,113,113,.1);
  border-color: rgba(248,113,113,.25);
  color: #fca5a5;
}
.alert.success {
  background: rgba(52,211,153,.1);
  border-color: rgba(52,211,153,.25);
  color: #6ee7b7;
}

/* Botão submit padrão */
.btn-submit {
  position: relative;
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  margin-top: 6px;
  overflow: hidden;
  transition: opacity .2s, transform .15s, box-shadow .2s;
}
.btn-submit:hover { opacity: .92; transform: translateY(-1px); }
.btn-submit:active { transform: translateY(0); }
.btn-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56,189,248,.5), 0 8px 20px rgba(14,165,233,.35);
}
.btn-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.18) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform .55s ease;
}
.btn-submit:hover::after { transform: translateX(100%); }

/* Link "voltar" */
.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  color: #475569;
  font-size: 0.85rem;
  text-decoration: none;
  transition: color .2s;
}
.back-link:hover,
.back-link:focus-visible { color: var(--neon-blue); outline: none; }

/* Backwards compatibility: aliases para classes antigas (login-*, senha-*) */
.login-wrap, .senha-wrap {
  position: relative; z-index: 1; width: 100%; max-width: 440px;
}
.login-brand, .senha-brand { text-align: center; margin-bottom: 28px; }
.login-brand-icon, .senha-brand-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #0ea5e9 0%, #818cf8 100%);
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(14,165,233,.35);
}
.login-brand-name, .senha-brand-name {
  font-size: 1.6rem; font-weight: 900; letter-spacing: -0.04em; line-height: 1;
}
.login-brand-name em, .senha-brand-name em {
  font-style: normal;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.senha-brand-name strong { font-style: normal; -webkit-text-fill-color: var(--auth-text); }
.login-card, .senha-card {
  background: var(--auth-card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  padding: 36px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.06) inset;
}
.senha-card { padding: 36px 36px 32px; }

/* Mobile fine-tuning */
@media (max-width: 480px) {
  body { padding: 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: max(16px, env(safe-area-inset-bottom)); padding-top: max(16px, env(safe-area-inset-top)); }
  .auth-card, .login-card, .senha-card { padding: 28px 22px; }
  .auth-brand-name, .login-brand-name, .senha-brand-name { font-size: 1.4rem; }
}

/* iOS: previne zoom ao focar inputs em telas pequenas */
@media (max-width: 768px) {
  .input-wrap input,
  .auth-card input, .login-card input, .senha-card input,
  .auth-card select, .login-card select, .senha-card select { font-size: 16px !important; }
}

/* Tap targets em botões de auth */
.btn-submit, .back-link { touch-action: manipulation; }
.btn-submit { min-height: 48px; }

/* ─────────────────────────────────────────────────────────────────────────
   LIGHT THEME — [data-theme="light"]
   Substitui as variáveis CSS dark-only do :root e corrige cores hardcoded.
   ───────────────────────────────────────────────────────────────────────── */
html[data-theme="light"] {
  --bg-body: #f1f5f9;
  --auth-text: #0f172a;
  --auth-text-dim: #475569;
  --auth-card-bg: rgba(255, 255, 255, 0.95);
  --auth-border: rgba(0, 0, 0, 0.12);
  color-scheme: light;
}
html[data-theme="light"] body {
  background: #f1f5f9;
  color: #0f172a;
}
html[data-theme="light"] body::before {
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(2,132,199,.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(109,40,217,.07) 0%, transparent 55%),
    linear-gradient(rgba(0,0,0,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.02) 1px, transparent 1px);
}
html[data-theme="light"] .auth-card,
html[data-theme="light"] .login-card,
html[data-theme="light"] .senha-card {
  box-shadow: 0 4px 24px rgba(0,0,0,.12), 0 1px 0 rgba(0,0,0,.04) inset;
}
html[data-theme="light"] .auth-brand-name strong,
html[data-theme="light"] .login-brand-name strong,
html[data-theme="light"] .senha-brand-name strong {
  -webkit-text-fill-color: #0f172a;
}
html[data-theme="light"] .input-wrap input {
  background: rgba(255,255,255,.9);
  border-color: rgba(0,0,0,.15);
  color: #0f172a;
}
html[data-theme="light"] .input-wrap input::placeholder { color: #94a3b8; }
html[data-theme="light"] .input-wrap input:focus,
html[data-theme="light"] .input-wrap input:focus-visible {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2,132,199,.2);
}
html[data-theme="light"] .input-prefix { color: #94a3b8; }
html[data-theme="light"] .toggle-vis { color: #94a3b8; }
html[data-theme="light"] .toggle-vis:hover { color: #64748b; }
html[data-theme="light"] .strength-bar { background: rgba(0,0,0,.1); }
html[data-theme="light"] .alert.error,
html[data-theme="light"] .alert:not(.success) {
  background: rgba(220,38,38,.08);
  border-color: rgba(220,38,38,.25);
  color: #b91c1c;
}
html[data-theme="light"] .alert.success {
  background: rgba(22,163,74,.08);
  border-color: rgba(22,163,74,.25);
  color: #15803d;
}
html[data-theme="light"] .back-link { color: #64748b; }
html[data-theme="light"] .back-link:hover { color: #0284c7; }
