body {
  font-family: "Poppins", sans-serif;
  background: #fafafa;
  margin: 0;
  padding: 0;
  text-align: center;
  color: #222;
}

h1, h2 {
  font-weight: 600;
  letter-spacing: 0.5px;
}

button, input {
  font-family: inherit;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;

  /* Fondo translúcido */
  background: rgba(255, 255, 255, 0.72);

  /* Efecto glass */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  /* Visual */
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

#numbers-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
  padding: 16px;
  max-width: 900px;
  margin: 0 auto;
}

.pair {
  padding: 10px 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.9rem;
  transition: 0.2s;
  user-select: none;
}

.pair.libre {
  background: #e8e8e8;
  color: #222;               /* Texto más suave y elegante */
  box-sizing: border-box;
  transition: 0.5s ease;

}

.pair.libre:hover {
  background: rgba(255,255,255,0.9);
  outline: 1px solid #222;     /* 👈 la clave */
  box-sizing: border-box;
  outline-offset: -1px;        /* opcional, ajusta posición */
  transform: scale(1.05);
 
}

.pair.ocupado {
  background: #f44336;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.8;
}

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 350px;
  text-align: left;
    /* Animación inicial */
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  animation: modalShow 0.35s ease forwards;
}
@keyframes modalShow {
  0% {
    transform: scale(0.85) translateY(20px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}


.modal h2 {
  margin-top: 0;
}

*, *::before, *::after { box-sizing: border-box; }

/* O solo en el modal */
.modal input {
  box-sizing: border-box;     /* <- clave */
  width: 100%;
  margin: 6px 0 12px;
  padding: 10px 12px;         /* un pelín más cómodo */
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
}

.modal input:focus {
  border-color: #4caf50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, .15);
}

.modal button {
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  width: 100%;
  font-weight: 600;
}

.modal button:hover {
  background: #43a047;
}

button:disabled {
  background: #cccccc !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

#search-input {
  margin-top: 10px;
  padding: 10px 14px;
  width: 100%;
  max-width: 320px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.15);
  font-size: 1rem;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(6px);
  outline: none;
  transition: 0.2s ease;
}

#search-input:focus {
  border-color: #4caf50;
  box-shadow: 0 0 0 3px rgba(76,175,80,0.25);
}

.search-highlight {
  outline: 3px solid #4caf50;
  outline-offset: -3px;
  background: #ffffff !important;
  transform: scale(1.05);
  transition: 0.25s ease;
}
.search-highlight.ocupado {
  color: #f44336 !important;

} 


/* --- LOADER OVERLAY --- */
.loader-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  z-index: 999;  
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Ocultar (cuando termina el loading) */
.loader-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

/* --- SPINNER --- */
.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(0,0,0,0.15);
  border-top-color: #4caf50;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Texto bajo el loader */
.loader-backdrop p {
  font-size: 1rem;
  margin-top: 12px;
  color: #333;
}


/* Loader dentro del botón */
.btn-loading {
  pointer-events: none;
  opacity: 0.7;
}

.spinner-btn {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


.modal-info {
  background: rgba(33,150,243,0.15);
  border-left: 4px solid #2196f3;
  color: #0d47a1;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  backdrop-filter: blur(4px);
}

.modal-error {
  background: rgba(244,67,54,0.15);
  border-left: 4px solid #f44336;
  color: #b71c1c;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  backdrop-filter: blur(4px);
}

.modal-success {
  background: rgba(76,175,80,0.15);
  border-left: 4px solid #4caf50;
  color: #1b5e20;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  backdrop-filter: blur(4px);
}

.hidden {
  opacity: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}


.selected-numbers {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  justify-content: center;
}

.number-chip {
  padding: 8px 14px;
  background: #666866;
  border-radius: 14px;
  font-weight: 600;
  font-size: 1.1rem;
  color: #fff;
  backdrop-filter: blur(8px) saturate(160%);
  -webkit-backdrop-filter: blur(8px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  text-shadow: 0 0 4px rgba(0,0,0,0.3);
  letter-spacing: 1px;
  transition: transform 0.2s ease;
}

.number-chip:hover {
  transform: scale(1.07);
}

.cost-chip {
  padding: 8px 14px;
  background: #4caf50;
  border-radius: 14px;
  font-weight: 600;
  font-size: 1.1rem;
  color: #fff;
  backdrop-filter: blur(8px) saturate(160%);
  -webkit-backdrop-filter: blur(8px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  text-shadow: 0 0 3px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cost-chip::before {
  content: "💰";
  font-size: 1.1rem;
}

.modal-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.hidden {
  display: none !important;
}

.modal-info-text {
  color: #fff;
  text-align: center;
  margin-bottom: 10px;
  font-size: 1rem;
  opacity: 0.9;
}

/* --- LEYENDA / CONVENCIONES --- */

.legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #333;
  font-weight: 500;
}

.legend-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.2);
}

/* Colores según estado */
.legend-box.libre {
  background: #e0e0e0;
}

.legend-box.apartado {
  background: #E53935;
}

.legend-box.pagado {
  background: #E53935;
}

.legend-box.confirmado {
  background: #E53935;
}


.body {
  position: relative;
  min-height: 100vh;
  z-index: 0;
}

.qr-container {
  max-width: 140px;
}