/* ================================================================
   FIXES CRÍTICOS - OCSEVIS
   ================================================================ */

/* 1. OCULTAR SIDEBAR ANTIGUO (fab-panel) */
.fab-panel {
  display: none !important;
}

/* 2. ESTILO CONTADORES DE ZONA */
.zone-count {
  display: inline-block;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
  line-height: 18px;
  text-align: center;
  margin-left: 6px;
}

.zone-btn:hover .zone-count {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.5);
}

/* 3. MODALES DE LISTADO (locales y competencias) RESPONSIVOS Y MODERNOS */

/* Layout general del modal de listado */
.modal-wrap-listado {
  place-items: start center;
}

.modal-wrap-listado .modal {
  margin-top: 18vh;
  width: min(980px, 96vw);
  max-height: 80vh;
}

.modal-wrap-listado .modal-body {
  padding: 14px 16px;
}

.modal-wrap-listado h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

.modal-wrap-listado .list-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.modal-wrap-listado .list-actions input[type="text"] {
  flex: 1 1 auto;
  min-width: 180px;
}

.modal-wrap-listado .table-wrap {
  max-height: 54vh;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background: #020617;
}

.modal-wrap-listado .list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #e5e7eb;
}

.modal-wrap-listado .list-table thead {
  position: sticky;
  top: 0;
  background: #020617;
  z-index: 1;
}

.modal-wrap-listado .list-table th,
.modal-wrap-listado .list-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #111827;
}

.modal-wrap-listado .list-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #9ca3af;
  cursor: pointer;
  white-space: nowrap;
}

.modal-wrap-listado .list-table th:hover {
  color: #60a5fa;
}

/* Indicadores de ordenamiento */
.modal-wrap-listado .list-table th.sorted-asc::after {
  content: ' ▲';
  color: #60a5fa;
}

.modal-wrap-listado .list-table th.sorted-desc::after {
  content: ' ▼';
  color: #60a5fa;
}

/* Botones en las celdas de acciones */
.modal-wrap-listado .list-table .actions-cell {
  white-space: nowrap;
}

.modal-wrap-listado .list-table .btn-sm {
  padding: 4px 8px !important;
  font-size: 11px !important;
  min-width: auto !important;
  margin: 2px !important;
}

.modal-wrap-listado .list-table .btn-danger {
  background: #ef4444 !important;
  color: white !important;
  border-color: #dc2626 !important;
}

.modal-wrap-listado .list-table .btn-danger:hover {
  background: #dc2626 !important;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-oc {
  background: #dbeafe;
  color: #1e40af;
}

.badge-se {
  background: #fef3c7;
  color: #92400e;
}

.modal-wrap-listado .list-table tr:nth-child(odd) {
  background: rgba(15,23,42,0.75);
}

.modal-wrap-listado .list-table tr:nth-child(even) {
  background: rgba(15,23,42,0.55);
}

.modal-wrap-listado .list-table tr:hover {
  background: rgba(59,130,246,0.1) !important;
}

/* Estados visuales de filas */
.modal-wrap-listado .list-table tr.row-descartado {
  opacity: 0.5;
}

.modal-wrap-listado .list-table tr.row-reservado {
  border-left: 3px solid #f59e0b;
}

.modal-wrap-listado .list-table tr.row-activo,
.modal-wrap-listado .list-table tr.row-disponible {
  border-left: 3px solid #10b981;
}

/* ===== RESPONSIVE: TABLETS ===== */
@media (max-width: 1024px) {
  .modal-wrap-listado .modal {
    width: 94vw;
    margin-top: 10vh;
    max-height: 85vh;
  }
  
  .modal-wrap-listado .list-table {
    font-size: 12px;
  }
  
  .modal-wrap-listado .list-table th,
  .modal-wrap-listado .list-table td {
    padding: 6px 8px;
  }
  
  .modal-wrap-listado .list-actions {
    flex-wrap: wrap;
  }
  
  .modal-wrap-listado .list-actions input[type="text"] {
    min-width: 140px;
  }
}

/* ===== RESPONSIVE: MÓVILES ===== */
@media (max-width: 768px) {
  .modal-wrap-listado .modal {
    width: 98vw;
    margin-top: 5vh;
    max-height: 90vh;
  }
  
  .modal-wrap-listado h2 {
    font-size: 16px;
  }
  
  .modal-wrap-listado .list-actions {
    flex-direction: column;
    gap: 6px;
  }
  
  .modal-wrap-listado .list-actions input[type="text"],
  .modal-wrap-listado .list-actions select {
    width: 100%;
  }
  
  .modal-wrap-listado .list-table {
    font-size: 11px;
  }
  
  .modal-wrap-listado .list-table th,
  .modal-wrap-listado .list-table td {
    padding: 4px 6px;
  }
  
  .modal-wrap-listado .list-table .btn-sm {
    padding: 3px 6px !important;
    font-size: 10px !important;
  }
  
  /* En móvil: hacer que la tabla sea scrolleable horizontal */
  .modal-wrap-listado .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Asegurar que TODOS los botones sean visibles en móvil */
  .modal-wrap-listado .list-table .actions-cell {
    min-width: 120px;
    white-space: nowrap;
  }
  
  .modal-wrap-listado .list-table th:last-child,
  .modal-wrap-listado .list-table td:last-child {
    position: sticky;
    right: 0;
    background: #020617;
    box-shadow: -2px 0 4px rgba(0,0,0,0.3);
  }
}

/* ===== AUTO-AJUSTE DE MODALES GENERALES ===== */
.modal-wrap {
  padding: 10px;
}

.modal {
  max-width: 98vw !important;
  max-height: 95vh !important;
  overflow-y: auto;
}

/* Asegurar que modal-body SIEMPRE tenga scroll si es necesario */
.modal-body {
  overflow-y: auto !important;
  overflow-x: hidden;
  max-height: calc(95vh - 120px);
  -webkit-overflow-scrolling: touch;
}

/* Formularios dentro del modal deben permitir crecer */
.modal .modal-body .form-grid,
.modal .modal-body .tab-panel {
  overflow: visible !important;
  flex-shrink: 0;
}

/* Asegurar que los formularios sean scrolleables */
.form-grid,
.tab-panel {
  overflow-y: auto;
  max-height: calc(90vh - 200px);
}

/* Botones de acción siempre visibles */
.actions-row {
  position: sticky;
  bottom: 0;
  background: inherit;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

.modal-wrap-listado .list-table tr:hover {
  background: rgba(37,99,235,0.25);
}

.modal-wrap-listado .list-table td .btn {
  font-size: 11px;
  padding: 4px 8px;
}

.modal-wrap-listado .list-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
}

.modal-wrap-listado .pager-info {
  color: #9ca3af;
}

.modal-wrap-listado .actions-row {
  margin-top: 8px;
}

@media (max-width: 1200px) {
  .modal-wrap-listado .modal {
    width: min(920px, 96vw);
    margin-top: 14vh;
  }
  .modal-wrap-listado .list-table th,
  .modal-wrap-listado .list-table td {
    padding: 6px 8px;
    font-size: 12px;
  }
}

@media (max-width: 900px) {
  .modal-wrap-listado .modal {
    width: min(820px, 98vw);
    margin-top: 10vh;
  }
  .modal-wrap-listado .modal-body {
    padding: 10px 12px;
  }
  .modal-wrap-listado .list-table th,
  .modal-wrap-listado .list-table td {
    padding: 6px;
    font-size: 11px;
  }
}

@media (max-width: 768px) {
  .modal-wrap-listado .modal {
    width: 98vw;
    margin-top: 6vh;
  }
  .modal-wrap-listado .table-wrap {
    max-height: 60vh;
  }
  .modal-wrap-listado .list-table th,
  .modal-wrap-listado .list-table td {
    padding: 5px 4px;
    font-size: 10px;
  }
  /* Ocultar columnas menos importantes en móvil (a partir de la 5ª) */
  .modal-wrap-listado .list-table th:nth-child(n+5),
  .modal-wrap-listado .list-table td:nth-child(n+5) {
    display: none;
  }
}

/* 4. MEJORAR CONTRASTE DE SCORES */
.counter-item span[style*="color:#fbbf24"] {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
