/* ==========================================================================
   SISTEMA DE DISEÑO - CONTROL DE RIFAS EN LA NUBE (RifaFácil Web)
   Estética moderna, hiper-legible, 100% responsiva para Celular y PC
   ========================================================================== */

:root {
  /* Paleta Principal */
  --primary: #4338ca;
  --primary-hover: #3730a3;
  --primary-light: #e0e7ff;
  --primary-glow: rgba(67, 56, 202, 0.2);

  /* Estados de Boletas */
  --status-free-bg: #ecfdf5;
  --status-free-border: #10b981;
  --status-free-text: #065f46;
  --status-free-badge: #059669;

  --status-reserved-bg: #fffbeb;
  --status-reserved-border: #f59e0b;
  --status-reserved-text: #92400e;
  --status-reserved-badge: #d97706;

  --status-paid-bg: #fef2f2;
  --status-paid-border: #ef4444;
  --status-paid-text: #991b1b;
  --status-paid-badge: #dc2626;

  /* Colores Neutros y Superficies */
  --bg-app: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;

  /* Sombras y Elevación */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

  /* Bordes Redondeados */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Tipografía */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset básico y accesibilidad */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.4;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   HEADER / BARRA SUPERIOR
   ========================================================================== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1rem;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 1.8rem;
  background: var(--primary-light);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px rgba(67, 56, 202, 0.15);
  flex-shrink: 0;
}

.app-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.app-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.storage-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  color: #166534;
  user-select: none;
  transition: all 0.2s ease;
}

.storage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
  display: inline-block;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.storage-badge.offline {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.storage-badge.offline .storage-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  animation: none;
}

/* ==========================================================================
   BOTONES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  min-height: 44px;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  user-select: none;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(67, 56, 202, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(67, 56, 202, 0.35);
}

.btn-share {
  background: #0284c7;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.btn-share:hover {
  background: #0369a1;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
  background: var(--surface-subtle);
  color: var(--text-main);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-medium);
}

.btn-outline:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

.btn-whatsapp {
  background: #25d366;
  color: #ffffff;
  font-weight: 700;
}

.btn-whatsapp:hover {
  background: #1eb857;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.btn-status-wpp {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(16, 185, 129, 0.3);
}

.btn-status-wpp:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-lg {
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  min-height: 48px;
}

.btn-danger-soft {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-danger-soft:hover {
  background: #fca5a5;
  color: #7f1d1d;
}

.btn-file-label {
  cursor: pointer;
  margin: 0;
}

/* Modal y Vista Previa de Estado de WhatsApp (9:16) */
.modal-card-status {
  max-width: 540px;
}

.modal-body-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.status-preview-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  background: #0f172a;
  padding: 0.75rem;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.status-canvas-preview {
  max-height: 52vh;
  width: auto;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: block;
}

.status-actions-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.status-tip-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--surface-subtle);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  border-left: 3px solid #10b981;
  line-height: 1.35;
}

.status-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

@media (max-width: 640px) {
  .status-action-buttons {
    grid-template-columns: 1fr;
  }

  .status-canvas-preview {
    max-height: 44vh;
  }
}

.hidden-file-input {
  display: none;
}

/* ==========================================================================
   CONTENEDOR PRINCIPAL
   ========================================================================== */
.main-container {
  max-width: 1200px;
  margin: 1.25rem auto;
  padding: 0 1rem 3rem 1rem;
}

/* ==========================================================================
   HERO / TARJETA DE LA RIFA ACTUAL
   ========================================================================== */
.raffle-hero {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.raffle-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, #4f46e5, #06b6d4, #10b981);
}

.raffle-hero-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.raffle-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.raffle-name {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.raffle-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.raffle-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.meta-separator {
  color: var(--border-medium);
}

/* Estadísticas */
.raffle-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.2rem 0 1rem 0;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid;
  transition: transform 0.2s ease;
  min-width: 0;
}

.stat-icon {
  font-size: 1.6rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.stat-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-sub {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Variantes de stats */
.stat-paid {
  background: var(--status-paid-bg);
  border-color: #fca5a5;
  color: var(--status-paid-text);
}

.stat-reserved {
  background: var(--status-reserved-bg);
  border-color: #fde68a;
  color: var(--status-reserved-text);
}

.stat-free {
  background: var(--status-free-bg);
  border-color: #a7f3d0;
  color: var(--status-free-text);
}

/* Barra de progreso */
.progress-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-light);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}

.progress-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.progress-bar-fill.paid {
  background: #ef4444;
}

.progress-bar-fill.reserved {
  background: #f59e0b;
}

/* ==========================================================================
   CONTROLES, BÚSQUEDA Y FILTROS
   ========================================================================== */
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.85rem;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 1.1rem;
  color: var(--text-light);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 2.6rem 0.75rem 2.6rem;
  font-size: 16px;
  font-family: var(--font-body);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  color: var(--text-main);
  outline: none;
  min-height: 44px;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-clear {
  position: absolute;
  right: 0.75rem;
  background: #cbd5e1;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  color: #334155;
  cursor: pointer;
}

/* Filter chips */
.filter-chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.chip {
  padding: 0.5rem 0.85rem;
  min-height: 38px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-medium);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.chip:hover {
  background: var(--surface-subtle);
  color: var(--text-main);
}

.chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(67, 56, 202, 0.25);
}

.chip-free.active {
  background: #059669;
  border-color: #059669;
}

.chip-reserved.active {
  background: #d97706;
  border-color: #d97706;
}

.chip-paid.active {
  background: #dc2626;
  border-color: #dc2626;
}

/* Leyenda */
.legend-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.6rem 0.85rem;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-free { background: var(--status-free-border); }
.dot-reserved { background: var(--status-reserved-border); }
.dot-paid { background: var(--status-paid-border); }

/* ==========================================================================
   TABLERO / CUADRÍCULA DE NÚMEROS (10x10 en PC, fluido en móvil)
   ========================================================================== */
.board-section {
  position: relative;
  min-height: 260px;
  width: 100%;
}

.numbers-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.65rem;
  width: 100%;
}

/* Tarjeta individual de boleta */
.ticket-card {
  position: relative;
  background: var(--surface);
  border: 2px solid;
  border-radius: var(--radius-md);
  padding: 0.55rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 82px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
  touch-action: manipulation;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.ticket-card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-md);
  z-index: 5;
}

.ticket-num {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.ticket-name {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.2rem;
  width: 100%;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  box-sizing: border-box;
  padding: 0 2px;
}

.ticket-status-tag {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-full);
  margin-top: 0.2rem;
  white-space: nowrap;
  max-width: 95%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
}

/* Estados de la tarjeta */
.ticket-card.status-free {
  background: var(--status-free-bg);
  border-color: #a7f3d0;
  color: var(--status-free-text);
}

.ticket-card.status-free:hover {
  border-color: var(--status-free-border);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.ticket-card.status-free .ticket-status-tag {
  background: #d1fae5;
  color: #065f46;
}

.ticket-card.status-reserved {
  background: var(--status-reserved-bg);
  border-color: #fde68a;
  color: var(--status-reserved-text);
}

.ticket-card.status-reserved:hover {
  border-color: var(--status-reserved-border);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.2);
}

.ticket-card.status-reserved .ticket-status-tag {
  background: #fef3c7;
  color: #92400e;
}

.ticket-card.status-paid {
  background: var(--status-paid-bg);
  border-color: #fca5a5;
  color: var(--status-paid-text);
}

.ticket-card.status-paid:hover {
  border-color: var(--status-paid-border);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.ticket-card.status-paid .ticket-status-tag {
  background: #fee2e2;
  color: #991b1b;
}

/* Sin resultados */
.no-results {
  text-align: center;
  padding: 3rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-medium);
}

.no-results-icon {
  font-size: 2.5rem;
  margin-bottom: 0.4rem;
}

.no-results h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.no-results p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.1rem;
}

/* ==========================================================================
   MODALES Y FORMULARIOS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  overflow-y: auto;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  box-sizing: border-box;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card-wide {
  max-width: 650px;
}

@keyframes slideUp {
  from { transform: translateY(15px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
  flex-shrink: 0;
}

.ticket-badge-large {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  background: var(--primary-light);
  color: var(--primary);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.modal-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  background: var(--surface-subtle);
  border: none;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.18s ease;
}

.modal-close:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.form-row .col {
  flex: 1;
  min-width: 140px;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-group .required {
  color: #dc2626;
}

.form-control {
  width: 100%;
  padding: 0.75rem 0.85rem;
  font-size: 16px;
  font-family: var(--font-body);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  min-height: 44px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Selector visual de estado */
.status-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.status-option {
  cursor: pointer;
  position: relative;
}

.status-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.status-card {
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  background: #ffffff;
  transition: all 0.18s ease;
}

.status-card .status-icon {
  font-size: 1.3rem;
}

.status-card strong {
  display: block;
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.15;
}

.status-card p {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Estado activo en radio */
.status-option input:checked + .status-card {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.option-paid input:checked + .status-card {
  border-color: #ef4444;
  background: #fef2f2;
}

.option-reserved input:checked + .status-card {
  border-color: #f59e0b;
  background: #fffbeb;
}

.option-free input:checked + .status-card {
  border-color: #10b981;
  background: #ecfdf5;
}

/* Radio cards simples */
.radio-cards-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-card-simple {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.18s ease;
}

.radio-card-simple:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.radio-card-body strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-main);
}

.radio-card-body p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Modal Compartir Web */
.share-url-box {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.share-url-box input {
  font-size: 0.9rem;
  background: var(--surface-subtle);
  font-family: monospace;
}

.share-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.cloud-info-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.cloud-info-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.cloud-info-box strong {
  display: block;
  font-size: 0.88rem;
  color: #0369a1;
  line-height: 1.2;
}

.cloud-info-box p {
  font-size: 0.78rem;
  color: #0284c7;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.modal-footer-left, .modal-footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Lista de Rifas Guardadas */
.raffles-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 1.25rem;
}

.raffle-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--surface-subtle);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  gap: 0.75rem;
  transition: all 0.18s ease;
}

.raffle-item-card.active-item {
  border-color: var(--primary);
  background: #f5f3ff;
}

.raffle-item-info h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
}

.raffle-item-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.raffle-item-actions {
  display: flex;
  gap: 0.4rem;
}

/* Sección de Backup */
.backup-tools-section {
  padding-top: 1rem;
  border-top: 1px dashed var(--border-medium);
}

.backup-tools-section h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.backup-tools-section p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.backup-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   TOAST / NOTIFICACIONES FLOTANTES
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  animation: slideInToast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Utilidades */
.hidden {
  display: none !important;
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN (Para sacar planilla en hoja o PDF)
   ========================================================================== */
.print-only {
  display: none;
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  .app-header,
  .raffle-hero,
  .controls-panel,
  .legend-bar,
  .board-section,
  .modal-overlay,
  .toast {
    display: none !important;
  }

  .print-only {
    display: block !important;
    padding: 20px;
  }

  .print-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
  }

  .print-header h1 {
    font-size: 20pt;
    margin-bottom: 5px;
  }

  .print-stats {
    display: flex;
    justify-content: space-around;
    font-weight: bold;
    margin-top: 10px;
    font-size: 10pt;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
  }

  .print-table th, 
  .print-table td {
    border: 1px solid #333;
    padding: 6px 8px;
    text-align: left;
    font-size: 9pt;
  }

  .print-table th {
    background-color: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ==========================================================================
   RESPONSIVIDAD MÓVIL Y TABLET (ADAPTACIÓN COMPLETA)
   ========================================================================== */

/* Tablets y pantallas medianas (<= 992px) */
@media (max-width: 992px) {
  .numbers-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
  }
}

/* Celulares (<= 640px) */
@media (max-width: 640px) {
  .app-header {
    padding: 0.6rem 0.75rem;
  }

  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .brand {
    justify-content: center;
    text-align: center;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
  }

  .storage-badge {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .header-actions .btn {
    padding: 0.5rem 0.2rem;
    font-size: 0.78rem;
    min-height: 42px;
    white-space: nowrap;
  }

  .header-actions .btn-icon {
    font-size: 0.95rem;
  }

  .main-container {
    padding: 0 0.5rem 3rem 0.5rem;
    margin-top: 0.6rem;
  }

  .raffle-hero {
    padding: 0.85rem;
    border-radius: var(--radius-lg);
  }

  .raffle-name {
    font-size: 1.25rem;
  }

  .raffle-desc {
    font-size: 0.82rem;
  }

  .raffle-meta {
    font-size: 0.78rem;
  }

  /* Estadísticas en móvil */
  .raffle-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }

  .stat-card {
    padding: 0.45rem 0.25rem;
    flex-direction: column;
    text-align: center;
    gap: 0.2rem;
  }

  .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
  }

  .stat-label {
    font-size: 0.62rem;
  }

  .stat-value {
    font-size: 1.15rem;
  }

  .stat-sub {
    font-size: 0.65rem;
  }

  /* Cuadrícula de números en celular: 5 columnas exactas */
  .numbers-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
  }

  .ticket-card {
    min-height: 68px;
    padding: 0.35rem 0.1rem;
    border-radius: var(--radius-sm);
  }

  .ticket-num {
    font-size: 1.15rem;
  }

  .ticket-name {
    font-size: 0.62rem;
    margin-top: 0.1rem;
  }

  .ticket-status-tag {
    font-size: 0.55rem;
    padding: 0.05rem 0.2rem;
  }

  /* Modales en móvil */
  .modal-overlay {
    padding: 0.4rem;
    align-items: flex-end;
  }

  .modal-card {
    max-height: 92vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .modal-header {
    padding: 0.75rem 0.85rem;
  }

  .modal-body {
    padding: 0.85rem;
    gap: 0.75rem;
  }

  .status-selector {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
  }

  .status-card {
    padding: 0.45rem 0.15rem;
  }

  .status-card strong {
    font-size: 0.72rem;
  }

  .status-card p {
    display: none;
  }

  .modal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .modal-footer-left, .modal-footer-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .modal-footer .btn {
    width: 100%;
    min-height: 44px;
  }

  .toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    justify-content: center;
    text-align: center;
  }
}

/* Celulares muy pequeños (<= 360px) */
@media (max-width: 360px) {
  .numbers-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
  }

  .ticket-num {
    font-size: 1.05rem;
  }
}
