:root {
  --bg-base: #0a1426;
  --bg-mid: #101f3a;
  --surface: rgba(15, 29, 54, 0.72);
  --surface-strong: rgba(12, 24, 46, 0.88);
  --border-soft: rgba(255, 255, 255, 0.16);
  --border-glow: rgba(251, 191, 36, 0.55);
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --accent-gold: #fbbf24;
  --accent-green: #22c55e;
  --accent-coral: #f43f5e;
  --accent-sky: #38bdf8;
  --accent-orange: #f97316;
  --radius-card: 20px;
  --shadow-card: 0 18px 42px rgba(2, 6, 23, 0.45);
  --font-display: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text-main);
  background: linear-gradient(155deg, var(--bg-base) 0%, var(--bg-mid) 48%, #171738 100%);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* Imagem de fundo dinâmica com suporte responsivo (inclusive iOS Safari) */
.page-bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}

/* Brilhos festivos sutis com as cores da festa */
.festive-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 14%, rgba(34, 197, 94, 0.22), transparent 38%),
    radial-gradient(circle at 88% 12%, rgba(251, 191, 36, 0.22), transparent 36%),
    radial-gradient(circle at 82% 85%, rgba(244, 63, 94, 0.18), transparent 40%),
    radial-gradient(circle at 15% 84%, rgba(56, 189, 248, 0.18), transparent 38%);
}

/* Faixa colorida festiva no topo */
.festive-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  z-index: 20;
  background: linear-gradient(
    90deg,
    #22c55e 0%,
    #facc15 20%,
    #f97316 40%,
    #f43f5e 60%,
    #38bdf8 80%,
    #22c55e 100%
  );
  background-size: 200% 100%;
  animation: ribbonFlow 14s linear infinite;
}

@keyframes ribbonFlow {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

.page-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) clamp(14px, 3vw, 28px) 28px;
}

/* Cabeçalho */
.hero-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  margin-top: 6px;
  margin-bottom: clamp(22px, 4vw, 38px);
}

.header-image-wrapper {
  width: 100%;
  max-width: 1040px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: clamp(14px, 2.2vw, 24px);
  overflow: hidden;
  background: rgba(10, 20, 38, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.38);
  backdrop-filter: blur(6px);
}

.header-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: clamp(160px, 30vw, 340px);
  object-fit: contain;
}

.header-text-wrapper {
  max-width: 780px;
  padding: 6px 8px;
}

.festive-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(15, 29, 54, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fde68a;
  margin-bottom: 12px;
}

.festive-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-green {
  background: var(--accent-green);
}
.dot-yellow {
  background: var(--accent-gold);
}
.dot-red {
  background: var(--accent-coral);
}
.dot-blue {
  background: var(--accent-sky);
}

.site-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5.2vw, 3.3rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffffff 10%, #fde68a 55%, #7dd3fc 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35));
}

.site-subtitle {
  margin: 10px auto 0;
  max-width: 580px;
  font-size: clamp(0.95rem, 2.2vw, 1.12rem);
  line-height: 1.5;
  color: var(--text-muted);
  text-shadow: 0 2px 10px rgba(2, 6, 23, 0.65);
}

/* Conteúdo principal */
.main-content {
  flex: 1;
  width: 100%;
}

/* Grid responsivo de barracas/bandeiras (confortável no desktop e arejado para valorizar o fundo) */
.stalls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 285px));
  justify-content: center;
  gap: clamp(22px, 3vw, 32px) clamp(20px, 2.8vw, 30px);
  align-items: stretch;
  width: 100%;
  padding: 4px 0;
}

/* Card clicável da barraca */
.stall-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text-main);
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
  border: 1px solid var(--border-soft);
  box-shadow: 0 12px 26px rgba(2, 6, 23, 0.32);
  transform: translateY(0);
  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    box-shadow 0.25s ease;
  animation: cardFadeUp 0.45s ease both;
  -webkit-tap-highlight-color: transparent;
}

.stall-card:hover,
.stall-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--border-glow);
  box-shadow:
    0 24px 50px rgba(2, 6, 23, 0.62),
    0 0 0 2px rgba(251, 191, 36, 0.24);
  outline: none;
}

.stall-card:active {
  transform: translateY(-2px) scale(0.99);
}

/* Área da imagem responsiva (proporção de bandeira 16:10) */
.stall-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0f172a;
}

.stall-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.stall-card:hover .stall-image,
.stall-card:focus-visible .stall-image {
  transform: scale(1.06);
}

/* Degradê bem leve apenas na base para destacar o selo sem escurecer a bandeira */
.stall-media::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(0deg, rgba(6, 12, 26, 0.34) 0%, transparent 30%);
  pointer-events: none;
}

.stall-media.stall-media-clean::before {
  display: none;
}

/* Rótulo / Nome ACIMA da imagem com fundo translúcido para deixar ver a imagem de fundo */
.stall-label-top {
  position: relative;
  padding: 8px 10px;
  background: rgba(10, 20, 38, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 44px;
  flex-shrink: 0;
  overflow: hidden;
}

.stall-label-top.stall-label-solid {
  background: rgba(10, 20, 38, 0.94);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stall-name {
  margin: 0;
  max-width: 100%;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.15;
  color: #ffffff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Selo de ação no canto inferior esquerdo */
.stall-cta {
  position: absolute;
  left: 12px;
  bottom: 11px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(10, 20, 38, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(8px);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fde68a;
  letter-spacing: 0.01em;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.stall-card:hover .stall-cta,
.stall-card:focus-visible .stall-cta {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  border-color: transparent;
  color: #0b1528;
  transform: translateX(2px);
}

.stall-cta svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

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

/* Estados de carregamento, vazio e erro */
.state-box {
  margin: 32px auto;
  max-width: 460px;
  padding: 32px 24px;
  text-align: center;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(10px);
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent-gold);
  animation: spin 0.85s linear infinite;
}

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

.empty-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
}

.empty-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.retry-btn {
  margin-top: 14px;
  padding: 10px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #0b1528;
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
}

/* Rodapé */
.site-footer {
  margin-top: clamp(32px, 5vw, 54px);
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.footer-text {
  margin: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.admin-link {
  color: rgba(226, 232, 240, 0.78);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(15, 29, 54, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 600;
  font-size: 0.8rem;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.admin-link:hover {
  color: #ffffff;
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(15, 29, 54, 0.85);
}

/* Celular: sempre 2 bandeiras por linha com espaçamento arejado para mostrar o fundo */
@media (max-width: 600px) {
  .stalls-grid {
    grid-template-columns: repeat(2, minmax(0, 168px));
    justify-content: center;
    gap: 22px 18px;
  }

  .stall-card {
    border-radius: 14px;
  }

  .stall-label-top {
    padding: 5px 6px;
    height: 34px;
  }

  .stall-name {
    font-size: 0.84rem;
    line-height: 1.15;
  }

  .stall-cta {
    left: 8px;
    bottom: 8px;
    padding: 4px 8px;
    gap: 4px;
    font-size: 0.68rem;
  }

  .stall-cta svg {
    width: 11px;
    height: 11px;
  }
}

/* Ajustes finos para telas muito pequenas */
@media (max-width: 520px) {
  .site-footer {
    flex-direction: column;
    text-align: center;
  }
}

/* Respeita preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  .festive-ribbon,
  .stall-card,
  .spinner {
    animation: none !important;
  }
  .stall-card,
  .stall-image {
    transition: none !important;
  }
}
