/* 5K Virtual — ¡Juntos por una escuela más activa!
   Mobile-first. PR-flag red / blue / white with a warm cream base. */

:root {
  --red: #d32630;
  --red-dark: #a91c24;
  --blue: #1d4fa0;
  --blue-dark: #153b78;
  --sky: #e8f0fb;
  --cream: #fffaf3;
  --ink: #1d2433;
  --muted: #5d6677;
  --line: #e4ddd2;
  --white: #ffffff;
  --ok: #1d7a46;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(29, 36, 51, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
}

/* Top stripe: red / white / blue, like the flag ribbon on the medal. */
.flag-stripe {
  height: 8px;
  background: linear-gradient(to bottom, var(--red) 0 33%, var(--white) 33% 66%, var(--blue) 66% 100%);
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 28px 0 8px;
  position: relative;
}
.hero-medal {
  display: block;
  width: min(68%, 280px);
  height: auto;
  margin: 0 auto 18px;
  padding: 14px;
  background: var(--white);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(29, 36, 51, 0.16);
}
.bib-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
.bib-hint img {
  width: 120px;
  height: auto;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--blue);
}
.hero h1 span { color: var(--red); }
.hero .subtitle {
  margin: 8px 0 0;
  font-size: clamp(1.15rem, 5vw, 1.4rem);
  font-weight: 800;
  color: var(--red);
}
.hero .tagline {
  display: inline-block;
  margin: 14px 0 0;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--sky);
  color: var(--blue-dark);
  font-weight: 600;
  font-size: 0.95rem;
}
.hibiscus {
  position: absolute;
  width: 64px;
  height: 64px;
  opacity: 0.9;
  pointer-events: none;
}
.hibiscus.left { top: 18px; left: -6px; transform: rotate(-18deg); opacity: 0.75; }

.intro { margin: 22px 0 8px; }
.intro p { margin: 0 0 12px; }
.intro strong { color: var(--blue-dark); }

/* ---------- Card / form ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 16px;
  border-top: 5px solid var(--red);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 1.25rem;
  color: var(--blue-dark);
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}
.field .hint {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}
.row-2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 480px) {
  .row-2 { grid-template-columns: 1fr 1fr; }
  .card { padding: 26px 24px; }
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235d6677' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 79, 160, 0.18);
}
.field.invalid input,
.field.invalid select { border-color: var(--red); }
.field-error {
  display: none;
  color: var(--red-dark);
  font-size: 0.88rem;
  margin-top: 6px;
  font-weight: 600;
}
.field.invalid .field-error { display: block; }

/* File picker */
.file-drop {
  display: block;
  border: 2px dashed #c9d6ec;
  background: var(--sky);
  border-radius: 12px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  color: var(--blue-dark);
  font-weight: 600;
}
.file-drop:hover { border-color: var(--blue); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop:focus-within { box-shadow: 0 0 0 3px rgba(29, 79, 160, 0.25); }
.field.invalid .file-drop { border-color: var(--red); }
.file-preview {
  display: none;
  margin-top: 10px;
  max-height: 220px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.file-name { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 6px; font-weight: 400; word-break: break-all; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 800;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
  background: var(--blue);
  color: var(--white);
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary {
  width: 100%;
  font-size: 1.15rem;
  padding: 16px 20px;
  background: var(--red);
  box-shadow: 0 6px 16px rgba(211, 38, 48, 0.28);
}
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost {
  background: transparent;
  color: var(--blue-dark);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { background: var(--sky); }

.form-alert {
  display: none;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fdecee;
  color: var(--red-dark);
  font-weight: 600;
}
.form-alert.show { display: block; }

.privacy {
  margin: 14px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Thank-you page ---------- */
.thanks { text-align: center; padding-top: 36px; }
.thanks .hero-medal { width: min(50%, 200px); }
.thanks h1 { color: var(--blue); font-size: 2rem; margin: 0 0 8px; }
.thanks .check {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--ok);
  color: var(--white);
  font-size: 1.8rem;
  margin-bottom: 12px;
}

/* ---------- Admin ---------- */
.admin-login { max-width: 420px; margin: 0 auto; padding: 48px 16px; }
.admin-login h1 { font-size: 1.4rem; color: var(--blue-dark); margin: 0 0 4px; }
.admin-login p { color: var(--muted); margin: 0 0 18px; }

.admin-wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }
.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.admin-head h1 { margin: 0; font-size: 1.3rem; color: var(--blue-dark); }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.9rem;
}
.stat b { font-size: 1.05rem; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar input[type="search"] { flex: 1 1 220px; width: auto; }
.toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }

.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f7f3ec; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
tbody tr:hover { background: #fcfaf6; }
tr.delivered td { background: #f0f8f3; }
td.nowrap { white-space: nowrap; }
td .sub { display: block; font-size: 0.8rem; color: var(--muted); }
.thumb {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--sky);
}
.dup-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff1d6;
  color: #8a5a00;
  font-size: 0.72rem;
  font-weight: 700;
}
.notes-input { min-width: 180px; padding: 8px 10px; font-size: 14px; }
.notes-input.saved { border-color: var(--ok); }
.deliver { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.deliver input { width: 20px; height: 20px; accent-color: var(--ok); }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
