/* ==========================================================================
   SIRVA · LOGIN · IMUB-DN
   CSS coerente com a landing page (paleta: azul noturno + terracota +
   âmbar/dourado + creme + oliva).
   Mantém integralmente os seletores/IDs que o index.js utiliza.
   ========================================================================== */

/* ------------------------------------------------------------------
   1. TOKENS (design tokens) — baseados na home modernizada
   ------------------------------------------------------------------ */
:root {
  /* cores principais — LIGHT */
  --ink:           #2b2420;       /* texto principal */
  --ink-soft:      #6b5e55;       /* texto secundário */
  --cream-1:       #faf5ec;       /* fundo mais claro */
  --cream-2:       #f2e9d7;       /* fundo com crema */
  --paper:         #ffffff;

  --terracota:     #b8553a;       /* primária vibrante */
  --terracota-d:   #8e3f2a;       /* primária pressed */
  --amber:         #d89b3a;       /* dourado */
  --amber-d:       #b77d22;
  --olive:         #6b7f3e;       /* oliva (substitui verde neon do WA) */
  --olive-d:       #536430;
  --night:         #162336;       /* azul noturno da home (hero) */
  --night-2:       #0e1828;

  /* utilitários */
  --line:          rgba(139, 99, 64, .18);
  --line-strong:   rgba(139, 99, 64, .34);
  --shadow-sm:     0 2px 8px rgba(43, 36, 32, .06);
  --shadow-md:     0 10px 30px rgba(43, 36, 32, .12);
  --shadow-lg:     0 25px 60px rgba(17, 10, 6, .22);
  --shadow-glow:   0 0 0 4px rgba(216, 155, 58, .18);

  /* tipografia */
  --font-display:  'Fraunces', 'Playfair Display', Georgia, serif;
  --font-body:     'Inter', 'Poppins', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* formas */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
}

/* tokens no DARK — azul noturno + âmbar quente */
body.theme-dark {
  --ink:           #f1e6d3;
  --ink-soft:      #b9ae9c;
  --cream-1:       #141d2c;
  --cream-2:       #0d1624;
  --paper:         #19243a;

  --terracota:     #e07050;
  --terracota-d:   #b4553a;
  --amber:         #efb759;
  --amber-d:       #d99a35;
  --olive:         #95ad5c;
  --olive-d:       #728745;

  --line:          rgba(239, 183, 89, .16);
  --line-strong:   rgba(239, 183, 89, .35);
  --shadow-sm:     0 2px 8px rgba(0, 0, 0, .35);
  --shadow-md:     0 12px 32px rgba(0, 0, 0, .45);
  --shadow-lg:     0 30px 80px rgba(0, 0, 0, .6);
  --shadow-glow:   0 0 0 4px rgba(239, 183, 89, .22);
}

/* ------------------------------------------------------------------
   2. RESET & BODY
   ------------------------------------------------------------------ */
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream-1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01","cv11";
}

/* Sutil textura de papel no fundo (LIGHT) */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 500px at 88% 12%, rgba(216,155,58,.12), transparent 60%),
    radial-gradient(700px 400px at 12% 88%, rgba(184,85,58,.09), transparent 60%);
  pointer-events: none; z-index: 0;
}
body.theme-dark::before {
  background:
    radial-gradient(900px 500px at 90% 10%, rgba(239,183,89,.10), transparent 60%),
    radial-gradient(700px 400px at 8% 92%, rgba(224,112,80,.08), transparent 60%);
}

/* ------------------------------------------------------------------
   3. LAYOUT BASE
   ------------------------------------------------------------------ */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
@media (max-width: 992px) {
  .hero { grid-template-columns: 1fr; }
}

/* ---------------- LADO ESQUERDO (visual) ---------------- */
.left {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 20% 20%, rgba(216,155,58,.28), transparent 60%),
    radial-gradient(700px 400px at 80% 85%, rgba(184,85,58,.35), transparent 60%),
    linear-gradient(155deg, var(--night) 0%, var(--night-2) 100%);
  color: #f5ede0;
}

/* grão sutil no hero */
.left::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  opacity: .5;
  pointer-events: none;
}

.left-content {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(32px, 6vh, 64px) clamp(28px, 5vw, 72px);
  gap: 2rem;
}

/* logo hero */
.brand-mini { display: flex; align-items: center; gap: 14px; }
.brand-mini img {
  height: 72px; width: auto;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.35));
}
.brand-kicker {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #f1c678;
  background: rgba(216,155,58,.08);
  border: 1px solid rgba(216,155,58,.32);
  padding: .35rem .9rem;
  border-radius: var(--r-pill);
  margin-bottom: 1rem;
}

/* versículo / frase rotativa em destaque */
.hero-verse {
  max-width: 580px;
}
.hero-verse h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  line-height: 1.2;
  font-style: italic;
  color: #ffffff;
  margin: 0 0 .75rem;
  text-shadow: 0 2px 24px rgba(0,0,0,.35);
}
.hero-verse cite {
  font-style: normal;
  color: #f1c678;
  font-weight: 500;
  letter-spacing: .04em;
  font-size: .95rem;
}

/* fade entre frases (substitui carousel do Bootstrap visualmente, mas se o
   carousel for mantido, a regra abaixo suaviza a transição) */
.carousel-item { transition: opacity .6s ease !important; }

/* rodapé do hero */
.hero-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  color: rgba(241, 198, 120, .72);
  font-size: .82rem;
  border-top: 1px solid rgba(241,198,120,.14);
  padding-top: 1rem;
}
.hero-footer a {
  color: inherit; text-decoration: none; transition: color .2s;
}
.hero-footer a:hover { color: #f1c678; }

/* ---------------- LADO DIREITO (formulário) ---------------- */
.right {
  display: grid; place-items: center;
  padding: clamp(28px, 6vh, 72px) clamp(20px, 4vw, 48px);
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 38px 34px;
  position: relative;
  animation: cardIn .6s cubic-bezier(.2,.7,.2,1) both;
}
body.theme-dark .login-card {
  background: var(--paper);
  border-color: var(--line);
  box-shadow: var(--shadow-lg);
}

/* filete dourado no topo do card */
.login-card::before {
  content: "";
  position: absolute; top: 0; left: 24px; right: 24px; height: 3px;
  background: linear-gradient(90deg, transparent, var(--amber), var(--terracota), var(--amber), transparent);
  border-radius: 3px;
  opacity: .85;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* cabeçalho do card */
.card-head { text-align: center; margin-bottom: 1.5rem; }
.card-head .logo-sirva {
  height: 46px; width: auto;
  margin-bottom: .75rem;
}
.card-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.65rem;
  margin: 0 0 .2rem;
  letter-spacing: -.01em;
  color: var(--ink);
}
.card-head .subtitle {
  color: var(--ink-soft);
  font-size: .92rem;
  margin: 0;
}

/* ------------------------------------------------------------------
   4. FORMULÁRIO
   ------------------------------------------------------------------ */
.form-label {
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: .4rem;
  letter-spacing: .02em;
}

.input-group .input-group-text {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-right: 0;
  color: var(--amber-d);
  border-radius: var(--r-md) 0 0 var(--r-md);
  padding-left: 14px; padding-right: 14px;
}
body.theme-dark .input-group .input-group-text { color: var(--amber); }

.input-group .form-control {
  border: 1px solid var(--line);
  border-left: 0;
  background: var(--paper);
  color: var(--ink);
  padding: .78rem 1rem;
  font-size: .98rem;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  transition: border-color .2s, box-shadow .2s;
}
.input-group .form-control::placeholder { color: var(--ink-soft); opacity: .55; }
.input-group .form-control:focus {
  border-color: var(--amber);
  box-shadow: var(--shadow-glow);
  background: var(--paper);
  color: var(--ink);
}
.input-group:focus-within .input-group-text {
  border-color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, var(--cream-2));
}

/* ------------------------------------------------------------------
   5. BOTÕES
   ------------------------------------------------------------------ */
.btn {
  border-radius: var(--r-md);
  font-weight: 500;
  letter-spacing: .01em;
  padding: .78rem 1.2rem;
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px); }

/* primário (brand) — gradiente terracota → âmbar */
.btn-brand {
  background: linear-gradient(95deg, var(--terracota) 0%, var(--amber) 100%);
  color: #fff;
  border: 0;
  box-shadow: 0 10px 24px -8px rgba(184,85,58,.55);
}
.btn-brand:hover {
  color: #fff;
  filter: brightness(1.06);
  box-shadow: 0 14px 30px -8px rgba(184,85,58,.65);
}
.btn-brand:focus-visible {
  box-shadow: var(--shadow-glow), 0 10px 24px -8px rgba(184,85,58,.55);
}
.btn-brand:disabled,
.btn-brand.disabled {
  opacity: .65;
  filter: grayscale(.3);
  cursor: not-allowed;
  box-shadow: none;
}

/* botão WhatsApp (oliva elegante — NÃO verde neon) */
.btn-whatsapp {
  background: transparent;
  color: var(--olive-d);
  border: 1px solid var(--olive);
  font-weight: 500;
}
body.theme-dark .btn-whatsapp { color: var(--olive); border-color: var(--olive); }
.btn-whatsapp:hover {
  background: var(--olive);
  color: #fff;
  border-color: var(--olive);
}
.btn-whatsapp.disabled,
.btn-whatsapp:disabled {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
  cursor: not-allowed;
  opacity: .75;
}

/* outline-secondary refinado */
.btn-outline-secondary {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background: transparent;
}
.btn-outline-secondary:hover {
  background: var(--cream-2);
  color: var(--ink);
  border-color: var(--line-strong);
}
body.theme-dark .btn-outline-secondary:hover { background: rgba(255,255,255,.05); }

/* btn-link — esqueci minha senha */
.btn-link {
  color: var(--amber-d);
  text-decoration: none;
  font-weight: 500;
}
.btn-link:hover { color: var(--terracota); text-decoration: underline; }
body.theme-dark .btn-link { color: var(--amber); }
body.theme-dark .btn-link:hover { color: var(--terracota); }

/* ------------------------------------------------------------------
   6. AÇÕES DO FORMULÁRIO — nova hierarquia
   ------------------------------------------------------------------ */
.form-actions {
  display: flex; flex-direction: column; gap: .6rem;
  margin-top: 1.1rem;
}
.form-actions .btn-brand {
  width: 100%;
  padding: .9rem;
  font-size: 1rem;
}

/* divisor "ou" entre métodos */
.or-sep {
  display: flex; align-items: center; gap: .8rem;
  color: var(--ink-soft);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin: .75rem 0;
}
.or-sep::before,
.or-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ------------------------------------------------------------------
   7. SWITCH TEMA (header flutuante)
   ------------------------------------------------------------------ */
.theme-switch {
  position: fixed; top: 18px; right: 20px;
  z-index: 60;
}
.theme-switch .btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
}
.theme-switch .btn:hover {
  background: var(--cream-2);
  color: var(--amber-d);
  transform: rotate(-8deg);
}
body.theme-dark .theme-switch .btn:hover { color: var(--amber); }

/* ------------------------------------------------------------------
   8. RODAPÉ DO CARD (links)
   ------------------------------------------------------------------ */
.card-foot {
  margin-top: 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: .5rem 1.2rem;
}
.card-foot a {
  color: var(--ink-soft);
  font-size: .82rem;
  text-decoration: none;
  transition: color .15s;
}
.card-foot a:hover { color: var(--amber-d); text-decoration: underline; }
body.theme-dark .card-foot a:hover { color: var(--amber); }

/* ------------------------------------------------------------------
   9. MODAIS
   ------------------------------------------------------------------ */
.modal-content {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-content::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--terracota), var(--amber));
  z-index: 2;
}
.modal-header {
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 1.4rem;
  background: transparent;
}
.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  font-size: 1.25rem;
  letter-spacing: -.01em;
}
.modal-body  { padding: 1.4rem; }
.modal-footer {
  border-top: 1px solid var(--line);
  padding: 1rem 1.4rem;
  gap: .5rem;
}
.btn-close { filter: none; }
body.theme-dark .btn-close { filter: invert(.9); }

/* aviso "esqueci minha senha" dentro do modal de senha */
.forgot-hint {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem;
  background: linear-gradient(90deg, rgba(216,155,58,.12), rgba(216,155,58,.04));
  border: 1px solid rgba(216,155,58,.28);
  border-radius: var(--r-md);
  padding: .7rem .9rem;
  font-size: .88rem;
  color: var(--ink);
}
.forgot-hint .label { display: inline-flex; align-items: center; gap: .5rem; }
.forgot-hint .label i { color: var(--amber-d); }
body.theme-dark .forgot-hint .label i { color: var(--amber); }
.forgot-hint .btn {
  background: var(--amber);
  color: #2b2420;
  border: 0;
  padding: .35rem .85rem;
  font-size: .82rem;
  font-weight: 600;
}
.forgot-hint .btn:hover { background: var(--amber-d); color: #fff; }

/* switch 2FA refinado (vai dentro do modal de senha) */
.form-switch {
  padding-left: 2.8em;
  margin-top: 1rem;
}
.form-switch .form-check-input {
  width: 2.2em; height: 1.2em;
  background-color: var(--cream-2);
  border-color: var(--line-strong);
  cursor: pointer;
  margin-left: -2.8em;
}
.form-switch .form-check-input:checked {
  background-color: var(--olive);
  border-color: var(--olive);
}
.form-switch .form-check-input:focus {
  box-shadow: var(--shadow-glow);
  border-color: var(--amber);
}
.form-switch .form-check-label {
  font-size: .85rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.form-switch .form-check-label strong { color: var(--ink); }

/* ------------------------------------------------------------------
   10. OTP (código de verificação)
   ------------------------------------------------------------------ */
.otp-head {
  text-align: center; margin-bottom: 1.4rem;
}
.otp-head img { height: 40px; }
.otp-head h5 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: .7rem 0 .25rem;
  color: var(--ink);
}
#otpChannel {
  color: var(--ink-soft);
  font-size: .88rem;
}
#otpTimerBox {
  margin-top: .4rem;
  font-weight: 600;
  font-size: .9rem;
  color: var(--terracota);
}
body.theme-dark #otpTimerBox { color: var(--terracota); }

.otp-grid {
  display: flex; gap: 10px; justify-content: center;
  margin: 1rem 0 1.2rem;
}
.otp-grid input {
  width: 46px; height: 56px;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 600;
  font-family: var(--font-display);
  border-radius: var(--r-md);
  border: 1.5px solid var(--line-strong);
  background: var(--cream-1);
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.otp-grid input:focus {
  border-color: var(--amber);
  background: var(--paper);
  box-shadow: var(--shadow-glow);
}

.shake { animation: shake .3s; }
@keyframes shake {
  0%,100%{ transform:translateX(0) }
  25%{ transform:translateX(-4px) }
  50%{ transform:translateX(4px) }
  75%{ transform:translateX(-2px) }
}

.otp-footnote {
  text-align: center;
  margin-top: 1rem;
  color: var(--ink-soft);
  font-size: .8rem;
  font-style: italic;
}
.otp-footnote strong { color: var(--amber-d); font-style: normal; }

/* ------------------------------------------------------------------
   11. MVV (Modal) — limpo e legível
   ------------------------------------------------------------------ */
.mvv-card {
  background: var(--cream-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1rem;
  color: var(--ink);
}
.mvv-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--terracota-d);
  font-size: .78rem;
  margin: 0 0 .35rem;
}
body.theme-dark .mvv-title { color: var(--amber); }
.mvv-text { color: var(--ink); line-height: 1.6; font-size: .9rem; margin: 0; }
.mvv-sep  { border: 0; border-top: 1px solid var(--line-strong); opacity: .7; margin: .5rem 0 .8rem; }

/* ------------------------------------------------------------------
   12. ALERT / AVISO
   ------------------------------------------------------------------ */
.alert {
  border-radius: var(--r-md);
  border: 1px solid transparent;
  padding: .75rem 1rem;
}
.alert-warning {
  background: rgba(216, 155, 58, .10);
  border-color: rgba(216, 155, 58, .34);
  color: var(--ink);
}
body.theme-dark .alert-warning {
  background: rgba(239, 183, 89, .10);
  border-color: rgba(239, 183, 89, .30);
  color: var(--ink);
}
.blink-arrow { display: inline-block; animation: blinkArrow 1.2s ease-in-out infinite; }
@keyframes blinkArrow {
  0%, 100% { opacity: .3; transform: translateX(0); }
  50%      { opacity: 1;  transform: translateX(4px); }
}

/* ------------------------------------------------------------------
   13. RESPONSIVO
   ------------------------------------------------------------------ */
@media (max-width: 992px) {
  .left { display: none; }
  .right { padding: clamp(20px, 5vh, 40px) clamp(16px, 5vw, 28px); }
  .login-card {
    padding: 28px 22px;
    border-radius: var(--r-md);
  }
  .card-head h2 { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .otp-grid input { width: 40px; height: 50px; font-size: 1.2rem; }
  .card-foot { gap: .4rem .9rem; }
  .card-foot a { font-size: .78rem; }
  .forgot-hint {
    flex-direction: column; align-items: stretch;
  }
  .forgot-hint .btn { width: 100%; }
}

/* 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;
  }
}

/* Foco visível em tudo que interage (acessibilidade) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* SweetAlert — ajustinho leve pra combinar com a paleta */
.swal2-popup { border-radius: var(--r-lg) !important; font-family: var(--font-body) !important; }
.swal2-styled.swal2-confirm {
  background: linear-gradient(95deg, var(--terracota), var(--amber)) !important;
  border: 0 !important;
  border-radius: var(--r-md) !important;
}
