/* ============================================================
   estilo.css — Sistema de Refrigerios CERES
   Chaparral Venadillo · Estética institucional moderna
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── Variables ── */
:root {
  --verde:       #1a6b3c;
  --verde-med:   #228B50;
  --verde-claro: #2ecc71;
  --verde-suave: #d4edda;
  --amarillo:    #f5c518;
  --gris-oscuro: #1c1c1e;
  --gris-medio:  #3a3a3c;
  --gris-claro:  #f2f2f7;
  --blanco:      #ffffff;
  --rojo:        #e74c3c;
  --azul:        #2980b9;
  --sombra:      0 8px 32px rgba(26,107,60,.15);
  --radio:       14px;
  --radio-sm:    8px;
  --fuente:      'Sora', sans-serif;
  --mono:        'JetBrains Mono', monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--fuente);
  background: var(--gris-claro);
  color: var(--gris-oscuro);
  min-height: 100vh;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, var(--verde) 0%, var(--verde-med) 100%);
  color: var(--blanco);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  box-shadow: 0 4px 20px rgba(26,107,60,.3);
  position: sticky; top: 0; z-index: 100;
}
.header-logo {
  display: flex; align-items: center; gap: .75rem;
}
.header-logo .leaf {
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}
.header-logo h1 {
  font-size: 1.15rem; font-weight: 800;
  letter-spacing: -.5px; line-height: 1.1;
}
.header-logo span {
  font-size: .72rem; font-weight: 300; opacity: .85;
  display: block; letter-spacing: .5px;
}
.header-nav {
  display: flex; gap: .5rem; align-items: center;
}
.nav-btn {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--blanco);
  padding: .45rem 1rem;
  border-radius: 50px;
  font-family: var(--fuente);
  font-size: .8rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: all .2s ease;
  display: flex; align-items: center; gap: .4rem;
}
.nav-btn:hover {
  background: rgba(255,255,255,.25);
  transform: translateY(-1px);
}
.nav-btn.active {
  background: var(--amarillo);
  color: var(--gris-oscuro);
  border-color: var(--amarillo);
}

/* ── Main ── */
.main {
  max-width: 900px;
  margin: 2.5rem auto;
  padding: 0 1.25rem;
}

/* ── Cards ── */
.card {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 2rem 2.25rem;
  box-shadow: var(--sombra);
  margin-bottom: 1.75rem;
}
.card-title {
  font-size: 1.15rem; font-weight: 700;
  color: var(--verde);
  margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .6rem;
  border-bottom: 2px solid var(--verde-suave);
  padding-bottom: .75rem;
}

/* ── Formularios ── */
.form-group { margin-bottom: 1.25rem; }
label {
  display: block;
  font-size: .8rem; font-weight: 600;
  color: var(--gris-medio);
  margin-bottom: .4rem;
  text-transform: uppercase; letter-spacing: .5px;
}
input[type="text"], input[type="date"], input[type="password"], select {
  width: 100%;
  padding: .75rem 1rem;
  border: 2px solid #e0e0e5;
  border-radius: var(--radio-sm);
  font-family: var(--fuente); font-size: .95rem;
  color: var(--gris-oscuro);
  background: var(--blanco);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--verde-med);
  box-shadow: 0 0 0 3px rgba(34,139,80,.12);
}

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  padding: .75rem 1.6rem;
  border-radius: 50px;
  font-family: var(--fuente); font-size: .9rem; font-weight: 700;
  cursor: pointer; border: none;
  text-decoration: none;
  transition: all .2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--verde) 0%, var(--verde-med) 100%);
  color: var(--blanco);
  box-shadow: 0 4px 15px rgba(26,107,60,.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,107,60,.4);
}
.btn-danger {
  background: var(--rojo);
  color: var(--blanco);
}
.btn-warning {
  background: var(--amarillo);
  color: var(--gris-oscuro);
}
.btn-secondary {
  background: var(--gris-claro);
  color: var(--gris-medio);
  border: 2px solid #e0e0e5;
}
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }

/* ── Alertas ── */
.alert {
  padding: .9rem 1.1rem;
  border-radius: var(--radio-sm);
  font-size: .88rem; font-weight: 500;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: .6rem;
}
.alert-success { background: var(--verde-suave); color: var(--verde); border-left: 4px solid var(--verde); }
.alert-error   { background: #fdecea; color: var(--rojo); border-left: 4px solid var(--rojo); }
.alert-info    { background: #e8f4fd; color: var(--azul); border-left: 4px solid var(--azul); }
.alert-warning { background: #fff8e1; color: #b8860b; border-left: 4px solid var(--amarillo); }

/* ── Tabla ── */
.tabla-wrap { overflow-x: auto; border-radius: var(--radio-sm); }
table {
  width: 100%; border-collapse: collapse;
  font-size: .88rem;
}
thead th {
  background: var(--verde);
  color: var(--blanco);
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .5px;
  text-transform: uppercase;
}
tbody tr { border-bottom: 1px solid #f0f0f5; transition: background .15s; }
tbody tr:hover { background: var(--verde-suave); }
td { padding: .75rem 1rem; vertical-align: middle; }
.badge {
  display: inline-block;
  padding: .25rem .75rem;
  border-radius: 50px;
  font-size: .75rem; font-weight: 700;
}
.badge-pendiente  { background: #fff3cd; color: #856404; }
.badge-entregado  { background: var(--verde-suave); color: var(--verde); }
.badge-anulado    { background: #fdecea; color: var(--rojo); }

/* ── Info box (ticket preview) ── */
.info-box {
  background: var(--verde-suave);
  border: 2px solid var(--verde-claro);
  border-radius: var(--radio-sm);
  padding: 1rem 1.25rem;
  margin: .75rem 0;
}
.info-row {
  display: flex; justify-content: space-between;
  align-items: center;
  padding: .35rem 0;
  border-bottom: 1px solid rgba(46,204,113,.2);
  font-size: .9rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 600; color: var(--verde); }
.info-val   { font-family: var(--mono); font-size: .85rem; }

/* ── Cámara QR ── */
#camara-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: var(--radio);
  overflow: hidden;
  background: #000;
  box-shadow: var(--sombra);
}
#video { width: 100%; display: block; }
#scan-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 200px; height: 200px;
  border: 3px solid var(--verde-claro);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
  pointer-events: none;
}
#scan-overlay::before, #scan-overlay::after {
  content: '';
  position: absolute;
  width: 30px; height: 30px;
  border-color: var(--verde-claro);
  border-style: solid;
}
#scan-overlay::before {
  top: -3px; left: -3px;
  border-width: 4px 0 0 4px;
  border-radius: 6px 0 0 0;
}
#scan-overlay::after {
  bottom: -3px; right: -3px;
  border-width: 0 4px 4px 0;
  border-radius: 0 0 6px 0;
}
.scan-line {
  position: absolute;
  left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--verde-claro), transparent);
  animation: scanAnim 2s ease-in-out infinite;
}
@keyframes scanAnim {
  0%   { top: 10%; }
  50%  { top: 85%; }
  100% { top: 10%; }
}
.camara-btns {
  display: flex; gap: 1rem;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ── Menú índice ── */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}
.menu-item {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 1.75rem 1.25rem;
  text-align: center;
  text-decoration: none;
  color: var(--gris-oscuro);
  box-shadow: var(--sombra);
  border: 2px solid transparent;
  transition: all .25s ease;
  display: flex; flex-direction: column;
  align-items: center; gap: .75rem;
}
.menu-item:hover {
  border-color: var(--verde-med);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(26,107,60,.2);
}
.menu-icon {
  font-size: 2.5rem;
  width: 70px; height: 70px;
  background: var(--verde-suave);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.menu-label { font-weight: 700; font-size: .95rem; }
.menu-desc  { font-size: .78rem; color: #888; }

/* ── Hero banner ── */
.hero {
  background: linear-gradient(135deg, var(--verde) 0%, #0d4a28 100%);
  color: var(--blanco);
  border-radius: var(--radio);
  padding: 2.5rem 2.25rem;
  margin-bottom: 2rem;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '🌿';
  position: absolute; right: -10px; top: -20px;
  font-size: 8rem; opacity: .07;
  pointer-events: none;
}
.hero h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: .4rem; }
.hero p  { font-size: .9rem; opacity: .85; max-width: 480px; }

/* ── Ticket PDF preview ── */
.ticket-preview {
  border: 3px dashed var(--verde-med);
  border-radius: var(--radio);
  padding: 1.5rem;
  background: #fafffe;
  text-align: center;
}
.ticket-preview h3 {
  font-size: 1.1rem; font-weight: 800;
  color: var(--verde); margin-bottom: .75rem;
}
.qr-placeholder {
  width: 120px; height: 120px;
  background: var(--gris-oscuro);
  border-radius: 8px;
  margin: 1rem auto;
  display: flex; align-items: center; justify-content: center;
  color: var(--blanco); font-size: .7rem; text-align: center;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .header { padding: 0 1rem; }
  .header-nav .nav-btn span { display: none; }
  .main { padding: 0 .75rem; margin: 1.25rem auto; }
  .card { padding: 1.25rem 1rem; }
  .hero { padding: 1.5rem 1.25rem; }
}

/* ── Loader ── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: var(--blanco);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: #aaa;
  font-size: .78rem;
}
