/* ---------- VARIABLES ---------- */
:root {
  --bg: #0f1115;
  --panel: #161a22;
  --muted: #9aa3b2;
  --primary: #1f6fff; /* azul principal */
  --accent: #0d47a1;
  --card-radius: 12px;
  --glass-shadow: 0 6px 20px rgba(0,0,0,0.35);
  --max-width: 1100px;
}

/* ---------- RESET / BASE ---------- */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.45;
  background: #0d1117;
  margin: 0;
  padding: 0;
}

/* ---------- CONTAINER ---------- */
.container {
  width: 90%;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ---------- HEADER ---------- */
.header {
  width: 100%;
  background: linear-gradient(180deg, rgba(8,16,36,0.95), rgba(8,16,36,0.85));
  border-bottom: 1px solid rgba(255,255,255,0.03);
  position: relative;
  z-index: 40;
  padding: 12px 0;
}

.header_container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Logo principal */
.miguel a {
  display: inline-block;
}

.miguel img {
  display: block;
  max-height: 75px;
  width: auto;
  object-fit: contain;
}

/* Header icons */
.header_icons {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-end;
}

.header_icons img {
  display: block;
  max-height: 50px;
  width: auto;
  object-fit: contain;
  border-radius: 6px;
  transition: transform 0.18s ease, opacity 0.18s ease;
  background: transparent;
  padding: 2px;
}

.header_icons img:hover {
  transform: translateY(-4px);
  opacity: 0.95;
}

/* ---------- HERO (opcional) ---------- */
.hero {
  text-align: center;
  padding: 64px 0;
}

.hero h2 {
  font-size: 36px;
  margin: 0 0 10px;
  color: #fff;
  font-weight: 800;
}

.hero p {
  color: var(--muted);
  margin: 0 0 18px;
}

/* ---------- RIFAS / CARDS ---------- */
.rifas {
  padding: 28px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 28px;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
}

.cards {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.rifa_container {
  width: 290px;
  background: var(--panel);
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
}

.rifa_container:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.rifa_container img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-body h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.price {
  color: var(--primary);
  font-weight: 700;
}

/* ---------- BARRA DE PROGRESO ---------- */
.progress {
  width: 100%;
  height: 22px;
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  transition: width 0.8s ease;
}

/* ---------- BOTONES PRINCIPALES ---------- */
.btn-primary {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  text-align: center;
  transition: background 0.15s ease, transform 0.15s ease;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: #1554c9;
  transform: translateY(-2px);
}

.btn-primary.full {
  display: block;
  width: 100%;
}

/* Botón secundario (usado en consultar, cancelar, etc.) */
.btn-secondary {
  display: inline-block;
  background: #2d2d2d;
  color: #fff;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  text-align: center;
  transition: background 0.15s ease, transform 0.15s ease;
  border: none;
  cursor: pointer;
  width: 100%;
}

.btn-secondary:hover {
  background: #3d3d3d;
  transform: translateY(-2px);
}

/* Botón cerrar modal específico */
.btn-cerrar-modal {
  background: #444;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-cerrar-modal:hover {
  background: #555;
}

/* ---------- SECCIÓN ¿CÓMO PARTICIPAR? ---------- */
.como {
  padding: 42px 0;
  background: transparent;
}

.steps {
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: stretch;
  flex-wrap: wrap;
}

.step {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  padding: 18px;
  border-radius: 12px;
  min-width: 180px;
  text-align: center;
}

.step span {
  display: inline-block;
  width: 40px;
  height: 40px;
  line-height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  margin-bottom: 10px;
}

/* ---------- FOOTER ---------- */
.footer {
  padding: 30px 0;
  text-align: center;
  color: #9aa3b2;
  border-top: 1px solid rgba(255,255,255,0.02);
}

/* ---------- WHATSAPP FLOTANTE ---------- */
.whatsapp_float {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #25D366;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  z-index: 99999;
  transition: transform 0.18s ease, opacity 0.18s ease;
  text-decoration: none;
  overflow: hidden;
}

.whatsapp_float img {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
}

/* ---------- MODALES GENÉRICOS ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-content {
  background: #1e1e1e;
  width: 90%;
  max-width: 500px;
  padding: 25px;
  border-radius: 12px;
  color: #fff;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin-bottom: 15px;
}

/* ---------- MODAL TÉRMINOS ---------- */
.terminos-texto p {
  font-size: 13px;
  margin-bottom: 10px;
  color: #ccc;
}

.terminos-check {
  margin: 15px 0;
  font-size: 14px;
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
}

.modal-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#cancelar {
  background: #444;
  color: #fff;
}

#continuar {
  background: #1f6fff;
  color: #fff;
}

#continuar:disabled {
  background: #555;
  cursor: not-allowed;
}

/* ---------- MODAL CONSULTA ---------- */
#modalConsulta .modal-content {
  max-width: 700px;
}

#cedulaConsulta {
  flex: 1;
  min-width: 200px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #fff;
  font-size: 16px;
}

#cedulaConsulta:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88,166,255,0.2);
}

/* Área de resultados con scroll */
.resultado-scroll {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  padding: 5px;
}

.resultado-scroll table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.resultado-scroll th {
  background: #161b22;
  color: #58a6ff;
  font-weight: 600;
  padding: 12px 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.resultado-scroll td {
  padding: 10px 8px;
  border-bottom: 1px solid #30363d;
  color: #c9d1d9;
}

.resultado-scroll tr:hover td {
  background: #1f2937;
}

/* Etiquetas de números */
.numeros-tag {
  display: inline-block;
  background: #238636;
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px;
}

/* ---------- MODAL DE PAGO ---------- */
.pago-container {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.pago-container.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  width: 100%;
  max-width: 1000px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px;
  border-radius: 22px;
  position: relative;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 50px;
  background: rgba(22, 27, 34, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 40px 80px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(255,255,255,0.03);
  transform: translateY(40px) scale(0.96);
  opacity: 0;
  transition: all 0.4s cubic-bezier(.22,1,.36,1);
}

.pago-container.active .modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.cerrar-modal {
  position: absolute;
  top: 25px;
  right: 30px;
  font-size: 22px;
  cursor: pointer;
  color: #fff;
}

.modal-box h2 {
  grid-column: 1 / -1;
  font-weight: 600;
  margin-bottom: 10px;
}

.modal-box form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-box label {
  font-size: 13px;
  color: #8b949e;
}

.modal-box input {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #30363d;
  background: #161b22;
  color: #fff;
  transition: all 0.2s ease;
}

.modal-box input:focus {
  border-color: #43a047;
  outline: none;
  box-shadow: 0 0 0 3px rgba(67,160,71,0.2);
}

.resumen {
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
  padding: 28px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  height: fit-content;
}

.resumen p {
  display: flex;
  justify-content: space-between;
  margin: 14px 0;
  font-size: 14px;
  color: #c9d1d9;
}

#pagoTotal {
  font-size: 22px;
  font-weight: 700;
  color: #4caf50;
}

/* ---------- PÁGINA DE COMPRA ---------- */
.card-compra {
  background: #161b22;
  padding: 10px 20px;
  margin: 60px auto;
  border-radius: 18px;
  width: 300px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  animation: fadeIn 0.5s ease-out;
  transition: transform 0.3s ease;
}

.card-compra:hover {
  transform: translateY(-4px);
}

.precio-unitario {
  color: #58a6ff;
  margin-bottom: 25px;
}

/* Botones rápidos (compra) */
.botones-rapidos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.botones-rapidos button {
  flex: 1 1 auto;
  background: #1f2937;
  color: #58a6ff;
  border: 1px solid #30363d;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.botones-rapidos button:hover {
  background: #58a6ff;
  color: #000;
  transform: scale(1.05);
}

/* Contador */
.contador {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}

.contador button {
  background: #21262d;
  border: none;
  color: #58a6ff;
  font-size: 18px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

.contador button:hover {
  background: #58a6ff;
  color: #000;
  transform: scale(1.1);
}

.contador button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#cantidad {
  font-size: 22px;
  font-weight: 600;
}

.monto {
  text-align: center;
  font-size: 18px;
  margin-bottom: 20px;
}

#totalPagar {
  color: #58a6ff;
  font-size: 20px;
  transition: all 0.3s ease;
}

.animate-total {
  transform: scale(1.2);
  color: #00c3ff;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wrapper {
  display: flex;
  justify-content: center;
  padding: 60px 20px;
}

.compra-container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

#reset {
  background-color: #841c1c;
}

#mensajeEstado {
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

/* ---------- PANEL DE ADMINISTRACIÓN (COMPACTO) ---------- */
.login-box {
  background: #161b22;
  padding: 24px;
  border-radius: 16px;
  max-width: 400px;
  margin: 40px auto;
}

.login-box h2 {
  margin-bottom: 16px;
  font-size: 20px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #0d1117;
  color: #fff;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: #238636;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.login-box button:hover {
  background: #2ea043;
}

.error {
  color: #f85149;
  margin-top: 10px;
  font-size: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab {
  flex: 1;
  padding: 10px 12px;
  background: #21262d;
  color: #8b949e;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
  font-size: 14px;
}

.tab.active {
  background: #238636;
  color: #fff;
}

/* Tarjetas de compra en admin */
.card {
  background: #161b22;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid #30363d;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.card-header strong {
  font-size: 15px;
}

.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge.pendiente {
  background: #f0883e;
  color: #000;
}

.badge.verificado {
  background: #238636;
  color: #fff;
}

.card-body p {
  margin: 5px 0;
  font-size: 13px;
  color: #c9d1d9;
  word-break: break-word;
  line-height: 1.4;
}

.card-body strong {
  color: #fff;
  font-weight: 600;
}

/* Botones pequeños en admin */
.btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
  margin-right: 6px;
  margin-bottom: 6px;
  display: inline-block;
}

.btn-primary {
  background: #238636;
  color: #fff;
}

.btn-primary:hover {
  background: #2ea043;
}

.btn-secondary {
  background: #21262d;
  color: #c9d1d9;
}

.btn-secondary:hover {
  background: #30363d;
}

.btn-whatsapp {
  background: #25D366;
  color: #fff;
  font-size: 12px;
}

.btn-whatsapp:hover {
  background: #20b859;
}

/* Caja de números en admin */
.numeros-box {
  background: #0d1117;
  padding: 8px;
  border-radius: 6px;
  margin-top: 8px;
  border-left: 4px solid #238636;
}

.numeros-box strong {
  font-size: 12px;
  display: block;
  margin-bottom: 4px;
}

.numeros-box span {
  display: inline-block;
  background: #238636;
  color: #fff;
  padding: 4px 8px;
  border-radius: 16px;
  margin: 3px;
  font-weight: 600;
  font-size: 12px;
}

.loading, .empty {
  text-align: center;
  padding: 30px;
  color: #8b949e;
  font-size: 14px;
}

/* ---------- BARRAS DE SCROLL PERSONALIZADAS ---------- */
/* Scroll general */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #161b22;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #3d3d3d;
  border-radius: 10px;
  border: 2px solid #161b22;
}

::-webkit-scrollbar-thumb:hover {
  background: #58a6ff;
}

/* Para Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #3d3d3d #161b22;
}

/* Scroll en modales y áreas con scroll interno */
.modal-content {
  scrollbar-width: thin;
  scrollbar-color: #3d3d3d #0d1117;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: #0d1117;
}

.modal-content::-webkit-scrollbar-thumb {
  background: #3d3d3d;
  border-radius: 8px;
}

/* Scroll en resultados de consulta */
.resultado-scroll {
  scrollbar-width: thin;
  scrollbar-color: #58a6ff #1e1e1e;
}

.resultado-scroll::-webkit-scrollbar {
  width: 6px;
}

.resultado-scroll::-webkit-scrollbar-track {
  background: #1e1e1e;
  border-radius: 6px;
}

.resultado-scroll::-webkit-scrollbar-thumb {
  background: #58a6ff;
  border-radius: 6px;
}

/* ---------- MEDIA QUERIES ---------- */
@media (max-width: 900px) {
  .modal-box {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .resumen {
    order: -1;
  }
  .rifa_container img {
    width: 100%;
  }
  .container {
    width: 94%;
  }
}

@media (max-width: 680px) {
  .header_icons img {
    max-height: 40px;
  }
  .miguel img {
    max-height: 60px;
  }
  .rifa_container {
    width: 100%;
  }
  .cards {
    gap: 16px;
  }
  .progress-bar {
    font-size: 11px;
    padding-right: 6px;
  }
  .whatsapp_float {
    width: 56px;
    height: 56px;
    bottom: 18px;
    right: 18px;
  }
}

@media (max-width: 600px) {
  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .tabs {
    flex-direction: column;
  }
  .tab {
    width: 100%;
    font-size: 14px;
  }
  .btn {
    width: 100%;
    margin-right: 0;
    text-align: center;
  }
  .card-body p {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .header_icons img:nth-child(n+3) {
    display: none;
  }
  .botones-rapidos button {
    flex-basis: calc(50% - 8px);
  }
}
