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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f4f6f9;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ── Utilidades ──────────────────────────────────────── */
.hidden { display: none !important; }
.error  { color: #c0392b; font-size: 0.9rem; margin-top: 0.5rem; }

/* ── Login ───────────────────────────────────────────── */
#screen-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.logo-container {
  margin-bottom: 1rem;
}

.logo-container img {
  width: 100%;
  max-width: 120px;
}

.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 2.5rem 3rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-box h1 { font-size: 1.4rem; margin-bottom: 0.4rem; }
.subtitle { color: #666; font-size: 0.9rem; margin-bottom: 1.5rem; }

#form-login { display: flex; flex-direction: column; gap: 0.75rem; }

#form-login input {
  padding: 0.65rem 1rem;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
#form-login input:focus { border-color: #3498db; }

/* ── Header ──────────────────────────────────────────── */
header {
  background: #1a1a2e;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 { font-size: 1.2rem; }

header img {
  width: 100%;
  max-width: 80px;
  margin-right: 1rem;
}

header button {
  margin-left: 1rem;
}

/* ── Main ────────────────────────────────────────────── */
main {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.card label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

select {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  outline: none;
}

/* ── Tabs ────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.5rem;
}

.tab {
  padding: 0.55rem 1.5rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: #888;
  transition: all 0.15s;
  letter-spacing: 0.05em;
}
.tab:active { transform: scale(0.97); }
.tab.active[data-chain="ara"] {
  background: #FFBC00;
  border-color: #FA8C0D;
  color: #ffffff;
}
.tab.active[data-chain="bdc"] {
  background: #E30D12;
  border-color: #e30d1197;
  color: #ffffff;
}

/* ── Sorteo header ───────────────────────────────────── */
.sorteo-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.sorteo-header h2 { font-size: 1.2rem; }

.badge {
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge.ara { background: #e8f5e9; color: #2e7d32; }
.badge.bdc { background: #e3f2fd; color: #1565c0; }

/* ── Progreso ────────────────────────────────────────── */
.progress-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.progress-block { flex: 1; }
.progress-label {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.progress-count {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0.2rem 0 0.4rem;
}
.progress-bar {
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar div {
  height: 100%;
  background: #2ecc71;
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ── Botones ─────────────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

button {
  padding: 0.65rem 1.4rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary   { background: #2ecc71; color: #fff; }
.btn-primary:hover:not(:disabled)   { background: #27ae60; }
.btn-secondary { background: #ecf0f1; color: #333; }
.btn-secondary:hover:not(:disabled) { background: #dfe6e9; }
.btn-danger    { background: #e74c3c; color: #fff; }
.btn-danger:hover:not(:disabled)    { background: #c0392b; }

/* ── Botón Reset (solo dev) ──────────────────────────── */
.btn-reset {
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  background: transparent;
  color: #aaa;
  border: 1.5px dashed #ccc;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-left: auto;   /* empuja el botón a la derecha */
}
.btn-reset:hover { color: #e74c3c; border-color: #e74c3c; }
.btn-reset:active { transform: scale(0.97); }

/* ── Botón Notificar MC (3 estados) ─────────────────── */
.btn-notify {
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s, background 0.2s;
}
.btn-notify:active  { transform: scale(0.98); }
.btn-notify:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-notify--pending {
  background: #fff3cd;
  color: #856404;
  border: 1.5px solid #ffc107;
}
.btn-notify--pending:hover:not(:disabled) {
  background: #ffe699;
}

.btn-notify--sent {
  background: #d4edda;
  color: #155724;
  border: 1.5px solid #28a745;
  cursor: default;
}

/* ── Mensajes de acción ──────────────────────────────── */
.action-msg {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  background: #eafaf1;
  color: #1e8449;
  border-left: 4px solid #2ecc71;
}
.action-msg.error-msg {
  background: #fdedec;
  color: #c0392b;
  border-left-color: #e74c3c;
}

/* ── Tabla resultados ────────────────────────────────── */
#results-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: #f8f9fa;
  color: #888;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #eee;
}
td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
}
tr:last-child td { border-bottom: none; }
tr.winner    td { background: #f0fff4; }
tr.suplente-a td { background: #fafafa; }
tr.suplente-b td { background: #fafafa; color: #888; }

.rol-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}
.rol-winner { background: #2ecc71; color: #fff; }
.rol-a      { background: #3498db; color: #fff; }
.rol-b      { background: #95a5a6; color: #fff; }

/* ── Historial accordion ─────────────────────────────── */
#section-history { padding: 0; overflow: hidden; }

.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.15s;
}
.accordion-toggle:hover { background: #f8f9fa; }
.accordion-toggle:active { transform: none; }

.accordion-arrow {
  font-size: 0.85rem;
  color: #888;
  transition: transform 0.2s;
}
.accordion-arrow.open { transform: rotate(90deg); }

.accordion-content {
  padding: 0 1.5rem 1.25rem;
}

.history-empty {
  color: #888;
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

#history-table td { vertical-align: middle; }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.3rem;
}
.dot-ok     { background: #2ecc71; }
.dot-pending { background: #f39c12; }
.dot-none   { background: #ddd; }

/* ── Overlay animación de sorteo ─────────────────────── */
.draw-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.draw-box {
  text-align: center;
  padding: 3rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.draw-box-label {
  font-size: 1rem;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.draw-box-slot {
  font-size: 3.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #f0f0f0;
  letter-spacing: 0.1em;
  min-width: 480px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s;
}

.draw-box-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.draw-winner-tag {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #2ecc71;
  text-transform: uppercase;
}

.draw-winner-name {
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.draw-winner-meta {
  font-size: 1rem;
  color: #aaa;
  margin-top: 0.25rem;
}

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #fff;
  border-radius: 14px;
  padding: 2rem 2.5rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

.modal-title {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.modal-body {
  font-size: 0.95rem;
  color: #444;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
