/* =========================================================
   Nova Acrópole Solidária — Estilos
   Mobile First | Identidade institucional | Acessível
   ========================================================= */

:root {
  --verde: #004D43;
  --verde-claro: #0a6256;
  --dourado: #C8A96B;
  --offwhite: #F4F1EA;
  --texto: #1E1E1E;
  --fundo: #FFFFFF;
  --muted: #5d5d5d;
  --borda: #e4e0d6;
  --erro: #9b2c2c;

  --raio: 12px;
  --sombra: 0 1px 3px rgba(30, 30, 30, 0.08);
  --tap: 48px; /* alvo de toque mínimo confortável */
  --max: 480px;
}

/* Evita "flash" de conteúdo antes do Alpine inicializar */
[x-cloak] { display: none !important; }

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--texto);
  background: var(--offwhite);
  line-height: 1.5;
  font-size: 16px;
}

h1, h2 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; color: var(--verde); }
h2 { font-size: 1.05rem; margin: 0; }

.muted { color: var(--muted); }

/* ----------------------- Layout base ----------------------- */
#app {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--fundo);
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--verde);
  color: var(--offwhite);
  padding: 1rem 1.25rem;
  padding-top: max(1rem, env(safe-area-inset-top));
}

.brand { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.brand-logo {
  width: 88px; height: auto;
  display: block;
  object-fit: contain; background: #fff; padding: 3px; flex-shrink: 0;
  border-radius: 50%;
}
.brand-name { font-size: .95rem; letter-spacing: .02em; line-height: 1.15; }
.brand-name strong { font-family: 'Fraunces', serif; font-size: 1.15rem; letter-spacing: .01em; }

.view {
  flex: 1;
  padding: 1.25rem;
  animation: fade .2s ease;
}

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.app-footer {
  text-align: center;
  padding: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: .8rem;
}

/* ----------------------- Campanha ----------------------- */
.campaign-head { margin-bottom: 1.25rem; }
.description { color: var(--muted); margin: .25rem 0 1rem; }

.progress-block { background: var(--offwhite); border-radius: var(--raio); padding: .85rem 1rem; }
.progress-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .5rem; }
.progress-label { font-size: .85rem; color: var(--muted); }
.progress-pct { font-weight: 600; color: var(--verde); }

.progress-bar { height: 10px; background: #dcd7c9; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--verde), var(--verde-claro)); border-radius: 999px; transition: width .3s ease; }

/* Lista de itens */
.item-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .85rem; }

.item-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  background: var(--fundo);
  box-shadow: var(--sombra);
}
.item-card.is-complete { background: #fafaf7; }

.item-info { flex: 1; min-width: 0; }
.item-name { margin-bottom: .15rem; }
.item-counts { font-size: .9rem; color: var(--texto); margin: 0; }
.item-remaining { font-size: .8rem; color: var(--dourado); font-weight: 600; margin: .15rem 0 .5rem; }
.item-remaining.item-done { color: var(--muted); }

.mini-bar { height: 5px; background: #ececec; border-radius: 999px; overflow: hidden; }
.mini-fill { height: 100%; background: var(--dourado); border-radius: 999px; transition: width .3s ease; }

.item-action { flex-shrink: 0; }

/* ----------------------- Botões ----------------------- */
.btn {
  font: inherit;
  font-weight: 600;
  min-height: var(--tap);
  padding: 0 1.1rem;
  border-radius: var(--raio);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--verde); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--verde-claro); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-disabled { background: #efece4; color: var(--muted); cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 1rem; }
.btn:disabled { opacity: .7; cursor: not-allowed; }

/* ----------------------- Formulário de reserva ----------------------- */
.back-link {
  background: none; border: none; color: var(--verde);
  font: inherit; font-weight: 600; padding: .25rem 0; margin-bottom: .5rem;
  cursor: pointer; min-height: var(--tap);
}

.selected-item {
  display: flex; flex-direction: column; gap: .15rem;
  background: var(--offwhite); border-radius: var(--raio);
  padding: .9rem 1rem; margin: .75rem 0 1.25rem;
}
.selected-item strong { font-size: 1.1rem; }

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .35rem; }
.req { color: var(--erro); }
.optional { color: var(--muted); font-weight: 400; }

.field input {
  width: 100%;
  font: inherit;
  min-height: var(--tap);
  padding: 0 .9rem;
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  background: var(--fundo);
}
.field input:focus { outline: 2px solid var(--verde); outline-offset: 1px; border-color: var(--verde); }
.field input[aria-invalid="true"] { border-color: var(--erro); }

.error { color: var(--erro); font-size: .82rem; margin: .35rem 0 0; }
.error-block { margin: .5rem 0; }

/* ----------------------- Estados centrais ----------------------- */
.state-center {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: .5rem; padding: 2.5rem 1rem;
}
.state-center h1 { margin-top: .5rem; }

.icon-badge {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 2rem; font-weight: 700; line-height: 1;
}
.icon-ok { background: var(--verde); color: #fff; }
.icon-warn { background: var(--dourado); color: #fff; }

.summary {
  width: 100%; background: var(--offwhite); border-radius: var(--raio);
  padding: 1rem 1.25rem; margin: 1rem 0; text-align: left;
  display: flex; flex-direction: column; gap: .75rem;
}
.summary div { display: flex; flex-direction: column; }
.summary .muted { font-size: .8rem; }
.summary strong { font-size: 1.05rem; }

.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: .25rem .65rem; border-radius: 999px; }
.badge-closed { background: #f0e6e6; color: var(--erro); margin-bottom: .75rem; }

/* Spinner */
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--borda); border-top-color: var(--verde);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------- Desktop (adaptação) ----------------------- */
@media (min-width: 768px) {
  #app { box-shadow: 0 0 40px rgba(0,0,0,.06); }
  h1 { font-size: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
