/* =====================================================================
   Colegio Metodista Robert Johnson - Campaña de Donación de Sangre 2026
   Hoja de estilos principal
   ===================================================================== */

/* ---------- Reset / variables ---------- */
:root {
  --rojo:        #c0162a;
  --rojo-osc:    #8a0d1c;
  --rojo-claro:  #ffe4e7;
  --azul:        #0f2c4a;
  --azul-2:      #163e69;
  --dorado:      #d4af37;
  --gris-1:      #f6f7fb;
  --gris-2:      #e6e8ee;
  --gris-3:      #b7bcc7;
  --texto:       #1d2433;
  --texto-2:     #5b6172;
  --blanco:      #ffffff;
  --ok:          #117a3d;
  --warn:        #c98700;
  --err:         #b00020;
  --shadow-sm:   0 2px 6px rgba(15, 44, 74, .08);
  --shadow-md:   0 6px 20px rgba(15, 44, 74, .12);
  --shadow-lg:   0 14px 40px rgba(15, 44, 74, .18);
  --radius:      14px;
  --radius-sm:   8px;
  --transition:  .25s ease;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Inter", "Roboto", system-ui, -apple-system, sans-serif;
  color: var(--texto);
  background: var(--gris-1);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--rojo); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--rojo-osc); }
img { max-width: 100%; display: block; }

/* ---------- Topbar institucional ---------- */
.topbar {
  background: linear-gradient(90deg, var(--azul) 0%, var(--azul-2) 100%);
  color: #dfe7f3;
  font-size: .82rem;
  padding: .45rem 0;
  border-bottom: 3px solid var(--dorado);
}
.topbar .container {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .5rem;
}
.topbar a { color: #fff; }

/* ---------- Header ---------- */
.site-header {
  background: var(--blanco);
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; gap: 1rem;
}
.brand {
  display: flex; align-items: center; gap: .9rem; min-width: 0;
}
.brand-logo {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--rojo) 0%, var(--rojo-osc) 100%);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 1.4rem; letter-spacing: 1px;
  box-shadow: var(--shadow-md);
  flex: 0 0 auto;
}
.brand-logo-img {
  background: #fff;
  object-fit: contain;
  padding: 3px;
  border: 2px solid #fff;
}
.site-header .brand-logo-img {
  width: 88px; height: 88px;
  padding: 5px;
  box-shadow: var(--shadow-md);
}
.brand-text h1 {
  font-size: 1.05rem; margin: 0; color: var(--azul);
  font-weight: 800; letter-spacing: .3px;
}
.brand-text small {
  display: block; color: var(--texto-2); font-size: .8rem;
}

/* ---------- Navegación ---------- */
.nav { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.nav a {
  color: var(--azul);
  font-weight: 600;
  padding: .55rem .9rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.nav a:hover, .nav a.active {
  background: var(--rojo-claro);
  color: var(--rojo-osc);
}
.nav .btn-primary { color: #fff; }
.nav .btn-primary:hover { color: #fff; }

.nav-toggle {
  display: none; background: transparent; border: 0; cursor: pointer;
  font-size: 1.6rem; color: var(--azul);
}

/* ---------- Contenedor ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(192,22,42,.18), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(15,44,74,.18), transparent 60%),
    linear-gradient(135deg, #fff 0%, #f6f7fb 100%);
  padding: 4rem 0 5rem;
  overflow: hidden;
}
.hero .container {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 3rem;
  align-items: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--rojo-claro); color: var(--rojo-osc);
  padding: .35rem .8rem; border-radius: 999px;
  font-weight: 700; font-size: .8rem; letter-spacing: .5px;
  text-transform: uppercase;
}
.hero h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  line-height: 1.15; margin: 1rem 0 .8rem;
  color: var(--azul); font-weight: 800;
}
.hero h2 span { color: var(--rojo); }
.hero p.lead {
  font-size: 1.08rem; color: var(--texto-2); max-width: 60ch;
}
.hero-cta { display: flex; gap: .8rem; margin-top: 1.6rem; flex-wrap: wrap; }

.hero-illustration {
  position: relative;
  background: linear-gradient(135deg, var(--rojo) 0%, var(--rojo-osc) 100%);
  border-radius: 28px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  color: #fff;
  overflow: hidden;
  min-height: 320px;
}
.hero-illustration::before {
  content: ""; position: absolute; inset: -40% -10% auto auto;
  width: 280px; height: 280px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.hero-illustration::after {
  content: ""; position: absolute; left: -40px; bottom: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(0,0,0,.12);
}
.hero-illustration .drop {
  width: 110px; height: 140px;
  background: #fff; color: var(--rojo);
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  transform: rotate(-12deg);
  display: grid; place-items: center;
  font-size: 2.4rem; font-weight: 800;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  margin-bottom: 1.2rem;
}
.hero-illustration h3 { margin: 0 0 .35rem; font-size: 1.4rem; }
.hero-illustration p { margin: 0; opacity: .92; }
.hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem;
  margin-top: 1.5rem; position: relative; z-index: 2;
}
.hero-stats .stat {
  background: rgba(255,255,255,.14); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.2);
  padding: .8rem; border-radius: var(--radius-sm); text-align: center;
}
.hero-stats .stat strong { display: block; font-size: 1.4rem; }
.hero-stats .stat span { font-size: .75rem; opacity: .92; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700; font-size: .95rem;
  border: 0; cursor: pointer; text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition),
              background var(--transition), color var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--rojo) 0%, var(--rojo-osc) 100%);
  color: #fff; box-shadow: 0 8px 18px rgba(192,22,42,.32);
}
.btn-primary:hover { box-shadow: 0 12px 22px rgba(192,22,42,.45); color: #fff; }
.btn-secondary {
  background: var(--azul); color: #fff;
}
.btn-secondary:hover { background: var(--azul-2); color: #fff; }
.btn-ghost {
  background: transparent; color: var(--azul);
  border: 2px solid var(--azul);
}
.btn-ghost:hover { background: var(--azul); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: .55rem .9rem; font-size: .85rem; }

/* ---------- Secciones ---------- */
.section { padding: 4rem 0; }
.section-title {
  text-align: center; margin: 0 auto 2.4rem;
  max-width: 720px;
}
.section-title small {
  color: var(--rojo); font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; font-size: .8rem;
}
.section-title h3 {
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  color: var(--azul); margin: .35rem 0 .6rem;
}
.section-title p { color: var(--texto-2); }

/* ---------- Tarjetas ---------- */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
}
.card {
  background: #fff; border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow-sm);
  border-top: 4px solid var(--rojo);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card .icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--rojo-claro); color: var(--rojo-osc);
  display: grid; place-items: center; font-size: 1.5rem;
  margin-bottom: .8rem;
}
.card h4 { margin: .2rem 0 .4rem; color: var(--azul); }
.card p  { margin: 0; color: var(--texto-2); font-size: .95rem; }
.requisitos-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
}
.requisitos-imagen {
  padding: .55rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.requisitos-imagen-btn {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.requisitos-imagen img,
.requisitos-imagen-btn img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 44, 74, .78);
}
.image-modal.is-open {
  display: flex;
}
.image-modal img {
  max-width: min(92vw, 980px);
  max-height: 88vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: #fff;
}
.image-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--azul);
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
}

/* ---------- Pasos ---------- */
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.4rem;
  counter-reset: paso;
}
.step {
  position: relative; padding: 1.8rem 1.4rem 1.4rem;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.step::before {
  counter-increment: paso; content: counter(paso, decimal-leading-zero);
  position: absolute; top: -18px; left: 18px;
  background: linear-gradient(135deg, var(--azul), var(--azul-2));
  color: #fff; font-weight: 800; padding: .35rem .65rem;
  border-radius: 8px; font-size: .85rem; letter-spacing: 1px;
}
.step h5 { margin: .4rem 0 .35rem; color: var(--azul); font-size: 1.05rem; }
.step p  { margin: 0; color: var(--texto-2); font-size: .92rem; }

/* ---------- Formulario ---------- */
.form-wrapper {
  background: #fff; border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow-md);
}
.form-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.2rem;
}
.field { display: flex; flex-direction: column; gap: .35rem; }
.field.full { grid-column: 1 / -1; }
.field label {
  font-weight: 600; color: var(--azul); font-size: .92rem;
}
.field label .req { color: var(--rojo); margin-left: 2px; }
.field input, .field select, .field textarea {
  font: inherit; padding: .7rem .9rem;
  border: 1.5px solid var(--gris-2); border-radius: var(--radius-sm);
  background: #fff; color: var(--texto);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--rojo);
  box-shadow: 0 0 0 4px rgba(192,22,42,.12);
}
.field textarea { resize: vertical; min-height: 90px; }
.field .hint { color: var(--texto-2); font-size: .8rem; }
.field .err  { color: var(--err); font-size: .82rem; min-height: 1em; }
.field input.invalid, .field select.invalid, .field textarea.invalid {
  border-color: var(--err);
  box-shadow: 0 0 0 4px rgba(176,0,32,.1);
}

.checkbox {
  display: flex; align-items: flex-start; gap: .6rem;
  background: var(--gris-1); padding: .85rem 1rem;
  border-radius: var(--radius-sm); border: 1px solid var(--gris-2);
}
.checkbox input { margin-top: .25rem; transform: scale(1.15); accent-color: var(--rojo); }
.checkbox label { font-size: .92rem; color: var(--texto-2); }

.form-actions { margin-top: 1.4rem; display: flex; gap: .8rem; flex-wrap: wrap; }

/* ---------- Alertas ---------- */
.alert {
  padding: 1rem 1.1rem; border-radius: var(--radius-sm);
  margin-bottom: 1.2rem; font-size: .95rem;
  border-left: 4px solid;
  display: flex; gap: .7rem; align-items: flex-start;
}
.alert.ok    { background: #e7f6ec; color: #0d5d2e; border-color: var(--ok); }
.alert.warn  { background: #fff5e0; color: #6b4900; border-color: var(--warn); }
.alert.err   { background: #ffe8eb; color: #6b0014; border-color: var(--err); }
.alert.info  { background: #e8eef8; color: #0f2c4a; border-color: var(--azul); }

/* ---------- Tabla admin ---------- */
.table-wrapper { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table.data {
  width: 100%; border-collapse: collapse; font-size: .92rem;
}
table.data thead th {
  background: var(--azul); color: #fff; text-align: left;
  padding: .9rem 1rem; font-weight: 600; font-size: .85rem;
  text-transform: uppercase; letter-spacing: .4px;
}
table.data tbody td {
  padding: .8rem 1rem; border-bottom: 1px solid var(--gris-2);
}
table.data tbody tr:hover { background: var(--gris-1); }
table.data tbody tr:last-child td { border-bottom: 0; }
.badge {
  display: inline-block; padding: .25rem .6rem;
  border-radius: 999px; font-size: .75rem; font-weight: 700;
}
.badge.ok    { background: #d8f0e0; color: var(--ok); }
.badge.err   { background: #fadce0; color: var(--err); }
.badge.warn  { background: #fdecc8; color: var(--warn); }
.badge.azul  { background: #dbe4f3; color: var(--azul); }

/* ---------- QR ---------- */
.qr-card {
  background: #fff; padding: 2rem; border-radius: var(--radius);
  box-shadow: var(--shadow-md); text-align: center; max-width: 480px; margin: 0 auto;
}
.qr-card .qr-box {
  display: inline-block; padding: 1rem;
  background: #fff; border: 4px dashed var(--rojo-claro);
  border-radius: var(--radius-sm); margin: 1rem 0;
}
.qr-meta { color: var(--texto-2); font-size: .9rem; }
.qr-link {
  display: block; word-break: break-all; background: var(--gris-1);
  padding: .7rem; border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .82rem; margin-top: .8rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--azul);
  color: #cdd5e2;
  padding: 2.5rem 0 1.5rem;
  margin-top: auto;
  border-top: 4px solid var(--rojo);
}
.site-footer .container { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.site-footer h6 { color: #fff; margin: 0 0 .9rem; font-size: 1rem; letter-spacing: .3px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .45rem; font-size: .9rem; }
.site-footer a { color: #cdd5e2; }
.site-footer a:hover { color: #fff; }
.site-footer .credits {
  border-top: 1px solid rgba(255,255,255,.12);
  margin-top: 1.8rem; padding-top: 1rem;
  font-size: .82rem; text-align: center; color: #aab3c2;
  grid-column: 1 / -1;
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(700px 400px at 80% 10%, rgba(192,22,42,.18), transparent 60%),
    linear-gradient(135deg, var(--azul) 0%, var(--azul-2) 100%);
  padding: 2rem 1rem;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: var(--radius);
  padding: 2.2rem; box-shadow: var(--shadow-lg);
}
.login-card .brand-logo { margin: 0 auto 1rem; }
.login-card h2 { text-align: center; color: var(--azul); margin: 0 0 .4rem; }
.login-card p.muted { text-align: center; color: var(--texto-2); margin: 0 0 1.4rem; }

/* ---------- Admin shell ---------- */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side {
  background: var(--azul); color: #cfd7e4;
  padding: 1.5rem 1rem; position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
}
.admin-side .brand-logo { margin: 0 auto .8rem; }
.admin-side .brand-logo-img {
  width: 96px; height: 96px;
  padding: 6px;
  background: #fff;
  box-shadow: var(--shadow-md);
}
.admin-side h1 { color: #fff; font-size: 1rem; text-align: center; margin: 0 0 .25rem; }
.admin-side small { display: block; text-align: center; color: #9aa6bb; margin-bottom: 1.2rem; }
.admin-side nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .9rem; border-radius: var(--radius-sm);
  color: #cfd7e4; font-weight: 600; margin-bottom: .25rem;
}
.admin-side nav a:hover, .admin-side nav a.active {
  background: rgba(255,255,255,.08); color: #fff;
}
.admin-side .logout {
  margin-top: 1rem; display: block; text-align: center;
  color: #ffd0d6; font-size: .85rem;
}
.admin-main { padding: 2rem; background: var(--gris-1); }
.admin-main h2 { color: var(--azul); margin: 0 0 1.2rem; }

/* Modal (admin, ej. editar campaña QR) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 44, 74, 0.5);
  display: grid; place-items: center; padding: 1.5rem;
  visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}
.modal-overlay.is-open {
  visibility: visible; opacity: 1; pointer-events: auto;
}
.modal-box {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 480px;
  padding: 1.5rem 1.6rem 1.35rem;
}
.modal-box h3 { margin: 0 0 1rem; color: var(--azul); font-size: 1.15rem; }
.modal-actions {
  display: flex; gap: .6rem; justify-content: flex-end;
  margin-top: 1.15rem; flex-wrap: wrap;
}
body.modal-open { overflow: hidden; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.kpi {
  background: #fff; padding: 1.2rem; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border-left: 4px solid var(--rojo);
}
.kpi small { color: var(--texto-2); text-transform: uppercase; font-size: .75rem; letter-spacing: .8px; }
.kpi strong { display: block; font-size: 1.8rem; color: var(--azul); margin-top: .2rem; }

/* ---------- Página de QR pública ---------- */
.qr-public {
  max-width: 720px; margin: 3rem auto; background: #fff;
  border-radius: var(--radius); padding: 2.4rem; box-shadow: var(--shadow-md);
  text-align: center;
}
.qr-public h2 { color: var(--azul); margin-bottom: .4rem; }
.qr-public .countdown {
  display: inline-block; background: var(--rojo-claro); color: var(--rojo-osc);
  padding: .5rem 1rem; border-radius: 999px; font-weight: 700;
  margin: .6rem 0 1.4rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .requisitos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; gap: 2rem; }
  .form-grid       { grid-template-columns: 1fr; }
  .requisitos-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .site-footer .container { grid-template-columns: 1fr; gap: 1.6rem; }

  .nav { display: none; flex-direction: column; align-items: stretch;
         position: absolute; top: 100%; left: 0; right: 0;
         background: #fff; padding: 1rem; box-shadow: var(--shadow-md); }
  .nav.open { display: flex; }
  .nav a    { padding: .9rem 1rem; border-bottom: 1px solid var(--gris-2); }
  .nav a:last-child { border-bottom: 0; }
  .nav-toggle { display: inline-block; }

  .admin-shell { grid-template-columns: 1fr; }
  .admin-side  { height: auto; position: static; }
}

/* Imprimir solo el QR (admin imprime el cartel) */
@media print {
  body * { visibility: hidden !important; }
  .printable, .printable * { visibility: visible !important; }
  .printable { position: absolute; inset: 0; padding: 2rem; }
}
