/*
 * Panel oscuro autocontenido para la sala de sorteo, el modal "Mis boletos"
 * y el video del sorteo (tombola). El resto del sitio sigue en tema claro;
 * estas reglas viven detras de la clase .sala-panel para no filtrarse.
 */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

.sala-panel {
  --sp-bg: #0B0F14;
  --sp-surface: #131922;
  --sp-border: #1C2430;
  --sp-text: #F5F7FA;
  --sp-muted: #8B95A1;
  --sp-accent: #E8B84B;
  --sp-accent-dim: rgba(232, 184, 75, 0.25);

  background: var(--sp-bg);
  color: var(--sp-text);
  border-radius: 18px;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
}

.sala-panel * { box-sizing: border-box; }
.sala-panel .sp-btn { border: none; cursor: pointer; font-family: inherit; }
.sala-panel .sp-btn:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }

/* Hero de premio */
.sp-hero {
  position: relative;
  width: 100%;
  min-height: 150px;
  background: linear-gradient(135deg, #1C2430, #0F141B);
  display: flex;
  align-items: flex-end;
}
.sp-hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.sp-hero-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,15,20,0) 35%, rgba(11,15,20,0.95) 100%);
}
.sp-hero-body {
  position: relative;
  padding: 14px 18px;
  width: 100%;
}
.sp-hero-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--sp-accent); margin-bottom: 4px;
}
.sp-hero-nombre {
  font-family: 'Sora', sans-serif;
  font-size: 20px; font-weight: 800; line-height: 1.15; color: #fff;
  margin: 0;
}
.sp-hero-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #3A4552;
}

/* Franja de apuesta / cierre / progreso */
.sp-topbar {
  padding: 14px 18px 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.sp-monto { font-size: 19px; font-weight: 700; font-family: 'Sora', sans-serif; }
.sp-monto-label { font-size: 12px; color: var(--sp-muted); font-weight: 600; margin-left: 6px; }
.sp-badges { margin-top: 4px; }
.sp-badges .badge { font-size: 9px; padding: 2px 6px; }

.sp-progreso-wrap { padding: 6px 18px 14px; display: flex; align-items: center; gap: 10px; }
.sp-progreso-track { flex-grow: 1; height: 6px; border-radius: 99px; background: var(--sp-border); overflow: hidden; }
.sp-progreso-fill { height: 100%; border-radius: 99px; background: var(--sp-accent); transition: width .4s ease; }
.sp-progreso-texto { font-size: 12px; font-weight: 700; color: var(--sp-accent); min-width: 34px; text-align: right; }

/* Grid de numeros minimalista */
.sp-grid-wrap { padding: 6px 16px 4px; max-height: 260px; overflow-y: auto; }
.sp-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.sp-num {
  aspect-ratio: 1; border-radius: 10px; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; background: transparent; color: var(--sp-text);
  border: 1.5px solid #2A323D; transition: transform .15s ease, background-color .15s ease;
}
.sp-num.disponible:hover { border-color: var(--sp-accent); }
.sp-num.agotado { background: var(--sp-border); color: #3A4552; border-color: var(--sp-border); text-decoration: line-through; cursor: not-allowed; }
.sp-num.mio { background: var(--sp-accent); color: #0B0F14; border-color: var(--sp-accent); box-shadow: 0 0 0 3px var(--sp-accent-dim); }

/* Leyenda + acciones */
.sp-legend { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 16px 4px; }
.sp-legend-item { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--sp-muted); }
.sp-legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.sp-footer { padding: 10px 18px 18px; }
.sp-btn-outline {
  width: 100%; padding: 12px; border-radius: 12px; background: transparent;
  border: 1px solid #2A323D; color: var(--sp-text); font-size: 13.5px; font-weight: 600;
}
.sp-btn-solid {
  width: 100%; padding: 12px; border-radius: 12px; background: var(--sp-accent);
  color: #0B0F14; font-size: 13.5px; font-weight: 700;
}
.sp-activo-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px;
  background: rgba(110, 231, 216, 0.12); color: #6EE7D8; font-size: 12px; font-weight: 700; margin: 0 16px 8px;
}

/* ============ Modal "Mis boletos" / "Adquirir boleta" ============ */
.mb-overlay {
  position: fixed; inset: 0; z-index: 1090; display: none;
  background: rgba(5, 7, 10, 0.6);
}
.mb-overlay.abierto { display: flex; align-items: flex-end; justify-content: center; }

/* Movil: hoja que sube desde abajo (bottom sheet). */
.mb-hoja {
  width: min(94vw, 420px); max-height: 82vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; border: 1px solid var(--sp-border); border-bottom: none;
  margin: 0;
}

/* Escritorio: dialogo centrado como un modal de verdad, no una hoja pegada
   abajo de una pantalla enorme. */
@media (min-width: 768px) {
  .mb-overlay.abierto { align-items: center; padding: 24px; }
  .mb-hoja {
    width: min(90vw, 460px); max-height: 88vh;
    border-radius: 20px; border-bottom: 1px solid var(--sp-border);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  }
}

/* SweetAlert2 debe quedar SIEMPRE por encima de nuestros modales (su
   z-index por defecto, ~1060, es menor que el de .mb-overlay). */
.swal2-container { z-index: 2000 !important; }
.mb-header { padding: 10px 20px 14px; border-bottom: 1px solid var(--sp-border); }
.mb-handle { width: 36px; height: 4px; border-radius: 99px; background: #2A323D; margin: 0 auto 14px; }
.mb-titulo { font-family: 'Sora', sans-serif; font-size: 18px; font-weight: 800; }
.mb-subtitulo { font-size: 12px; color: var(--sp-muted); margin-top: 2px; }
.mb-cerrar {
  width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center; color: var(--sp-text); border: none; cursor: pointer;
}

.mb-resumen { display: flex; padding: 16px 20px; gap: 12px; }
.mb-stat { flex: 1; background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 14px; padding: 14px 16px; }
.mb-stat.acento { border-color: #3A2F14; }
.mb-stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--sp-muted); }
.mb-stat.acento .mb-stat-label { color: var(--sp-accent); }
.mb-stat-valor { font-family: 'Sora', sans-serif; font-size: 21px; font-weight: 800; margin-top: 4px; }
.mb-stat.acento .mb-stat-valor { color: var(--sp-accent); }
.mb-stat-nota { font-size: 11px; color: var(--sp-muted); margin-top: 2px; }

.mb-lista { padding: 2px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.mb-vacio { padding: 30px 20px; text-align: center; color: var(--sp-muted); font-size: 13px; }

.mb-ticket { position: relative; display: flex; background: var(--sp-surface); border-radius: 14px; border: 1px solid var(--sp-border); }
.mb-ticket-stub {
  width: 70px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 6px; border-right: 1.5px dashed #2A323D; position: relative; overflow: visible;
}
.mb-ticket-stub::before, .mb-ticket-stub::after {
  content: ""; position: absolute; right: -8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--sp-bg); border: 1px solid var(--sp-border);
}
.mb-ticket-stub::before { top: -8px; }
.mb-ticket-stub::after { bottom: -8px; }
.mb-ticket-thumb {
  width: 36px; height: 36px; border-radius: 9px; background: var(--sp-border);
  display: flex; align-items: center; justify-content: center; color: #3A4552; overflow: hidden;
}
.mb-ticket-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mb-ticket-body { flex-grow: 1; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.mb-ticket-numero { font-family: 'Sora', sans-serif; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mb-ticket-codigo { font-size: 10px; color: #3A4552; margin-top: 2px; }
.mb-ticket-pill { display: inline-block; font-size: 10px; font-weight: 700; color: #6EE7D8; background: rgba(110,231,216,0.1); padding: 4px 8px; border-radius: 99px; }

/* ============ Sorteos ejecutados: lista con acordeón ============ */
.se-fila { background: var(--sp-surface, #131922); border: 1px solid var(--sp-border, #1C2430); border-radius: 14px; overflow: hidden; margin-bottom: 10px; }
.se-cabeza { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; border: none; background: none; cursor: pointer; font-family: inherit; }
.se-thumb { width: 36px; height: 36px; border-radius: 9px; background: var(--sp-border, #1C2430); display: flex; align-items: center; justify-content: center; color: #3A4552; flex-shrink: 0; overflow: hidden; }
.se-thumb img { width: 100%; height: 100%; object-fit: cover; }
.se-info { flex-grow: 1; min-width: 0; }
.se-premio { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.se-meta { font-size: 11px; color: var(--sp-muted, #8B95A1); }
.se-ganador { text-align: right; flex-shrink: 0; }
.se-ganador-label { font-size: 10px; color: var(--sp-muted, #8B95A1); text-transform: uppercase; letter-spacing: .04em; }
.se-ganador-num { font-family: 'Sora', sans-serif; font-size: 15px; font-weight: 800; color: var(--sp-accent, #E8B84B); }
.se-chevron { transition: transform .2s ease; flex-shrink: 0; color: var(--sp-muted, #8B95A1); }
.se-chevron.se-abierto { transform: rotate(180deg); }
.se-cuerpo { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.se-cuerpo.se-abierta { max-height: 200px; }
.se-cuerpo-int { padding: 0 14px 14px; border-top: 1px solid var(--sp-border, #1C2430); margin-top: 2px; padding-top: 12px; }

/* ============ Landing publica (Fase 3) ============ */
.ld-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: rgba(11,15,20,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--sp-border);
}
.ld-brand { font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 800; letter-spacing: .01em; }
.ld-header-right { display: flex; align-items: center; gap: 16px; }
.ld-clock { font-size: 12px; font-weight: 700; color: var(--sp-muted); font-variant-numeric: tabular-nums; }
.ld-header-user { display: flex; align-items: center; gap: 14px; }
.ld-avatar {
  width: 30px; height: 30px; border-radius: 99px; background: var(--sp-border);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: var(--sp-accent);
}
.ld-header-link { background: none; color: var(--sp-text); font-size: 12.5px; font-weight: 600; text-decoration: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }
.ld-btn-login { background: var(--sp-accent); color: #0B0F14; font-size: 12.5px; font-weight: 800; padding: 9px 16px; border-radius: 10px; }

.ld-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sp-muted); margin-bottom: 12px; }
.ld-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
@media (min-width: 640px) { .ld-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 960px) { .ld-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }

.ld-card { background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 14px; overflow: hidden; transition: border-color .15s; }
.ld-card:hover { border-color: #3A4552; }
.ld-card-hero { position: relative; height: 84px; background: linear-gradient(135deg, var(--sp-border), #0F141B); display: flex; align-items: center; justify-content: center; color: #3A4552; overflow: hidden; }
.ld-card-hero img { width: 100%; height: 100%; object-fit: cover; }
.ld-card-body { padding: 10px 12px 12px; }
.ld-card-premio { font-size: 12.5px; font-weight: 700; line-height: 1.25; margin-bottom: 6px; min-height: 32px; }
.ld-card-precio { font-family: 'Sora', sans-serif; font-size: 14px; font-weight: 800; margin-bottom: 8px; }
.ld-card-precio span { font-size: 9.5px; color: var(--sp-muted); font-weight: 600; }
.ld-card-progreso { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.ld-card-progreso-track { flex-grow: 1; height: 5px; border-radius: 99px; background: var(--sp-border); overflow: hidden; }
.ld-card-progreso-fill { height: 100%; border-radius: 99px; background: var(--sp-accent); }
.ld-card-progreso-texto { font-size: 10px; font-weight: 700; color: var(--sp-accent); }
.ld-card-acciones { display: flex; flex-wrap: wrap; gap: 6px; }
.ld-card-extras { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ld-card-btn { flex: 1; min-width: 70px; padding: 9px; border-radius: 9px; font-size: 11.5px; font-weight: 700; background: var(--sp-border); color: var(--sp-text); border: none; cursor: pointer; font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 5px; }
.ld-card-btn-primary { background: var(--sp-accent); color: #0B0F14; }
.ld-card-extras .ld-card-btn { background: transparent; border: 1px solid var(--sp-border); color: var(--sp-muted); font-size: 10.5px; font-weight: 600; padding: 7px 6px; }
.ld-card-extras .ld-card-btn:hover { border-color: var(--sp-accent); color: var(--sp-text); }
.ld-vacio { padding: 40px 20px; text-align: center; color: var(--sp-muted); font-size: 13px; }

.premio-tabs { display: flex; gap: 18px; margin-bottom: 14px; border-bottom: 1px solid var(--sp-border); }
.premio-tab { padding-bottom: 10px; font-size: 12.5px; font-weight: 600; color: var(--sp-muted); border: none; background: none; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.premio-tab.activa { color: var(--sp-accent); font-weight: 700; border-bottom-color: var(--sp-accent); }

/* ==================== Panel de usuario (v1.3.3): Sorteos previos / Perfil / Referidos ==================== */
.rg-layout { display: flex; align-items: flex-start; min-height: calc(100vh - 68px); }
.rg-nav { width: 220px; flex-shrink: 0; border-right: 1px solid var(--sp-border); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 68px; }
.rg-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--sp-muted); text-decoration: none; cursor: pointer; background: none; border: none; font-family: inherit; width: 100%; text-align: left; }
.rg-nav-item:hover { background: var(--sp-surface); color: var(--sp-text); }
.rg-nav-item.activo { background: var(--sp-border); color: var(--sp-accent); }
.rg-content { flex-grow: 1; min-width: 0; padding: 28px 32px 40px; max-width: 820px; }
.rg-seccion { display: none; }
.rg-seccion.activa { display: block; }
.rg-titulo { font-family: 'Sora', sans-serif; font-size: 20px; font-weight: 800; }
.rg-subtitulo { font-size: 12.5px; color: var(--sp-muted); margin-top: 4px; margin-bottom: 20px; }
.rg-card { background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 16px; padding: 20px; }
.rg-label { display: block; font-size: 11px; color: var(--sp-muted); margin-bottom: 5px; }
.rg-input { width: 100%; box-sizing: border-box; padding: 11px; border-radius: 10px; background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-text); font-size: 13px; font-family: inherit; }
.rg-stats { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.rg-stat { background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 14px; padding: 14px 16px; flex: 1; min-width: 140px; }
.rg-stat-label { font-size: 10px; color: var(--sp-muted); text-transform: uppercase; letter-spacing: .04em; }
.rg-stat-valor { font-family: 'Sora', sans-serif; font-size: 19px; font-weight: 800; margin-top: 4px; }
.rg-fila { background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.rg-fila-cabeza { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
.rg-fila-cuerpo { padding: 0 16px 18px; border-top: 1px solid var(--sp-border); margin-top: 2px; padding-top: 14px; display: none; gap: 16px; flex-wrap: wrap; }
.rg-fila-cuerpo.rg-abierta { display: flex; }
.rg-fila-thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--sp-border); flex-shrink: 0; background-size: cover; background-position: center; }
.rg-replay { width: 240px; flex-shrink: 0; aspect-ratio: 16/10; background: var(--sp-bg); border-radius: 12px; display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; border: none; }
.rg-replay-play { width: 46px; height: 46px; border-radius: 50%; background: var(--sp-accent); display: flex; align-items: center; justify-content: center; }
.rg-pill { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 10.5px; font-weight: 700; }
.rg-banner-disclaimer { background: rgba(232,184,75,.1); border: 1px dashed var(--sp-accent); border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; font-size: 11.5px; color: var(--sp-accent); }
.rg-referido-chip { display: flex; align-items: center; gap: 10px; background: var(--sp-bg); border: 1px solid var(--sp-border); border-radius: 12px; padding: 14px 16px; }
@media (max-width: 760px) {
  .rg-layout { flex-direction: column; }
  .rg-nav { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--sp-border); position: static; }
  .rg-content { padding: 20px 16px 32px; max-width: none; }
  .rg-replay { width: 100%; }
}
