/* ===========================================================================
   sorteo.css
   ---------------------------------------------------------------------------
   Estilos exclusivos de la pagina individual del sorteo.
   Se carga DESPUES de estilos.css y reutiliza sus tokens de :root.
   =========================================================================== */

/* ---------------------------------------------------------------------------
   1. CABECERA DEL SORTEO
   --------------------------------------------------------------------------- */
.ficha {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 48px 0 56px;
  align-items: start;
}

.ficha__galeria {
  background: var(--tinta-2);
  border: 1px solid var(--tinta-3);
  border-radius: var(--radio);
  overflow: hidden;
}

.ficha__foto {
  aspect-ratio: 4 / 3;
  background: var(--tinta-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--papel-2);
}

.ficha__miniaturas {
  display: flex;
  gap: 8px;
  padding: 12px;
}

.miniatura {
  flex: 1;
  aspect-ratio: 1;
  background: var(--tinta-3);
  border-radius: var(--radio-sm);
  border: 2px solid transparent;
  cursor: pointer;
}

.miniatura.activa { border-color: var(--suerte); }
.miniatura img { border-radius: 5px; }
.miniatura:hover { border-color: var(--papel-2); }

.ficha__titulo {
  font-family: var(--display);
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  line-height: 1;
  letter-spacing: -.025em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.ficha__descripcion {
  color: var(--papel-2);
  margin-bottom: 26px;
  max-width: 54ch;
}

.ficha__cifras {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 22px;
  background: var(--tinta-2);
  border: 1px solid var(--tinta-3);
  border-radius: var(--radio);
  margin-bottom: 22px;
}

.cifra__valor {
  font-family: var(--mono);
  font-size: 1.42rem;
  font-weight: 700;
  color: var(--suerte);
  line-height: 1.15;
}

.cifra__nombre {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--papel-2);
  margin-top: 5px;
}

.ficha__fecha {
  font-family: var(--mono);
  font-size: .88rem;
  color: var(--papel-2);
}

.ficha__fecha strong { color: var(--papel); }

/* ---------------------------------------------------------------------------
   2. SELECTOR: PESTANAS
   --------------------------------------------------------------------------- */
.selector {
  background: var(--tinta-2);
  border: 1px solid var(--tinta-3);
  border-radius: var(--radio);
  overflow: hidden;
}

.pestanas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--tinta-3);
}

.pestana {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--papel-2);
  font-family: var(--texto);
  font-weight: 700;
  font-size: .97rem;
  padding: 20px 14px;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.pestana:hover { color: var(--papel); }

.pestana.activa {
  color: var(--papel);
  border-bottom-color: var(--suerte);
  background: rgba(255, 201, 60, .06);
}

.panel { display: none; padding: 30px; }
.panel.activo { display: block; }

.panel__titulo {
  font-weight: 700;
  font-size: 1.04rem;
  margin-bottom: 6px;
}

.panel__nota {
  color: var(--papel-2);
  font-size: .89rem;
  margin-bottom: 22px;
  max-width: 62ch;
}

/* ---------------------------------------------------------------------------
   3. CANTIDADES RAPIDAS Y PAQUETES
   --------------------------------------------------------------------------- */
.cantidades {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.cantidad {
  background: var(--tinta);
  border: 2px solid var(--tinta-3);
  border-radius: var(--radio);
  color: var(--papel);
  font-family: var(--mono);
  font-size: 1.04rem;
  font-weight: 700;
  padding: 15px 22px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
  position: relative;
}

.cantidad:hover { border-color: var(--papel-2); }

.cantidad.elegida {
  border-color: var(--suerte);
  background: rgba(255, 201, 60, .12);
}

.cantidad__ahorro {
  display: block;
  font-family: var(--texto);
  font-size: .68rem;
  font-weight: 400;
  color: var(--libre);
  letter-spacing: .02em;
  margin-top: 3px;
}

.contador-manual {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.contador-manual__boton {
  width: 46px;
  height: 46px;
  border-radius: var(--radio);
  border: 2px solid var(--tinta-3);
  background: var(--tinta);
  color: var(--papel);
  font-size: 1.3rem;
  font-family: var(--mono);
  cursor: pointer;
  line-height: 1;
}

.contador-manual__boton:hover { border-color: var(--suerte); }

.contador-manual__campo {
  width: 96px;
  text-align: center;
  background: var(--tinta);
  border: 2px solid var(--tinta-3);
  border-radius: var(--radio);
  color: var(--papel);
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 13px 8px;
}

.contador-manual__campo:focus { border-color: var(--suerte); outline: none; }

.contador-manual__etiqueta { color: var(--papel-2); font-size: .9rem; }

/* ---------------------------------------------------------------------------
   4. TABLERO COMPLETO
   --------------------------------------------------------------------------- */
.buscador {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.buscador .campo { min-width: 150px; flex: 0 1 220px; }

.bloques {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 20px;
  scrollbar-width: thin;
}

.bloque {
  flex-shrink: 0;
  background: var(--tinta);
  border: 2px solid var(--tinta-3);
  border-radius: var(--radio-sm);
  color: var(--papel-2);
  font-family: var(--mono);
  font-size: .8rem;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.bloque:hover { color: var(--papel); }

.bloque.activo {
  border-color: var(--suerte);
  color: var(--papel);
  background: rgba(255, 201, 60, .1);
}

.rejilla-numeros {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 6px;
  margin-bottom: 22px;
}

.numero {
  background: var(--tinta);
  border: 1px solid var(--tinta-3);
  border-radius: var(--radio-sm);
  color: var(--papel);
  font-family: var(--mono);
  font-size: .8rem;
  padding: 11px 2px;
  cursor: pointer;
  text-align: center;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.numero:hover:not(:disabled) { border-color: var(--libre); }

.numero--elegido {
  background: var(--suerte);
  border-color: var(--suerte);
  color: var(--tinta);
  font-weight: 700;
}

.numero--vendido,
.numero--apartado {
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: .42;
}

.numero--vendido { background: rgba(232, 69, 95, .16); border-color: transparent; }
.numero--apartado { background: rgba(255, 201, 60, .12); border-color: transparent; }

.numero--destacado {
  animation: latido 1.1s ease 2;
}

@keyframes latido {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 224, 168, .7); }
  50%      { box-shadow: 0 0 0 7px rgba(63, 224, 168, 0); }
}

.cargando {
  padding: 44px 0;
  text-align: center;
  color: var(--papel-2);
  font-family: var(--mono);
  font-size: .85rem;
}

/* ---------------------------------------------------------------------------
   5. RESUMEN DE COMPRA
   --------------------------------------------------------------------------- */
.resumen {
  background: var(--tinta-2);
  border: 1px solid var(--tinta-3);
  border-radius: var(--radio);
  padding: 26px;
  margin-top: 26px;
}

.resumen__titulo {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--papel-2);
  margin-bottom: 16px;
}

.fichas-numeros {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 20px;
  max-height: 132px;
  overflow-y: auto;
}

.ficha-numero {
  background: var(--tinta);
  border: 1px solid var(--suerte);
  border-radius: 99px;
  color: var(--suerte);
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ficha-numero button {
  background: none;
  border: none;
  color: var(--papel-2);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.ficha-numero button:hover { color: var(--sello); }

.resumen__vacio {
  color: var(--papel-2);
  font-size: .9rem;
  padding: 8px 0 20px;
}

.linea {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  font-size: .94rem;
  gap: 16px;
}

.linea span:last-child { font-family: var(--mono); }
.linea--descuento span:last-child { color: var(--libre); }

.linea--total {
  border-top: 1px solid var(--tinta-3);
  margin-top: 8px;
  padding-top: 16px;
  font-size: 1.28rem;
  font-weight: 700;
}

.linea--total span:last-child { color: var(--suerte); font-size: 1.5rem; }

.aviso-precio {
  color: var(--papel-2);
  font-size: .78rem;
  margin-top: 14px;
  line-height: 1.5;
}

/* Mensaje de conflicto cuando alguien se adelanto */
.conflicto {
  display: none;
  background: rgba(232, 69, 95, .12);
  border: 1px solid var(--sello);
  border-radius: var(--radio);
  padding: 16px 18px;
  margin-bottom: 18px;
  font-size: .9rem;
}

.conflicto.visible { display: block; }
.conflicto strong { color: var(--sello); }

/* ---------------------------------------------------------------------------
   6. BARRA INFERIOR FIJA (movil)
   --------------------------------------------------------------------------- */
.barra-compra {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  background: var(--tinta-2);
  border-top: 1px solid var(--tinta-3);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: none;
  align-items: center;
  gap: 14px;
  box-shadow: 0 -12px 34px rgba(0, 0, 0, .42);
}

.barra-compra__datos { flex: 1; min-width: 0; }

.barra-compra__total {
  font-family: var(--mono);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--suerte);
  line-height: 1.1;
}

.barra-compra__detalle {
  font-size: .76rem;
  color: var(--papel-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barra-compra .boton { width: auto; flex-shrink: 0; padding: 15px 26px; }

/* ---------------------------------------------------------------------------
   7. DETALLES DEL SORTEO
   --------------------------------------------------------------------------- */
.bloque-info { margin-bottom: 34px; }

.bloque-info__titulo {
  font-family: var(--display);
  font-size: 1.22rem;
  text-transform: uppercase;
  letter-spacing: -.01em;
  margin-bottom: 14px;
}

.bloque-info__texto { color: var(--papel-2); max-width: 76ch; }

.lista-condiciones {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
  max-width: 76ch;
}

.lista-condiciones li {
  color: var(--papel-2);
  padding-left: 22px;
  position: relative;
  font-size: .94rem;
}

.lista-condiciones li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--suerte);
}

/* ---------------------------------------------------------------------------
   8. RESPONSIVE
   --------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .ficha { grid-template-columns: 1fr; gap: 32px; padding: 32px 0 40px; }
}

@media (max-width: 640px) {
  body { padding-bottom: 92px; }        /* espacio para la barra fija */
  .barra-compra { display: flex; }
  .panel { padding: 22px 18px; }
  .ficha__cifras { grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px; }
  .rejilla-numeros { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; }
  .cantidad { flex: 1 1 calc(33.333% - 7px); padding: 14px 8px; }
  .resumen { padding: 20px; }
  .resumen__accion { display: none; }   /* el CTA vive en la barra fija */
}
