/* CONFIGURAÇÕES DE IMPRESSÃO PROFISSIONAL */
@media screen {
  #relatorio-print {
    display: none;
  }
}

@media print {
  body *:not(#relatorio-print):not(#relatorio-print *) {
    display: none;
  }

  #relatorio-print {
    display: block;
    width: 100%;
    background: white;
    color: black;
    font-family: "Segoe UI", Tahoma, sans-serif;
    margin: 0;
    padding: 0;
  }

  #relatorio-print,
  #relatorio-print * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  #relatorio-print table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
  }

  #relatorio-print th,
  #relatorio-print td {
    border: 1px solid black;
    padding: 6px;
    text-align: left;
    vertical-align: top;
  }

  #relatorio-print h2,
  #relatorio-print h3 {
    margin-top: 8px;
    border-bottom: 1px solid black;
    padding-bottom: 3px;
    text-transform: uppercase;
    font-size: 1.2em;
  }

  #relatorio-print h2 {
    font-size: 1.4em;
    margin-bottom: 6px;
  }

  #relatorio-print p {
    margin: 8px 0;
    line-height: 1.3;
  }

  #relatorio-print .memoria-calculo {
    background: #f5f5f5;
    padding: 6px;
    border-radius: 4px;
    margin: 8px 0;
    font-size: 0.9em;
  }

  #relatorio-print table,
  #relatorio-print .conclusao {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  #relatorio-print > :last-child {
    page-break-after: avoid;
    break-after: avoid;
  }

  @page {
    size: A4;
    margin: 0.5cm;
  }

  body *:not(#relatorio-comparativo-print):not(#relatorio-comparativo-print *) {
    display: none;
  }
  #relatorio-comparativo-print {
    display: block;
    width: 100%;
    background: white;
    color: black;
    font-family: "Segoe UI", Tahoma, sans-serif;
    margin: 0;
    padding: 1.5cm;
  }
  #relatorio-comparativo-print table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
  }
  #relatorio-comparativo-print th,
  #relatorio-comparativo-print td {
    border: 1px solid #000;
    padding: 6px;
    text-align: left;
    vertical-align: top;
  }
  #relatorio-comparativo-print h2,
  #relatorio-comparativo-print h3 {
    margin-top: 8px;
    border-bottom: 1px solid black;
    padding-bottom: 3px;
  }
  #relatorio-comparativo-print th {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  @page {
    size: A4;
    margin: 1.5cm;
  }
}

/* Botão gerar PDF no modal */
.btn-pdf {
  background-color: #dc2626;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-pdf:hover {
  background-color: #b91c1c;
}

/* Modal simples */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1100;
}

.modal-content {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  text-align: center;
  color: #1e293b;
}

body.theme-modern .modal-content {
  background: #1e2035;
  color: #eeeeff;
}

.modal-content p {
  margin: 16px 0;
  font-size: 16px;
}

.modal-content h3 {
  color: var(--primary);
}

.modal-close {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

/* ===== TELA DE LOGIN ===== */
#login-overlay.auth-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: stretch;
  min-height: 100svh;
  height: auto;
  width: 100%;
  position: relative;
  background: #d9edf2 url("/background-login-flat.png") no-repeat center center / cover;
}

#login-overlay.auth-container::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(11, 41, 58, 0.66) 0%,
    rgba(15, 91, 103, 0.34) 52%,
    rgba(248, 250, 252, 0.74) 100%
  );
  backdrop-filter: saturate(0.98);
  -webkit-backdrop-filter: saturate(0.98);
  z-index: 1;
  pointer-events: none;
  transition: backdrop-filter 0.5s ease, -webkit-backdrop-filter 0.5s ease, background 0.5s ease;
}

#login-overlay .auth-panel-left,
#login-overlay .auth-panel-right {
  position: relative;
  z-index: 2;
}

@media (hover: hover) and (pointer: fine) {
  #login-overlay.auth-container:hover::before {
    backdrop-filter: blur(5px) saturate(0.92) brightness(1.02);
    -webkit-backdrop-filter: blur(5px) saturate(0.92) brightness(1.02);
  }

  #login-overlay.auth-container:has(.auth-panel-right:hover)::before,
  #login-overlay.auth-container:has(.auth-card:hover)::before {
    backdrop-filter: saturate(0.98);
    -webkit-backdrop-filter: saturate(0.98);
  }
}

#login-overlay .auth-panel-right {
  background: rgba(248, 250, 252, 0.38);
  border-left: 1px solid rgba(255, 255, 255, 0.48);
  backdrop-filter: blur(20px) saturate(1.04);
  -webkit-backdrop-filter: blur(20px) saturate(1.04);
}

#login-overlay .auth-card {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  width: 100%;
  max-width: 370px;
  min-height: auto;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.88);
  box-shadow:
    0 24px 60px rgba(15, 74, 104, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.45);
  border-radius: 18px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  overflow: visible;
}

#login-overlay .auth-header {
  text-align: center;
  margin-bottom: 28px;
}

#login-overlay .auth-hero-action {
  width: fit-content;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

#login-overlay .auth-hero-action:hover {
  background: rgba(6, 182, 212, 0.26);
  border-color: rgba(103, 232, 249, 0.68);
  color: #ecfeff;
  transform: translateY(-1px);
}

#login-overlay .auth-hero-action:focus-visible {
  outline: 3px solid rgba(34, 211, 238, 0.42);
  outline-offset: 3px;
}

#login-overlay .auth-features {
  gap: 16px;
  max-width: 640px;
}

#login-overlay .auth-feature-item {
  align-items: flex-start;
  font-size: 13.5px;
  line-height: 1.55;
}

#login-overlay .auth-header img {
  height: 110px !important;
  width: auto !important;
  display: block;
  margin: 0 auto 14px;
  filter:
    drop-shadow(0 6px 18px rgba(8, 90, 170, 0.22))
    drop-shadow(0 2px 6px rgba(8, 90, 170, 0.12));
}

#login-overlay .auth-header h2 {
  font-size: 26px !important;
  font-weight: 700;
  color: #0d1b2e;
  margin-bottom: 4px;
  letter-spacing: -0.4px;
}

#login-overlay .auth-header p {
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}

#login-overlay .auth-card label {
  font-size: 12.5px;
  font-weight: 600;
  color: #2d3e52;
  margin-bottom: 5px;
  display: block;
  letter-spacing: 0.1px;
}

#login-overlay .auth-card input[type="email"],
#login-overlay .auth-card input[type="password"],
#login-overlay .auth-card input[type="text"] {
  font-size: 14px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1.5px solid #dde6ef;
  background: #f5f9fc;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  width: 100%;
  box-sizing: border-box;
  color: #0d1b2e;
}

#login-overlay .auth-card input:focus {
  border-color: #1094c8;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(16, 148, 200, 0.14);
  outline: none;
}

#login-overlay .form-group {
  margin-bottom: 14px;
}

#login-overlay #btnLogar {
  background: linear-gradient(135deg, #1094c8 0%, #0561a0 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  padding: 13px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  border: none;
  width: 100%;
  cursor: pointer;
  margin-bottom: 14px;
  transition: opacity 0.18s, transform 0.13s, box-shadow 0.18s;
  box-shadow: 0 4px 16px rgba(16, 148, 200, 0.34);
}

#login-overlay #btnLogar:hover {
  opacity: 0.93;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(16, 148, 200, 0.42);
}

#login-overlay #btnLogar:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(16, 148, 200, 0.28);
}

#forgot-password {
  color: #1094c8 !important;
  font-weight: 500;
  font-size: 13px;
  transition: opacity 0.15s;
}

#forgot-password:hover {
  opacity: 0.72;
  text-decoration: underline;
}

#login-overlay #show-signup {
  color: #1094c8 !important;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

#login-overlay #show-signup:hover {
  color: #0561a0 !important;
  border-bottom-color: #0561a0;
}

#login-overlay #show-login {
  color: #1094c8 !important;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s;
}

#login-overlay .auth-card a {
  font-size: 13px;
}

#login-overlay .app-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #eef3f8;
  text-align: center;
}

@media (max-width: 1024px) {
  #login-overlay .auth-card {
    padding: 44px 44px 32px;
  }
}

@media (max-width: 768px) {
  #login-overlay.auth-container {
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: 0;
    min-height: 100svh;
    height: auto;
  }

  #login-overlay.auth-container::before {
    left: 0;
    background: linear-gradient(
      180deg,
      rgba(7, 38, 56, 0.74) 0%,
      rgba(217, 237, 242, 0.74) 38%,
      rgba(248, 250, 252, 0.9) 100%
    );
    backdrop-filter: blur(6px) saturate(0.95);
    -webkit-backdrop-filter: blur(6px) saturate(0.95);
  }

  #login-overlay .auth-panel-left {
    flex: 0 0 auto;
    min-height: 0;
    padding: 22px 20px 14px;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
  }

  #login-overlay .auth-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0;
  }

  #login-overlay .auth-hero-eyebrow {
    max-width: min(100%, 320px);
    margin: 0;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
    padding: 8px 14px;
  }

  #login-overlay .auth-hero-title {
    max-width: 320px;
    margin: 0;
    font-size: 24px;
    line-height: 1.16;
  }

  #login-overlay .auth-hero-subtitle,
  #login-overlay .auth-features,
  #login-overlay .auth-panel-stamp {
    display: none;
  }

  #login-overlay .auth-panel-right {
    width: 100%;
    min-width: 0;
    flex: 1 0 auto;
    padding: 8px 16px 28px;
    border-left: 0;
    border-top: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #login-overlay .auth-card {
    width: 100%;
    max-width: 420px;
    min-height: auto;
    height: auto;
    margin: 0 auto;
    border: none;
    border-radius: 22px;
    padding: 32px 28px 24px;
    box-shadow: 0 20px 52px rgba(8, 50, 110, 0.18);
    overflow: visible;
    justify-content: flex-start;
  }

  #login-overlay .auth-card > *:first-child { margin-top: 0; }
  #login-overlay .auth-card > *:last-child  { margin-bottom: 0; }

  #login-overlay .auth-header {
    text-align: center;
    margin-bottom: 20px;
  }

  #login-overlay .auth-header img {
    height: 88px !important;
    margin-bottom: 10px;
  }

  #login-overlay .auth-header h2 {
    font-size: 22px !important;
  }

  #login-overlay .form-group {
    margin-bottom: 12px;
  }

  #login-overlay .app-footer { text-align: center; }
}

@media (max-width: 480px) {
  #login-overlay.auth-container {
    padding: 0;
  }

  #login-overlay .auth-panel-left {
    padding: 16px 14px 10px;
  }

  #login-overlay .auth-hero-title {
    font-size: 21px;
  }

  #login-overlay .auth-card {
    padding: 24px 20px 20px;
    border-radius: 18px;
  }

  #login-overlay .auth-header img {
    height: 76px !important;
  }

  #login-overlay .auth-header h2 {
    font-size: 20px !important;
  }

  #login-overlay .auth-header {
    margin-bottom: 16px;
  }

  #login-overlay .form-group {
    margin-bottom: 10px;
  }
}

@media (max-width: 380px) {
  #login-overlay .auth-options-row {
    gap: 10px;
  }

  #login-overlay #forgot-password {
    max-width: 132px;
    line-height: 1.2;
    text-align: right;
  }
}

body.theme-modern #login-overlay.auth-container {
  background-color: #07151b;
}

body.theme-modern #login-overlay.auth-container::before {
  background: linear-gradient(
    100deg,
    rgba(4, 16, 28, 0.82) 0%,
    rgba(6, 40, 55, 0.58) 54%,
    rgba(7, 12, 24, 0.84) 100%
  );
}

body.theme-modern #login-overlay .auth-panel-right {
  background: rgba(7, 12, 24, 0.64);
  border-left-color: rgba(34, 211, 238, 0.12);
  backdrop-filter: blur(24px) saturate(0.94);
  -webkit-backdrop-filter: blur(24px) saturate(0.94);
}

body.theme-modern #login-overlay .auth-card {
  background: rgba(18, 19, 30, 0.9);
  border-color: rgba(34, 211, 238, 0.13);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(34, 211, 238, 0.06);
}

body.theme-modern #login-overlay .auth-header h2 {
  color: #f8fafc;
}

body.theme-modern #login-overlay .auth-header p,
body.theme-modern #login-overlay .auth-card p,
body.theme-modern #login-overlay .texto-apoio {
  color: #94a3b8;
}

body.theme-modern #login-overlay .auth-card label {
  color: #cbd5e1;
}

@media (max-width: 768px) {
  body.theme-modern #login-overlay.auth-container::before {
    background: linear-gradient(
      180deg,
      rgba(4, 16, 28, 0.82) 0%,
      rgba(6, 40, 55, 0.72) 42%,
      rgba(7, 12, 24, 0.9) 100%
    );
  }

  body.theme-modern #login-overlay .auth-panel-right {
    background: transparent;
    border-left: 0;
    border-top: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

#pending-overlay.auth-container,
#municipio-select-overlay.auth-container {
  background: #0f172a;
  justify-content: center;
  align-items: center;
  padding-right: 0;
}

#pending-overlay .auth-card,
#municipio-select-overlay .auth-card {
  background: white;
  backdrop-filter: none;
  border: none;
  border-radius: 16px;
  min-height: auto;
  padding: 40px 48px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.signup-autocomplete-dropdown {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 6px;
  max-height: 200px; overflow-y: auto; z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.signup-autocomplete-dropdown .ac-item {
  padding: 8px 12px; cursor: pointer; font-size: 13px; color: #1e293b;
}
.signup-autocomplete-dropdown .ac-item:hover { background: #f1f5f9; color: #0f172a; }

/* Estilo do texto de apoio */
.texto-apoio {
  display: block;
  font-size: 0.85em;
  color: #666;
  margin-top: 4px;
}
