:root {
  --primary: #1e3a5f;
  --primary-light: #2563eb;
  --accent: #f59e0b;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 120%, rgb(245 158 11 / 0.22) 0%, transparent 55%),
    linear-gradient(160deg, #0c1929 0%, var(--primary) 38%, #1d4ed8 72%, #0f2744 100%);
  color: #fff;
  padding: 1.8rem 1.5rem 2.2rem;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  background: var(--accent);
  color: #1e293b;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.hero-badge.encerrado {
  background: #dc2626;
  color: #fff;
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.hero-sub {
  margin: 0;
  opacity: 0.92;
  font-size: 0.95rem;
}

.hero-tagline {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  opacity: 0.78;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.evento-intro {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

.page {
  max-width: 1100px;
  margin: 0 auto 2rem;
  padding: 1.5rem 1rem 2rem;
  position: relative;
  z-index: 1;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

.layout > aside,
.layout > .main-col {
  min-width: 0;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 400px;
  }
}

.layout.single-col {
  max-width: 640px;
  margin: 0 auto;
  grid-template-columns: 1fr;
}

.confirmacao-card .form-panel {
  padding: 2rem 1.5rem;
}

.confirmacao-card h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  color: var(--primary);
}

.confirmacao-card .confirmacao-body {
  text-align: left;
  margin: 0 0 1.25rem;
}

.confirmacao-card .status-box {
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  margin: 0 0 1rem;
  line-height: 1.55;
}

.confirmacao-card .status-box.status-confirmado {
  border: 1px solid #bbf7d0;
}

.confirmacao-card .status-box.status-erro {
  border: 1px solid #fecaca;
}

.confirmacao-card .confirmacao-actions {
  margin-top: 1.5rem;
  text-align: center;
}

.confirmacao-card .confirmacao-actions .btn-primary {
  display: inline-block;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.08);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 0.85rem 1.15rem;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.card-body {
  padding: 1.15rem;
}

.form-panel {
  padding: 1.5rem;
}

.sidebar .card {
  margin-bottom: 1.25rem;
}

.sidebar .card:last-child {
  margin-bottom: 0;
}

.main-col .form-card {
  position: sticky;
  top: 1rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.section { display: none; }
.section.active { display: block; }

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input[type="text"],
.field input[type="email"],
.field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.radio-group label {
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.field.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.field.checkbox label { margin: 0; font-weight: 400; }

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.25rem 0 0.5rem;
}

.btn-primary {
  display: inline-block;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.btn-primary:hover { background: #0f2744; }

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: var(--primary);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

/* Rodapé de ajuda — abre modal de contato */
.form-help-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.form-help-footer-text {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-help-footer-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-help-footer-btn:hover {
  color: var(--primary);
}

.link-btn {
  display: inline-block;
  margin-top: 0.35rem;
  background: none;
  border: none;
  color: var(--primary-light);
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.alert p {
  margin: 0;
  line-height: 1.5;
}

.alert-success, .status-confirmado {
  background: #dcfce7;
  color: #166534;
}

.alert-error, .status-erro {
  background: #fee2e2;
  color: #991b1b;
}

.resultado-consulta {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 6px;
}

.vagas-encerradas { text-align: center; padding: 1rem 0; }
.vagas-encerradas h2 { color: #991b1b; margin: 0 0 0.5rem; }

/* Imagens da sidebar: largura fluida, altura proporcional, teto por viewport */
.sidebar .media-fluid,
.sidebar .folder-preview img,
.sidebar .media-block img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(52vh, 480px);
  object-fit: contain;
  object-position: center;
  margin: 0 auto;
  border-radius: 6px;
  background: #f8fafc;
}

.media-block {
  width: 100%;
  overflow: hidden;
}

.folder-preview {
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.folder-preview img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(48vh, 440px);
  object-fit: contain;
}

/* Mapa Leaflet (percurso KML — fundo satélite) */
.mapa-leaflet {
  width: 100%;
  height: min(42vh, 380px);
  min-height: 280px;
  max-height: 420px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #1a1a2e;
  z-index: 1;
}

.mapa-leaflet .leaflet-control-zoom {
  border: none;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
}

.mapa-leaflet .leaflet-control-zoom a {
  color: var(--primary);
  background: #fff;
}

.mapa-leaflet .leaflet-control-attribution {
  font-size: 0.65rem;
  background: rgb(255 255 255 / 0.85);
}

/* Laptop (telas médias) */
@media (min-width: 900px) and (max-width: 1366px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 360px;
  }

  .folder-preview img,
  .sidebar .media-block img {
    max-height: min(40vh, 340px);
  }

  .mapa-leaflet {
    min-height: 220px;
    height: min(36vh, 300px);
    max-height: 320px;
  }
}

/* Desktop largo */
@media (min-width: 1367px) {
  .folder-preview img,
  .sidebar .media-block img {
    max-height: min(55vh, 520px);
  }

  .mapa-leaflet {
    height: 360px;
    max-height: 400px;
  }
}

/* Mobile: sidebar abaixo do formulário, imagens um pouco menores */
@media (max-width: 899px) {
  .sidebar .card-body {
    padding: 1rem;
  }

  .folder-preview img,
  .sidebar .media-block img {
    max-height: min(65vw, 420px);
  }

  .mapa-leaflet {
    min-height: 240px;
    height: 55vw;
    max-height: 360px;
  }
}

.doc-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.sidebar .card {
  margin-bottom: 1.25rem;
}

.sidebar .card:last-child {
  margin-bottom: 0;
}

.media-caption {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.5rem;
}

.kit-retirada + .kit-retirada {
  margin-top: 0.75rem;
}

.kit-retirada {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.kit-retirada strong {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.kit-retirada p {
  margin: 0;
  line-height: 1.45;
}

.mapa-hint {
  margin: 0 0 0.65rem;
}

.doc-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.doc-link:hover {
  background: #eff6ff;
  border-color: var(--primary-light);
}

.confirmacao-card { max-width: 520px; margin: 0 auto; }

.lista-espera {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.back-link { margin-top: 1.5rem; text-align: center; }

#grupo-turma.hidden,
#grupo-perfil-outro.hidden,
.hint.hidden { display: none; }

.status-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 1rem;
  border-radius: var(--radius);
  margin-top: 1rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
}

.modal-content,
.modal-panel {
  position: relative;
  background: #fff;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.modal-content {
  padding: 1.5rem;
}

.modal-panel {
  width: min(440px, 92vw);
  padding: 0;
}

.modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  z-index: 2;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
}

.modal-close:hover {
  color: var(--text);
  background: #f1f5f9;
}

.modal-header {
  padding: 1.5rem 1.5rem 0;
  text-align: center;
}

.modal-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  color: var(--primary);
}

.modal-lead {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.modal-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
}

.modal-icon-success {
  background: #dcfce7;
  color: #166534;
}

.modal-form {
  padding: 1.25rem 1.5rem 0;
}

.modal-form .field {
  margin-bottom: 1rem;
}

.modal-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 5rem;
}

.modal-footer {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  background: #f8fafc;
  border-radius: 0 0 12px 12px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.55rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover {
  background: #fff;
  color: var(--text);
  border-color: #cbd5e1;
}

.modal-content img { max-width: 100%; height: auto; }

.errorlist {
  color: #991b1b;
  font-size: 0.8rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.messages { margin-bottom: 1rem; }
