:root {
  --color-primary: #0ea5e9; /* celeste */
  --color-success: #16a34a;
  --color-warning: #eab308;
  --color-error: #dc2626;
  --color-bg: #f9fafb;
  --color-card: #ffffff;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-sold: #fee2e2;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .header {
    min-height: 110px;
    padding: 15px 90px;
  }

  .escudo-institucional {
    left: 12px;
    width: 65px;
    height: 65px;
  }

  .header h1 {
    font-size: 1.2rem;
  }
  
  #admin-user {
    font-size: 0.85rem;
    word-break: break-word;
  }
}

/* Header */

.header {
  background: var(--color-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 150px;
  padding: 20px 140px;
}

.escudo-institucional {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  width: 105px;
  height: 105px;
  object-fit: contain;
  margin: 0;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.premio {
  font-size: 0.875rem;
  color: var(--color-warning);
  font-weight: 600;
}

.fecha {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Main */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 1rem;
}

.main:has(.resumen-fijo:not(.hidden)) {
  padding-bottom: 120px;
}

.main:has(.form-reserva-fijo:not(.hidden)) {
  padding-bottom: min(70vh, 640px);
}

/* Screens */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fade-in 0.3s ease;
}

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

/* Precio info */
.precio-info {
  display: flex;
  justify-content: space-between;
  background: var(--color-card);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* Grilla */
.grilla-wrapper {
  background: var(--color-card);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

.grilla {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.3rem;
}

.num-btn {
  width: 100%;
  min-height: 30px;
  aspect-ratio: 1 / 0.82;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.num-btn:hover {
  transform: scale(1.05);
}

.num-btn.free {
  background: #dcfce7;
  color: var(--color-success);
}

.num-btn.sold {
  background: var(--color-sold);
  color: var(--color-error);
}

.num-btn.selected {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3);
  transform: scale(1.02);
}

.num-btn.selected:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.4);
}

.num-btn:disabled {
  cursor: not-allowed;
  transform: none;
}

/* Resumen */
.resumen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-card);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  gap: 0.5rem;
}

.resumen span {
  font-size: 0.875rem;
}

/* Formulario */
.form-reserva {
  background: var(--color-card);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-reserva h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.875rem;
}

/* Botones */
.btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--color-text-muted);
  color: white;
  /*margin-top: 0.5rem;*/
}

.btn-secondary:hover {
  background: #4b5563;
}

.btn-mp {
  background: #0092ff;
  color: white;
}

.btn-mp:hover {
  background: #0077cc;
}

.btn-whatsapp {
  background: #25d36f;
  color: white;
  display: block;
  text-align: center;
  text-decoration: none;
  margin-bottom: 0.75rem;
}

.btn-whatsapp:hover {
  background: #128940;
}

/* Countdown */
.countdown {
  text-align: center;
  background: var(--color-warning);
  color: var(--color-card);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.countdown span {
  font-size: 1rem;
}

/* Pago */
.pago-info {
  background: var(--color-card);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.pago-info p {
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.pago-metodos {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* Transferencia */
.transferencia {
  background: var(--color-card);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.transferencia h3 {
  color: var(--color-success);
  margin-bottom: 0.5rem;
  text-align: center;
}

.transferencia p {
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  text-align: center;
}

.transferencia strong {
  color: var(--color-primary);
}

/* Estado */
.estado {
  text-align: center;
  background: var(--color-card);
  padding: 2rem 1rem;
  border-radius: 8px;
}

.estado-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
}

.icon-success {
  background: #dcfce7;
  color: var(--color-success);
}

.icon-error {
  background: #fee2e2;
  color: var(--color-error);
}

.estado h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.estado-mensaje {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.numeros-confirmados {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1rem;
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .grilla {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
  }

  .num-btn {
    font-size: 0.625rem;
  }
}


/* Buscador de números */
.buscador-numero { background: var(--color-card); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.buscador-numero label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .5rem; }
.buscador-controles { display: flex; gap: .5rem; }
.buscador-controles input { min-width: 0; flex: 1; padding: .7rem; border: 1px solid var(--color-border); border-radius: 8px; font-size: 1rem; }
.buscador-controles .btn { width: auto; min-width: 100px; margin: 0; }
.mensaje-busqueda, .estado-grilla { margin-top: .55rem; font-size: .82rem; color: var(--color-text-muted); }
.mensaje-busqueda.error { color: var(--color-error); }
.mensaje-busqueda.exito { color: var(--color-success); font-weight: 600; }
.leyenda-numeros { display: flex; flex-wrap: wrap; gap: .9rem; margin: .75rem 0 .25rem; font-size: .8rem; }
.leyenda-numeros span { display: inline-flex; align-items: center; gap: .35rem; }
.leyenda-color { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; }
.leyenda-color.libre { background: #dcfce7; border: 1px solid #86efac; }
.leyenda-color.vendido { background: var(--color-sold); border: 1px solid #fca5a5; }
.num-btn.busqueda-destacada { outline: 3px solid #2563eb; outline-offset: 2px; transform: scale(1.08); z-index: 1; }
@media (max-width: 480px) {
  .precio-info { flex-direction: column; gap: .25rem; }
  .grilla { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .3rem; }
  .num-btn { font-size: .7rem; }
  .buscador-controles .btn { min-width: 85px; }
}

/* Grilla compacta con desplazamiento independiente y resumen fijo al pie */
.grilla-wrapper {
  max-height: min(72vh, 720px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.65rem;
  margin-bottom: 1rem;
}
.resumen-fijo {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: 100%;
  max-width: 1008px;
  margin: 0 auto;
  border-radius: 12px 12px 0 0;
  padding: 0.65rem max(0.75rem, env(safe-area-inset-right)) calc(0.65rem + env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.12);
}
.resumen-fijo #numeros-seleccionados {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  max-height: 3.1em;
  overflow-y: auto;
}
.resumen-fijo #total-seleccion { white-space: nowrap; font-weight: 700; }
.resumen-fijo #btn-reservar { width: auto; min-width: 110px; margin: 0; flex-shrink: 0; }
.leyenda-numeros { margin-top: 0.4rem; margin-bottom: 0.25rem; }
.leyenda-color.vendido { background: #fee2e2; border: 1px solid #fca5a5; }
.num-btn.sold { background: #fee2e2; color: #b91c1c; }
.num-btn.free { background: #dcfce7; color: #166534; }
.num-btn.busqueda-destacada { outline: 3px solid #2563eb; outline-offset: 1px; }
@media (max-width: 640px) {
  .main { padding: 0.65rem; padding-bottom: 0.65rem; }
  .grilla-wrapper { max-height: calc(100dvh - 365px); min-height: 170px; }
  .grilla { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0.25rem; }
  .num-btn { min-height: 27px; font-size: 0.65rem; border-radius: 4px; }
  .resumen-fijo { gap: 0.4rem; }
  .resumen-fijo #numeros-seleccionados { font-size: 0.72rem; }
  .resumen-fijo #total-seleccion { font-size: 0.85rem; }
  .resumen-fijo #btn-reservar { min-width: 88px; padding: 0.7rem 0.6rem; }
}


/* =========================================================
   IDENTIDAD VISUAL INSTITUTO LA SALETTE
   Capa estética: no altera estados, estructura ni interacción.
   ========================================================= */
:root {
  --color-primary: #0ea5e9; /* celeste */
  --color-success: #16834a;
  --color-warning: #f2b936;
  --color-error: #c83b45;
  --color-bg: #f3f7fb;
  --color-card: #ffffff;
  --color-text: #25283a;
  --color-text-muted: #68758a;
  --color-border: #dce7f1;
  --color-sold: #fde8e8;
  --salette-navy: #20265b;
  --salette-blue: #69aee0;
  --salette-gold: #f4bd43;
}

body {
  font-family: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
  background:
    radial-gradient(ellipse at 50% -15%, rgba(105,174,224,.20), transparent 48%),
    var(--color-bg);
  color: var(--color-text);
}

.header {
  position: relative;
  overflow: hidden;
  padding: 1.65rem 1rem 1.45rem;
  background: linear-gradient(135deg, #fff 0%, #f8fbff 100%);
  border-bottom: 4px solid var(--salette-blue);
  box-shadow: 0 5px 20px rgba(32,38,91,.08);
}
.header::before,
.header::after {
  content: "";
  position: absolute;
  top: 0;
  width: 20%;
  height: 5px;
  background: var(--salette-gold);
}
.header::before { left: 0; }
.header::after { right: 0; }
.header h1 {
  color: var(--salette-navy);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  letter-spacing: .025em;
}
.premio {
  color: #9a6b08;
  margin-top: .35rem;
}
.premios-lista {
  list-style: none;
  margin-top: .35rem;
}
.premios-lista li {
  font-size: .9rem;
  line-height: 1.5;
}
.fecha {
  color: var(--color-text-muted);
  margin-top: .2rem;
}

.main {
  max-width: 1040px;
  padding-top: 1.35rem;
}
.precio-info,
.buscador-numero,
.grilla-wrapper,
.pago-info,
.transferencia,
.estado,
.form-reserva,
.admin-section,
.admin-card {
  border: 1px solid var(--color-border);
  border-radius: 15px;
  box-shadow: 0 5px 18px rgba(32,38,91,.055);
}
.precio-info {
  padding: 1rem 1.2rem;
  border-left: 5px solid var(--salette-gold);
  color: var(--salette-navy);
  font-size: .95rem;
}
.precio-info strong { color: var(--salette-navy); }

.buscador-numero {
  padding: 1.2rem;
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.buscador-numero label {
  color: var(--salette-navy);
  font-size: 1rem;
}
.buscador-controles input,
.form-group input,
.admin-edit input {
  border: 1px solid #cbd9e8;
  border-radius: 10px;
  background: #fbfdff;
  color: var(--color-text);
  transition: border-color .18s, box-shadow .18s;
}
.buscador-controles input:focus,
.form-group input:focus,
.admin-edit input:focus {
  outline: none;
  border-color: var(--salette-blue);
  box-shadow: 0 0 0 3px rgba(105,174,224,.2);
}

.btn {
  border-radius: 10px;
  letter-spacing: .01em;
  box-shadow: 0 2px 5px rgba(32,38,91,.08);
}
.btn-primary {
  background: var(--salette-navy);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #303a80;
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--salette-blue);
  color: #10234a;
}
.btn-secondary:hover:not(:disabled) {
  background: #82bee8;
}
.btn-whatsapp {
  background: #1caa63;
  color: white;
}
.btn-whatsapp:hover { background: #168a50; }

.num-btn {
  border-color: #d7e2ec;
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(32,38,91,.04);
}
.num-btn.free {
  background: #e1f6e9;
  color: #176b42;
  border-color: #b9e7cb;
}
.num-btn.sold {
  background: #fde8e8;
  color: #a8323b;
  border-color: #f4c5c5;
}
.num-btn.selected {
  background: var(--salette-navy);
  border-color: var(--salette-gold);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(244,189,67,.28);
}
.num-btn.busqueda-destacada {
  outline-color: var(--salette-gold);
}
.grilla-wrapper {
  background: rgba(255,255,255,.92);
}
.leyenda-numeros {
  color: var(--color-text-muted);
  font-weight: 600;
}
.estado-grilla { color: var(--salette-navy); }

.resumen-fijo {
  border: 1px solid var(--color-border);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: rgba(255,255,255,.97);
  box-shadow: 0 -5px 24px rgba(32,38,91,.12);
  backdrop-filter: blur(10px);
}
.resumen-fijo #total-seleccion { color: var(--salette-navy); }

.form-reserva.form-reserva-fijo {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: 100%;
  max-width: 1008px;
  margin: 0 auto;
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -5px 24px rgba(32,38,91,.12);
}

@media (min-width: 641px) {
  .form-reserva.form-reserva-fijo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1.25rem;
    align-items: end;
  }
  .form-reserva-fijo h3 {
    grid-column: 1 / -1;
  }
  .form-reserva-fijo .form-group:has(#email) {
    grid-column: 1 / -1;
  }
  .form-reserva-fijo button[type="submit"] {
    grid-column: 1;
  }
  .form-reserva-fijo #btn-cancelar-reserva {
    grid-column: 2;
    margin-top: 0 !important;
  }
}

.form-reserva h3,
.transferencia h3,
.estado h2 {
  color: var(--salette-navy);
}
.transferencia strong,
.numeros-confirmados { color: var(--salette-navy); }
.transferencia h3 { color: #176b42; }

.footer {
  color: #718097;
  letter-spacing: .035em;
  padding: 1.4rem 1rem 1.8rem;
}

/* Administración: mantiene la misma identidad institucional */
.admin-nav { gap: .7rem !important; }
.admin-nav .btn { min-height: 54px; transition: all 0.2s; }
.admin-nav .btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(32,38,91,.15);
}
.admin-section { background: #fff; }
.admin-card {
  background: #fff;
  border-left: 4px solid var(--salette-blue);
}
.admin-card h4 { color: var(--salette-navy); }
.admin-meta { line-height: 1.65; }
.admin-edit { border-top-color: var(--color-border); }
.free-number {
  background: #e1f6e9;
  color: #176b42;
  border: 1px solid #b9e7cb;
  border-radius: 8px;
  padding: .55rem .2rem;
}
.btn-danger { background: var(--color-error); }
.btn-success { background: #16834a; }

@media (max-width: 640px) {
  .header { padding: 1.25rem .8rem 1.1rem; }
  .escudo-institucional {
    position: static;
    transform: none;
    width: 72px;
    height: 72px;
    margin: 0 auto .6rem;
  }
  .main { padding-top: .85rem; }
  .precio-info,
  .buscador-numero { border-radius: 12px; }
  .admin-nav .btn { flex-basis: 100%; transition: all 0.2s; }
  .admin-nav .btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(32,38,91,.15);
  }
  .header h1 {
    font-size: 1.1rem;
    line-height: 1.2;
  }
  #admin-user {
    font-size: 0.85rem;
    word-break: break-word;
  }
}
