/* ============================================================
   SGCMI · Login — login.css
   Folha de estilos independente e otimizada (Zero unused CSS).
   Design System unificado, suporte total aos 9 temas, glassmorphism,
   micro-interações e compatibilidade mobile perfeita.
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

/* ============================================================
   DESIGN TOKENS — CONTRATO DE CORES E TEMAS DO SGCMI
   ============================================================ */
:root {
  --bg: #f7f6f3;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #f1efea;
  --bg-sunken: #f0eee9;

  --border: #e8e5df;
  --border-light: #f0eee8;
  --border-strong: #d9d5cc;

  --text: #201d18;
  --text-secondary: #756e62;
  --text-muted: #a49c8c;

  --accent: #3730a3;
  --accent-2: #4f46e5;
  --accent-soft: #edecfb;
  --accent-hover: #2e2786;
  --accent-ring: rgba(55, 48, 163, 0.14);

  --red: #b23b3b;
  --red-soft: #f8eaea;

  --shadow-sm: 0 1px 2px rgba(32, 29, 24, 0.05);
  --shadow: 0 2px 8px rgba(32, 29, 24, 0.05), 0 1px 2px rgba(32, 29, 24, 0.04);
  --shadow-lg: 0 12px 32px rgba(32, 29, 24, 0.08), 0 2px 8px rgba(32, 29, 24, 0.04);

  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
}

/* ---- ESCURO ---- */
[data-theme="dark"] {
  --bg: #14120e;
  --bg-surface: #1c1913;
  --bg-elevated: #211d17;
  --bg-hover: #26221b;
  --bg-sunken: #100e0a;
  --border: #3a3429;
  --border-light: #302b22;
  --border-strong: #514a3b;
  --text: #f3f1ec;
  --text-secondary: #dad4ca;
  --text-muted: #aaa08a;
  --accent: #a29bfe;
  --accent-2: #8b7ffb;
  --accent-soft: #26234a;
  --accent-hover: #b8b2ff;
  --accent-ring: rgba(162, 155, 254, 0.16);
  --red: #e08080;
  --red-soft: #351919;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ---- SANTUÁRIO ---- */
[data-theme="santuario"] {
  --bg: #101020;
  --bg-surface: #1a1a2e;
  --bg-elevated: #22223c;
  --bg-hover: #2b2b48;
  --bg-sunken: #0b0b16;
  --border: #2f2f4e;
  --border-light: #262640;
  --border-strong: #464670;
  --text: #f0e9dc;
  --text-secondary: #c2b49a;
  --text-muted: #9a8f7c;
  --accent: #e2c275;
  --accent-2: #d0ac57;
  --accent-soft: rgba(226, 194, 117, .14);
  --accent-hover: #eed596;
  --accent-ring: rgba(226, 194, 117, .24);
  --red: #ea8585;
  --red-soft: rgba(234, 133, 133, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
}

/* ---- PERGAMINHO ---- */
[data-theme="pergaminho"] {
  --bg: #f0e5cd;
  --bg-surface: #fdf7e9;
  --bg-elevated: #fffcf3;
  --bg-hover: #f3e8d0;
  --bg-sunken: #e7dbbc;
  --border: #ddcba7;
  --border-light: #ebdcbd;
  --border-strong: #bda87f;
  --text: #2f2019;
  --text-secondary: #66513f;
  --text-muted: #82694f;
  --accent: #a83527;
  --accent-2: #c0392b;
  --accent-soft: rgba(168, 53, 39, .10);
  --accent-hover: #8a2a1e;
  --accent-ring: rgba(168, 53, 39, .20);
  --red: #a83527;
  --red-soft: rgba(168, 53, 39, .11);
  --shadow-sm: 0 1px 2px rgba(69, 46, 28, .07);
  --shadow: 0 2px 10px rgba(69, 46, 28, .09), 0 1px 2px rgba(69, 46, 28, .06);
  --shadow-lg: 0 14px 36px rgba(69, 46, 28, .14), 0 2px 8px rgba(69, 46, 28, .07);
}

/* ---- CELESTE ---- */
[data-theme="celeste"] {
  --bg: #e4edfa;
  --bg-surface: #f8fbff;
  --bg-elevated: #ffffff;
  --bg-hover: #e9f1fd;
  --bg-sunken: #d9e5f6;
  --border: #ccdcf0;
  --border-light: #dfeaf8;
  --border-strong: #a3bcdc;
  --text: #12253b;
  --text-secondary: #41617f;
  --text-muted: #5f7288;
  --accent: #1f66ab;
  --accent-2: #3d8ad4;
  --accent-soft: rgba(31, 102, 171, .08);
  --accent-hover: #164e8b;
  --accent-ring: rgba(31, 102, 171, .20);
  --red: #b73535;
  --red-soft: rgba(183, 53, 53, .11);
  --shadow-sm: 0 1px 2px rgba(18, 37, 59, .06);
  --shadow: 0 2px 10px rgba(18, 37, 59, .08), 0 1px 2px rgba(18, 37, 59, .05);
  --shadow-lg: 0 14px 36px rgba(18, 37, 59, .13), 0 2px 8px rgba(18, 37, 59, .06);
}

/* ---- OLIVEIRA ---- */
[data-theme="oliveira"] {
  --bg: #e6f0e4;
  --bg-surface: #f8fbf6;
  --bg-elevated: #ffffff;
  --bg-hover: #e9f3e6;
  --bg-sunken: #dbe9d8;
  --border: #cbdec6;
  --border-light: #dcebd8;
  --border-strong: #a2c19b;
  --text: #152719;
  --text-secondary: #436046;
  --text-muted: #5d7a5c;
  --accent: #2b7530;
  --accent-2: #3d9142;
  --accent-soft: rgba(43, 117, 48, .10);
  --accent-hover: #1f5722;
  --accent-ring: rgba(43, 117, 48, .20);
  --red: #ad3737;
  --red-soft: rgba(173, 55, 55, .11);
  --shadow-sm: 0 1px 2px rgba(21, 39, 25, .06);
  --shadow: 0 2px 10px rgba(21, 39, 25, .08), 0 1px 2px rgba(21, 39, 25, .05);
  --shadow-lg: 0 14px 36px rgba(21, 39, 25, .13), 0 2px 8px rgba(21, 39, 25, .06);
}

/* ---- BRASA ---- */
[data-theme="brasa"] {
  --bg: #150e0e;
  --bg-surface: #201717;
  --bg-elevated: #291d1d;
  --bg-hover: #342424;
  --bg-sunken: #0e0808;
  --border: #3a2a28;
  --border-light: #302322;
  --border-strong: #543c39;
  --text: #f6e9e2;
  --text-secondary: #c8ab9d;
  --text-muted: #a08376;
  --accent: #f2764a;
  --accent-2: #e85d3a;
  --accent-soft: rgba(242, 118, 74, .14);
  --accent-hover: #ff8f66;
  --accent-ring: rgba(242, 118, 74, .24);
  --red: #ef7d7d;
  --red-soft: rgba(239, 125, 125, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
}

/* ---- VITRAL ---- */
[data-theme="vitral"] {
  --bg: #1e1f29;
  --bg-surface: #282a36;
  --bg-elevated: #313342;
  --bg-hover: #3b3e52;
  --bg-sunken: #191a21;
  --border: #3d4053;
  --border-light: #33364a;
  --border-strong: #565a75;
  --text: #f8f8f2;
  --text-secondary: #bfc3d9;
  --text-muted: #9ea3c0;
  --accent: #bd93f9;
  --accent-2: #a679f0;
  --accent-soft: rgba(189, 147, 249, .12);
  --accent-hover: #d3b2ff;
  --accent-ring: rgba(189, 147, 249, .26);
  --red: #ff6e6e;
  --red-soft: rgba(255, 110, 110, .09);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
}

/* ---- VIGÍLIA ---- */
[data-theme="vigilia"] {
  --bg: #0d1117;
  --bg-surface: #161b22;
  --bg-elevated: #1c2128;
  --bg-hover: #22282f;
  --bg-sunken: #010409;
  --border: #30363d;
  --border-light: #262c34;
  --border-strong: #484f58;
  --text: #e6edf3;
  --text-secondary: #9ba7b4;
  --text-muted: #868e99;
  --accent: #58a6ff;
  --accent-2: #388bfd;
  --accent-soft: rgba(88, 166, 255, .12);
  --accent-hover: #79b8ff;
  --accent-ring: rgba(88, 166, 255, .24);
  --red: #ff7b72;
  --red-soft: rgba(255, 123, 114, .12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
}

/* ============================================================
   ÍCONES E UTILITÁRIOS BASE
   ============================================================ */
.material-symbols-rounded,
.dn-icon {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   SELETOR DE TEMAS (DROPDOWN)
   ============================================================ */
.dn-theme-wrap {
  position: relative;
}

.dn-theme-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 15px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.dn-theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.dn-theme-btn .dn-icon {
  font-size: 22px;
}

.dn-theme-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 240px;
  max-width: calc(100vw - 24px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .22);
  padding: 8px;
  z-index: 200;
  max-height: 80vh;
  overflow-y: auto;
  animation: tmSlideUp .18s ease;
}

[data-theme] .dn-theme-dropdown {
  box-shadow: var(--shadow-lg);
}

.dn-theme-dropdown.open {
  display: block;
}

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

.tm-section {
  padding: 4px 6px;
}

.tm-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 6px 10px 4px;
}

.tm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
}

.tm-row:hover {
  background: var(--bg-hover);
}

.tm-row.selected {
  background: var(--accent-soft);
}

.tm-row .tm-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .12s;
}

.tm-row.selected .tm-radio {
  border-color: var(--accent);
}

.tm-row.selected .tm-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.tm-row-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.tm-swatch-group {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.tm-swatch {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, .08);
}

[data-theme] .tm-swatch {
  border-color: var(--border-strong);
}

.tm-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

/* Swatches de tema */
.tm-swatch-light { background: #faf8f5; }
.tm-swatch-dark { background: #1c1913; }
.tm-swatch-santuario { background: #1a1a2e; }
.tm-swatch-santuario2 { background: #e2c275; }
.tm-swatch-pergaminho { background: #f0e5cd; }
.tm-swatch-pergaminho2 { background: #a83527; }
.tm-swatch-celeste { background: #e4edfa; }
.tm-swatch-celeste2 { background: #2472bd; }
.tm-swatch-oliveira { background: #e6f0e4; }
.tm-swatch-oliveira2 { background: #2b7530; }
.tm-swatch-brasa { background: #201717; }
.tm-swatch-brasa2 { background: #f2764a; }
.tm-swatch-vitral { background: #282a36; }
.tm-swatch-vitral2 { background: #bd93f9; }
.tm-swatch-vigilia { background: #0d1117; }
.tm-swatch-vigilia2 { background: #58a6ff; }

/* ============================================================
   ESTRUTURA DA PÁGINA DE LOGIN
   ============================================================ */
.dn-login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 24px 16px;
  background: var(--bg);
  font-family: var(--font-ui, 'Inter', system-ui, -apple-system, sans-serif);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  transition: background .25s ease, color .25s ease;
  overflow-x: hidden;
}

/* Fundo com gradientes radiais suaves e atmosfera */
.dn-login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 15% 20%, var(--accent-ring) 0%, transparent 60%),
    radial-gradient(ellipse at 85% 80%, var(--accent-ring) 0%, transparent 60%);
  opacity: .75;
  transition: opacity .3s ease;
}

/* Canvas da Constelação + Estrelas Sparkles */
.dn-login-constellation {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Seletor de tema (canto superior direito) */
.dn-login-theme {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
}

/* ===== CARD CENTRAL GLASSMORPHIC ===== */
.dn-login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1.2px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg), 0 10px 32px rgba(0, 0, 0, 0.08);
  padding: 36px 28px 28px;
  text-align: center;
  animation: dn-login-in .8s cubic-bezier(.16, 1, .3, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}

[data-theme="dark"] .dn-login-card,
[data-theme="santuario"] .dn-login-card,
[data-theme="celeste"] .dn-login-card,
[data-theme="oliveira"] .dn-login-card,
[data-theme="brasa"] .dn-login-card,
[data-theme="vitral"] .dn-login-card,
[data-theme="vigilia"] .dn-login-card {
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45), 0 0 1px 1px rgba(255, 255, 255, 0.06);
}

@keyframes dn-login-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== LOGO CONTAINER ===== */
.dn-login-logo {
  width: 110px;
  height: 110px;
  margin: 0 auto 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: 26px;
  border: 1.5px solid var(--accent-ring);
  box-shadow: 0 0 24px var(--accent-ring), 0 6px 16px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  transition: transform .3s cubic-bezier(.16, 1, .3, 1), box-shadow .3s ease, border-color .3s ease;
}

.dn-login-logo:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 32px var(--accent-ring), 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--accent);
}

.dn-login-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 24px;
  display: block;
}

/* ===== TIPOGRAFIA DO CABEÇALHO ===== */
.dn-login-title {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.5px;
  line-height: 1.15;
}

.dn-login-subtitle {
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 400;
  margin: 0 0 32px;
  line-height: 1.45;
  letter-spacing: .05px;
}

/* ===== MENSAGEM DE ERRO ===== */
.dn-login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  animation: dn-login-in .3s ease;
}

.dn-login-error .dn-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* ===== BOTÃO GOOGLE OAUTH ===== */
.dn-oauth-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1.2px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .1px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: border-color .2s ease, transform .2s cubic-bezier(.16, 1, .3, 1), box-shadow .2s ease;
  gap: 12px;
}

.dn-oauth-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .15), transparent);
  transition: left .6s ease;
}

.dn-oauth-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-ring), 0 0 0 3px var(--accent-ring);
}

.dn-oauth-btn:hover::before {
  left: 100%;
}

.dn-oauth-btn:active {
  transform: translateY(0) scale(.99);
}

.dn-oauth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.dn-oauth-text {
  white-space: nowrap;
}

/* ===== AVISOS INFORMATIVOS E RODAPÉ ===== */
.dn-login-info {
  font-family: var(--font-ui, 'Inter', sans-serif);
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 22px 0 0;
  line-height: 1.5;
}

.dn-login-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dn-login-footer .dn-icon {
  font-size: 15px;
  opacity: .9;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 480px) {
  .dn-login-card {
    padding: 30px 20px 24px;
    border-radius: 20px;
  }

  .dn-login-logo {
    width: 96px;
    height: 96px;
    border-radius: 22px;
  }

  .dn-login-logo-img {
    border-radius: 20px;
  }

  .dn-login-title {
    font-size: 26px;
  }

  .dn-login-subtitle {
    font-size: 12.5px;
    margin-bottom: 26px;
  }

  .dn-oauth-btn {
    height: 48px;
    font-size: 14.5px;
  }
}