/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --bg-color:    #0f172a;
  --text-color:  #f8fafc;
  --card-bg:     rgba(30, 41, 59, 0.7);
  --primary:     #38bdf8;
  --secondary:   #fbbf24;
  --map-fill:    #1e3a5f;
  --map-stroke:  #60a5fa;
  --map-hover:   #38bdf8;
  --glass-border: rgba(255, 255, 255, 0.1);
  --navbar-h:    70px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  background: radial-gradient(ellipse at top, #1a2744 0%, #0f172a 60%);
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  height: var(--navbar-h);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}

/* Logo — esquerda */
.navbar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  justify-self: start;
}

.navbar-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(251,191,36,0.35));
  transition: filter 0.25s, transform 0.25s;
}

.navbar-logo-img:hover {
  filter: drop-shadow(0 4px 16px rgba(251,191,36,0.6));
  transform: scale(1.04);
}

/* Título — centro */
.navbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #38bdf8, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

/* Botões — direita */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: end;
}

/* Botão Entrar */
.btn-entrar {
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #1a1a1a;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 14px rgba(251,191,36,0.35);
  letter-spacing: 0.01em;
}

.btn-entrar:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(251,191,36,0.5);
}

.btn-entrar:active {
  transform: translateY(0);
}

.btn-full {
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
  margin-top: 0.25rem;
  border-radius: 14px;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  max-width: 1100px;
  width: 100%;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

header {
  text-align: center;
  animation: fadeInDown 0.8s ease-out;
}

h1 {
  font-size: 2.4rem;
  font-weight: 900;
  background: linear-gradient(135deg, #38bdf8, #fbbf24, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

p.subtitle {
  color: #94a3b8;
  font-size: 1.1rem;
}

/* ============================================================
   MAP CONTAINER
   ============================================================ */
.map-container {
  width: 100%;
  max-width: 860px;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6),
              inset 0 1px 0 rgba(255,255,255,0.08);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  animation: fadeInUp 0.8s ease-out;
  min-height: 300px;
}

/* Loading spinner */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: #64748b;
  font-size: 0.95rem;
  position: absolute;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* D3 SVG Map */
#brazil-map {
  display: block;
  width: 100%;
  height: auto;
}

/* Estados */
.state-path {
  fill: var(--map-fill);
  stroke: var(--map-stroke);
  stroke-width: 0.6;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 0.2s ease, filter 0.2s ease;
}

.state-path.hovered {
  fill: var(--map-hover);
  stroke: #fff;
  stroke-width: 1;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

.state-path.active {
  fill: var(--secondary);
  stroke: #fff;
  stroke-width: 1.2;
}

.state-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 8px;
  font-weight: 700;
  fill: rgba(255, 255, 255, 0.75);
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  user-select: none;
  letter-spacing: 0.04em;
}

/* Tooltip */
#tooltip {
  position: fixed;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.88rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.5);
}

.map-footer {
  color: #475569;
  font-size: 0.85rem;
  animation: fadeInUp 1s ease-out;
}

.map-footer p::before {
  content: '👆 ';
}

/* ============================================================
   LOGIN MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-box {
  background: rgba(22, 33, 56, 0.97);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  max-width: 400px;
  width: 90%;
  position: relative;
  box-shadow: 0 30px 60px rgba(0,0,0,0.6);
  animation: scaleIn 0.25s ease;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.modal-logo {
  text-align: center;
  margin-bottom: 1.25rem;
}

.modal-heading {
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.4rem;
  background: linear-gradient(135deg, #38bdf8, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-sub {
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.modal-input:focus {
  border-color: var(--primary);
  background: rgba(56,189,248,0.06);
}

.modal-input::placeholder {
  color: #475569;
}

.modal-msg {
  text-align: center;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 1.2em;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  h1                  { font-size: 1.6rem; }
  .container          { padding: 1rem; }
  p.subtitle          { font-size: 0.95rem; }
  .state-label        { font-size: 6px; }
  .navbar-title       { font-size: 0.85rem; }
  .navbar-logo-img    { height: 40px; }
  .btn-entrar         { padding: 0.5rem 1rem; font-size: 0.82rem; }
}
