/* =====================================================================
   TAPADITA PRO - DESIGN SYSTEM CORPORATIVO Y PROFESIONAL
   Paleta: Azul Marino, Gris Pizarra, Blanco Puro y Verde Esmeralda
   ===================================================================== */
:root {
  --primary: #1e3a8a;          /* Azul corporativo oscuro */
  --primary-hover: #1d4ed8;    /* Azul brillante */
  --primary-light: #eff6ff;    /* Azul suave para fondos */
  --secondary: #334155;        /* Gris pizarra oscuro */
  --secondary-light: #64748b;  /* Gris medio */
  
  --success: #059669;          /* Verde esmeralda (disponible / vendido ok) */
  --success-bg: #ecfdf5;
  --warning: #d97706;          /* Ámbar corporativo (reservado) */
  --warning-bg: #fffbeb;
  --danger: #dc2626;           /* Rojo carmesí (vendido / error) */
  --danger-bg: #fef2f2;
  
  --bg-main: #f8fafc;          /* Fondo suave de aplicación */
  --bg-card: #ffffff;          /* Blanco tarjetas */
  --border-color: #e2e8f0;     /* Bordes sutiles */
  
  --text-main: #0f172a;        /* Texto principal casi negro */
  --text-muted: #64748b;       /* Texto secundario */
  --text-inverse: #ffffff;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* NAVBAR */
.navbar {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(30, 58, 138, 0.15);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.6rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #fff;
  border-color: var(--border-color);
  color: var(--secondary);
}
.btn-secondary:hover {
  background-color: #f1f5f9;
}

.btn-success {
  background-color: var(--success);
  color: var(--text-inverse);
}
.btn-success:hover {
  background-color: #047857;
}

.btn-warning {
  background-color: var(--warning);
  color: var(--text-inverse);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-inverse);
}

.btn-whatsapp {
  background-color: #25D366;
  color: #fff;
  font-size: 1.05rem;
  padding: 0.85rem 1.6rem;
  border-radius: 50px;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
}
.btn-whatsapp:hover {
  background-color: #1ebd5a;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

/* CONTENEDOR PRINCIPAL */
.container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  width: 100%;
  flex: 1;
}

/* CARDS & PANELES */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

/* GRID STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: 0.25rem;
}

/* TABLAS */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.table th {
  background-color: #f8fafc;
  color: var(--secondary-light);
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.table tr:hover {
  background-color: #f8fafc;
}

/* BADGES DE ESTADO */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-activo { background: #dbeafe; color: #1e40af; }
.badge-listo { background: #dcfce7; color: #15803d; }
.badge-finalizado { background: #e2e8f0; color: #475569; }
.badge-pospuesto { background: #fee2e2; color: #b91c1c; }

.badge-disponible { background: var(--success-bg); color: var(--success); }
.badge-reservado { background: var(--warning-bg); color: var(--warning); }
.badge-vendido { background: var(--danger-bg); color: var(--danger); }

/* TABLERO DE TAPADITA (GRILLA DE NÚMEROS) */
.tapadita-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 10px;
  margin: 1.5rem 0;
}

.tapadita-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  user-select: none;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.tapadita-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cell-num {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.cell-tag {
  font-size: 0.65rem;
  font-weight: 700;
  margin-top: 4px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Estados de Celda según requerimiento estricto */
/* 1. Verde = Disponible */
.tapadita-cell.disponible {
  background-color: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
}
.tapadita-cell.disponible:hover {
  background-color: #d1fae5;
  border-color: #059669;
}

/* 2. Amarillo = Reservado */
.tapadita-cell.reservado {
  background-color: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
  cursor: not-allowed;
}

/* 3. Rojo = Vendido */
.tapadita-cell.vendido {
  background-color: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
  cursor: not-allowed;
  opacity: 0.85;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* FORMULARIOS */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: #fff;
  color: var(--text-main);
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

/* ANIMACIÓN DE TÓMBOLA DIGITAL (BINGO CAGE) */
.tombola-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: var(--shadow-lg);
  margin: 1.5rem 0;
}

.tombola-cage {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 8px dashed #38bdf8;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.3), inset 0 0 20px rgba(56, 189, 248, 0.2);
  margin-bottom: 1.5rem;
}

.tombola-cage.spinning {
  animation: spinCage 0.8s linear infinite;
  border-color: #f59e0b;
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.5);
}

@keyframes spinCage {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.tombola-ball {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #cbd5e1 70%, #94a3b8 100%);
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
  transform: scale(0.9);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tombola-ball.reveal {
  transform: scale(1.3);
  background: radial-gradient(circle at 30% 30%, #fef08a 0%, #facc15 70%, #ca8a04 100%);
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.8);
}

.hidden { display: none !important; }

/* ========================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ======================================================== */
.mobile-only {
  display: none !important;
}

.desktop-only {
  display: block;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .container {
    padding: 0.75rem;
  }

  .navbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card {
    padding: 0.85rem;
  }

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

  .card {
    padding: 1rem;
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* TARJETA MÓVIL DE TAPADITAS */
.tapadita-mobile-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tapadita-mobile-card:active {
  transform: scale(0.99);
}

.tapadita-mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.tapadita-mobile-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.25;
}

.tapadita-mobile-premio {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tapadita-mobile-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tapadita-mobile-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.tapadita-mobile-actions .btn {
  flex: 1;
  text-align: center;
  justify-content: center;
  padding: 0.6rem;
  font-size: 0.88rem;
}

/* ========================================================
   ESTILOS DE IMPRESIÓN PARA EXPORTACIÓN PDF
   ======================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt;
  }

  .navbar,
  #banner-plan-info,
  #btn-open-config,
  #btn-open-crear,
  #filtro-numeros,
  .btn,
  .modal-overlay,
  #btn-logout {
    display: none !important;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .table th {
    background-color: #f1f5f9 !important;
    color: #000 !important;
    border: 1px solid #cbd5e1 !important;
  }

  .table td {
    border: 1px solid #cbd5e1 !important;
  }

  .badge {
    border: 1px solid #000 !important;
    color: #000 !important;
    background: transparent !important;
  }
}
