/* =========================================================================
   TocaFiesta · components.css
   Componentes reutilizables. TODO nuevo elemento reutiliza estos estilos
   para que cada pantalla parezca parte de la misma app.
   ========================================================================= */

/* ---------- Botones ---------- */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  border-radius: var(--radius-pill);
  padding: 13px 22px;
  transition: transform .12s ease, filter .12s ease, background .15s ease, border-color .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  line-height: 1;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.98); }

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
  box-shadow: var(--shadow-cta);
}
.btn-primary:hover { filter: brightness(1.03); }

.btn-secondary {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.btn-secondary:hover { border-color: rgba(42,34,48,.18); }

.btn-ghost {
  color: var(--ink-soft);
  background: transparent;
  padding: 10px 14px;
}
.btn-ghost:hover { color: var(--ink); }

.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ---------- Tarjeta blanca genérica ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

/* ---------- Rejilla de tarjetas seleccionables (eventos / estilos / etc.) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px 12px 16px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.card:active { transform: translateY(-1px); }
.card[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--ink) inset, var(--shadow-card-hover);
}
.card[aria-pressed="true"] .badge { transform: scale(1.04); }

.badge {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--tint, #F0ECF4);
  color: var(--ink-accent, var(--brand));
  transition: transform .18s ease;
  flex: none;
}
.badge svg { width: 30px; height: 30px; }

.card-label { font-size: 14px; font-weight: 500; line-height: 1.25; color: var(--ink); max-width: 16ch; }
.card-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; max-width: 22ch; }

/* Tarjeta ancha (opciones con descripción, p. ej. tipo de invitación) */
.option-list { display: grid; gap: 10px; }
.option {
  appearance: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.option:hover { transform: translateY(-1px); border-color: rgba(42,34,48,.18); }
.option[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--ring); }
.option .opt-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line); flex: none; margin-top: 2px;
  display: grid; place-items: center; color: #fff;
}
.option[aria-pressed="true"] .opt-check { background: var(--brand); border-color: var(--brand); }
.option .opt-check svg { width: 14px; height: 14px; }
.option .opt-body { min-width: 0; }
.option .opt-title { font-weight: 600; font-size: 15px; }
.option .opt-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; line-height: 1.4; }

/* ---------- Interruptores de funciones (checkbox accesible con aspecto de chip) ---------- */
.toggle-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .toggle-grid { grid-template-columns: 1fr 1fr; } }

.toggle {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.toggle:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--ring); }
.toggle:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .switch {
  width: 42px; height: 25px; border-radius: 999px;
  background: #E4DEE8; position: relative; flex: none; transition: background .15s ease;
}
.toggle .switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s ease;
}
.toggle input:checked + .switch { background: var(--brand); }
.toggle input:checked + .switch::after { transform: translateX(17px); }
.toggle .switch-label { font-size: 14px; font-weight: 500; }
.toggle .switch-sub { font-size: 12px; color: var(--ink-soft); }

/* Etiqueta "revisión manual" */
.tag-review {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: var(--warn-ink); background: var(--warn-bg);
  border-radius: 999px; padding: 2px 8px; margin-left: 6px;
}

/* ---------- Campos de formulario ---------- */
.field { display: block; margin-bottom: 14px; }
.field > label, .field-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--brand); }
.field .help { font-size: 12px; color: var(--ink-soft); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px; /* >=16px evita zoom en iOS */
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  padding: 12px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--error); box-shadow: 0 0 0 3px rgba(192,57,43,.18);
}
.field-error { font-size: 12.5px; color: var(--error); margin-top: 6px; display: none; }
.field-error.show { display: block; }

.field-row { display: grid; gap: 14px; }
@media (min-width: 600px) { .field-row.cols-2 { grid-template-columns: 1fr 1fr; } }

fieldset.field-group { border: 0; padding: 0; margin: 0 0 6px; }
.field-group > legend {
  font-family: var(--font-display); font-weight: 600; font-size: 16px;
  padding: 0; margin: 18px 0 10px;
}

/* ---------- Aviso / banner ---------- */
.notice {
  border-radius: var(--radius-field);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  display: flex; gap: 10px; align-items: flex-start;
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice-info { background: #EEF4FF; color: #1f3a63; }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------- Barra inferior fija (idéntica a la portada) ---------- */
.bottom-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,255,255,0), #FFFFFF 38%);
  transform: translateY(140%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.bottom-bar.show { transform: translateY(0); }
.bottom-inner {
  max-width: var(--app-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bottom-context { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-soft); }
.bottom-context strong { color: var(--ink); font-weight: 600; }

/* ---------- Barra de progreso ---------- */
.progress { margin: 6px 0 18px; }
.progress-meta {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px;
}
.progress-meta .step-name { font-weight: 600; color: var(--ink); }
.progress-track { height: 8px; border-radius: 999px; background: #F0E6EC; overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  width: 0%; transition: width .3s ease;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 30;
  background: var(--ink); color: #fff; font-size: 13.5px;
  padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  max-width: min(92vw, 440px);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Modal (confirmaciones / textos legales) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(28,22,33,.45);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: var(--radius-card);
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  width: min(560px, 100%); max-height: min(82vh, 720px); overflow: auto;
  padding: 22px;
  transform: translateY(8px); transition: transform .2s ease;
}
.modal-backdrop.show .modal { transform: translateY(0); }
.modal h2 { margin: 0 0 10px; font-size: 20px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Chips de selección de color ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  border-radius: 999px; padding: 8px 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 8px;
}
.chip[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--ring); }
.chip .swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.1); }
