/* =========================================================================
 *  styles.css — the look of the site. Tweak colors below if you like.
 * ========================================================================= */

:root {
  --bg1: #ffeef3;
  --bg2: #e7f0ff;
  --card: #ffffff;
  --text: #2b2b3a;
  --muted: #7a7a8c;
  --primary: #c1558b;
  --primary-dark: #a23b71;
  --border: #ece7f0;
  --error: #c0392b;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(70, 40, 80, 0.15);
  padding: 32px 28px;
}

.screen { animation: fade 0.35s ease; }

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

.title {
  margin: 0 0 6px;
  font-size: 1.6rem;
  text-align: center;
}

.subtitle {
  margin: 0 0 22px;
  color: var(--muted);
  text-align: center;
  font-size: 0.98rem;
}

/* --- Inputs & buttons ---------------------------------------------------- */
.input {
  width: 100%;
  padding: 13px 14px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fafafe;
  color: var(--text);
  margin-bottom: 14px;
  font-family: inherit;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

textarea.input { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  width: auto;
  padding: 8px 4px;
}
.btn-ghost:hover { text-decoration: underline; }

.btn-back { margin-bottom: 10px; font-weight: 500; }

.error {
  color: var(--error);
  font-size: 0.9rem;
  text-align: center;
  margin: 8px 0 0;
}

/* --- Name picker --------------------------------------------------------- */
.members-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.btn-member {
  flex-direction: column;
  gap: 6px;
  padding: 18px 10px;
  background: #fafafe;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-member:hover { border-color: var(--primary); background: #fff; }
.member-emoji { font-size: 2rem; }
.member-name { font-weight: 600; }

/* --- Questions ----------------------------------------------------------- */
.question { margin-bottom: 20px; }
.question-text {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}
.options { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fafafe;
  cursor: pointer;
}
.option:hover { border-color: var(--primary); }
.option input { accent-color: var(--primary); width: 18px; height: 18px; }

/* --- Thank you ----------------------------------------------------------- */
.thank-you { text-align: center; }
.thank-you h2 { margin: 8px 0; }

/* --- Footer -------------------------------------------------------------- */
.footer {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* =========================================================================
 *  Apartados, viajes y resultados
 * ========================================================================= */

/* Tarjetas (Comidas / Viajes / lista de viajes) */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 12px;
  background: #fafafe;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.tile:hover { border-color: var(--primary); background: #fff; }
.tile-emoji { font-size: 2rem; }
.tile-trip { gap: 4px; }
.tile-trip-name { font-size: 1.05rem; }
.tile-trip-sub { font-size: 0.82rem; font-weight: 400; color: var(--muted); }

/* Formulario del viaje */
.field-label { display: block; font-weight: 600; margin: 6px 0 8px; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 4px 0 14px; }
select.input { appearance: auto; }

.trip-fields { margin-bottom: 18px; }
.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fafafe;
  margin-bottom: 8px;
}
.field-name { font-weight: 500; }
.field-group { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.num-input {
  width: 70px;
  padding: 9px;
  font-size: 1.05rem;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
}
.num-input:focus { outline: none; border-color: var(--primary); }

.save-msg { text-align: center; margin: 12px 0 0; font-weight: 600; }
.save-msg.ok { color: #1e7a45; }
.save-msg.err { color: var(--error); font-weight: 500; font-size: 0.92rem; }

.sep { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

.btn-secondary { background: #eef2ff; color: var(--primary-dark); }
.btn-secondary:hover { background: #e2e8ff; }

/* Resultados */
.result-box {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #fafafe;
}
.result-h { margin: 0 0 10px; font-size: 1.1rem; }
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.total-row:last-child { border-bottom: none; }
.total-num { font-weight: 700; font-size: 1.15rem; color: var(--primary-dark); }
.people-line { margin: 8px 0; font-size: 0.95rem; line-height: 1.5; }

/* Tabla detallada con scroll horizontal */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { border-collapse: collapse; font-size: 0.8rem; white-space: nowrap; }
table.grid th, table.grid td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: center;
}
table.grid th { background: #f0eef5; font-size: 0.72rem; }
.th-group { color: var(--muted); font-weight: 600; }
.sticky-col {
  position: sticky;
  left: 0;
  background: #fff;
  text-align: left !important;
  font-weight: 600;
  z-index: 1;
}
.row-head .sticky-col { color: var(--primary-dark); }
table.grid th.sticky-col { background: #f0eef5; }
.row-total td { background: #f6e8f0; font-weight: 700; }
.row-total .sticky-col { background: #f6e8f0; }
td.zero { color: #c9c9d3; }
