/* =========================================================
   ÁRBITROS FCA — ESTILO PROFESIONAL UNIFICADO v2.0
   Basado en el diseño de Entrenadores y Carnets
   ========================================================= */

/* ---------- Variables y tokens (unificadas con otros módulos) ---------- */
:root {
  /* Verde FCA - Paleta completa */
  --arb-green-950: #0a3d1f;
  --arb-green-900: #0f4d2a;
  --arb-green-850: #115a30;
  --arb-green-800: #14532d;
  --arb-green-700: #15803d;
  --arb-green-600: #16a34a;
  --arb-green-500: #22c55e;
  --arb-green-400: #4ade80;
  --arb-green-300: #86efac;
  --arb-green-200: #bbf7d0;
  --arb-green-100: #dcfce7;
  --arb-green-50:  #f0fdf4;

  /* Colores de estado */
  --arb-success: #28a745;
  --arb-success-dark: #218838;
  --arb-danger: #dc3545;
  --arb-danger-dark: #c82333;
  --arb-warning: #ffc107;
  --arb-info: #17a2b8;
  --arb-primary: #007bff;
  --arb-primary-dark: #0069d9;

  /* Textos */
  --arb-text-primary: #0f172a;
  --arb-text-secondary: #334155;
  --arb-text-muted: #64748b;
  --arb-text-light: #94a3b8;

  /* Bordes */
  --arb-border-dark: #0b1220;
  --arb-border: rgba(15, 23, 42, 0.12);
  --arb-border-light: rgba(255, 255, 255, 0.18);
  --arb-border-focus: rgba(34, 197, 94, 0.35);

  /* Sombras (unificadas) */
  --arb-shadow-sm: 0 4px 12px rgba(2, 6, 23, 0.06);
  --arb-shadow: 0 10px 24px rgba(2, 6, 23, 0.08);
  --arb-shadow-lg: 0 20px 40px rgba(2, 6, 23, 0.12);
  --arb-shadow-xl: 0 30px 60px rgba(2, 6, 23, 0.15);
  --arb-ring: 0 0 0 4px rgba(34, 197, 94, 0.18);
  --arb-ring-gold: 0 0 0 4px rgba(198, 164, 63, 0.18);

  /* Radios (unificados) */
  --arb-radius-sm: 8px;
  --arb-radius: 12px;
  --arb-radius-lg: 18px;
  --arb-radius-xl: 26px;
  --arb-pill: 999px;

  /* Tipografía */
  --arb-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Transiciones */
  --arb-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --arb-transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =========================================================
   CONTENEDOR PRINCIPAL (unificado con otros módulos)
   ========================================================= */
.arbitros-container {
  font-family: var(--arb-font);
  color: var(--arb-text-primary);
  border-radius: var(--arb-radius-xl);
  border: 1px solid var(--arb-border);
  box-shadow: var(--arb-shadow);
  overflow: hidden;
  background: linear-gradient(145deg, #ffffff, var(--arb-green-50));
  padding: 24px;
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
}

/* Efecto de borde superior degradado (unificado) */
.arbitros-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--arb-green-900), var(--arb-green-500), var(--arb-green-900));
  z-index: 1;
}

/* =========================================================
   FILTROS (mejorados con grid moderno)
   ========================================================= */
.filtros {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.8);
  padding: 16px;
  border-radius: var(--arb-radius-lg);
  border: 1px solid var(--arb-border);
  backdrop-filter: blur(10px);
}

@media (max-width: 992px) {
  .filtros {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Input de búsqueda (estilo unificado con entrenadores) */
.filtros input[type="text"] {
  border: 2px solid var(--arb-border-dark);
  border-radius: var(--arb-pill);
  padding: 12px 18px;
  min-height: 48px;
  font-weight: 500;
  font-size: 14px;
  width: 100%;
  transition: var(--arb-transition-bounce);
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat right 18px center;
  background-size: 18px;
}

.filtros input[type="text"]:focus {
  outline: none;
  border-color: var(--arb-green-600);
  box-shadow: var(--arb-ring);
  transform: scale(1.01);
}

/* Selects (estilo unificado) */
.filtros select {
  border: 2px solid var(--arb-border-dark);
  border-radius: var(--arb-pill);
  padding: 10px 32px 10px 16px;
  min-height: 48px;
  font-weight: 600;
  font-size: 13px;
  background: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  transition: var(--arb-transition);
  width: auto;
  min-width: 140px;
  max-width: 180px;
}

.filtros select:hover {
  border-color: var(--arb-green-600);
  background-color: var(--arb-green-50);
}

.filtros select:focus {
  outline: none;
  border-color: var(--arb-green-600);
  box-shadow: var(--arb-ring);
}

@media (max-width: 992px) {
  .filtros select {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
  }
}

/* =========================================================
   BOTÓN EXPORTAR (mejorado)
   ========================================================= */
.btn-exportar-csv {
  border-radius: var(--arb-pill);
  padding: 12px 24px;
  min-height: 48px;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(135deg, var(--arb-green-50), white);
  border: 2px solid rgba(34, 197, 94, 0.4);
  color: var(--arb-green-900);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--arb-transition-bounce);
  position: relative;
  overflow: hidden;
  box-shadow: var(--arb-shadow-sm);
}

.btn-exportar-csv::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  z-index: 0;
}

.btn-exportar-csv:hover::before {
  width: 300px;
  height: 300px;
}

.btn-exportar-csv > * {
  position: relative;
  z-index: 1;
}

.btn-exportar-csv:hover {
  background: linear-gradient(135deg, white, var(--arb-green-100));
  border-color: rgba(34, 197, 94, 0.7);
  transform: translateY(-2px);
  box-shadow: var(--arb-shadow);
}

.btn-exportar-csv i {
  font-size: 16px;
}

@media (max-width: 992px) {
  .btn-exportar-csv {
    width: 100%;
  }
}

/* =========================================================
   TABLA (unificada con entrenadores)
   ========================================================= */
.tabla-container {
  border-radius: var(--arb-radius-lg);
  overflow: hidden;
  border: 1px solid var(--arb-border);
  box-shadow: var(--arb-shadow-sm);
  margin: 20px 0;
  background: white;
}

.arbitros-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* Cabecera con gradiente (unificada) */
.arbitros-table thead th {
  background: linear-gradient(135deg, var(--arb-green-900), var(--arb-green-600));
  color: white;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 12px;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  position: sticky;
  top: 0;
  z-index: 10;
}

.arbitros-table thead th:last-child {
  border-right: none;
}

.arbitros-table thead th::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--arb-green-300), transparent);
}

/* Celdas */
.arbitros-table tbody td {
  padding: 14px 12px;
  border-top: 1px solid var(--arb-border);
  font-size: 14px;
  color: var(--arb-text-primary);
  vertical-align: middle;
  transition: var(--arb-transition);
}

.arbitros-table tbody tr {
  transition: var(--arb-transition);
}

.arbitros-table tbody tr:nth-child(even) {
  background: var(--arb-green-50);
}

.arbitros-table tbody tr:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), rgba(34, 197, 94, 0.1));
  transform: translateX(4px);
  box-shadow: -4px 0 0 var(--arb-green-500);
}

/* =========================================================
   BOTONES DE ACCIÓN EN TABLA
   ========================================================= */
.acciones-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.btn-editar,
.btn-eliminar {
  border-radius: var(--arb-pill);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 12px;
  border: none;
  cursor: pointer;
  transition: var(--arb-transition-bounce);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--arb-shadow-sm);
  min-width: 70px;
  justify-content: center;
}

.btn-editar::before,
.btn-eliminar::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  z-index: 0;
}

.btn-editar:hover::before,
.btn-eliminar:hover::before {
  width: 200px;
  height: 200px;
}

.btn-editar > *,
.btn-eliminar > * {
  position: relative;
  z-index: 1;
}

/* Botón Editar */
.btn-editar {
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  color: #1e40af;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.btn-editar:hover {
  background: linear-gradient(135deg, #dbeafe, #c7d2fe);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

/* Botón Eliminar */
.btn-eliminar {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #7f1d1d;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.btn-eliminar:hover {
  background: linear-gradient(135deg, #fecaca, #fca5a5);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.2);
}

/* =========================================================
   PAGINACIÓN MEJORADA (unificada)
   ========================================================= */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination-btn {
  border-radius: var(--arb-pill);
  border: 2px solid var(--arb-border);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 13px;
  background: white;
  cursor: pointer;
  transition: var(--arb-transition-bounce);
  min-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--arb-shadow-sm);
  color: var(--arb-green-900);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--arb-green-50);
  border-color: var(--arb-green-500);
  transform: translateY(-2px);
  box-shadow: var(--arb-shadow);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-btn.active {
  background: linear-gradient(135deg, var(--arb-green-900), var(--arb-green-600));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
  font-weight: 700;
}

.pagination-info {
  font-weight: 600;
  font-size: 14px;
  color: var(--arb-text-muted);
  background: white;
  padding: 8px 16px;
  border-radius: var(--arb-pill);
  border: 1px solid var(--arb-border);
  margin-left: 8px;
}

/* =========================================================
   MODAL MEJORADO (unificado con entrenadores)
   ========================================================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 99999;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.modal-content {
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  background: white;
  border-radius: var(--arb-radius-xl);
  padding: 28px;
  box-shadow: var(--arb-shadow-xl);
  transform: translateY(-30px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--arb-border);
  position: relative;
}

.modal.active .modal-content {
  transform: translateY(0) scale(1);
}

/* Cabecera del modal */
.modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--arb-green-900), var(--arb-green-500));
  border-radius: var(--arb-radius-xl) var(--arb-radius-xl) 0 0;
}

.close {
  float: right;
  font-size: 32px;
  font-weight: 400;
  cursor: pointer;
  color: var(--arb-text-muted);
  line-height: 1;
  transition: var(--arb-transition);
  position: relative;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close:hover {
  color: var(--arb-text-primary);
  background: var(--arb-green-50);
  transform: rotate(90deg);
}

/* Título del modal */
.modal-content h2 {
  color: var(--arb-green-900);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 24px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--arb-green-200);
}

/* =========================================================
   FORMULARIOS DENTRO DEL MODAL
   ========================================================= */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--arb-text-secondary);
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--arb-border);
  border-radius: var(--arb-radius);
  font-size: 14px;
  transition: var(--arb-transition-bounce);
  background: white;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--arb-green-600);
  box-shadow: var(--arb-ring);
  transform: scale(1.01);
}

.form-group input.error {
  border-color: var(--arb-danger);
}

.form-group .error-message {
  color: var(--arb-danger);
  font-size: 12px;
  margin-top: 4px;
  font-weight: 500;
}

/* Botones del modal */
.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--arb-border);
}

.modal-btn {
  padding: 12px 28px;
  border-radius: var(--arb-pill);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--arb-transition-bounce);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  justify-content: center;
}

.modal-btn-primary {
  background: linear-gradient(135deg, var(--arb-green-900), var(--arb-green-600));
  color: white;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.modal-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

.modal-btn-secondary {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: var(--arb-text-primary);
}

.modal-btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: var(--arb-shadow);
}

/* =========================================================
   INDICADORES DE ESTADO
   ========================================================= */
.badge {
  padding: 6px 12px;
  border-radius: var(--arb-pill);
  font-weight: 600;
  font-size: 12px;
  display: inline-block;
  text-align: center;
  min-width: 80px;
}

.badge-success {
  background: linear-gradient(135deg, #28a745, #218838);
  color: white;
}

.badge-warning {
  background: linear-gradient(135deg, #ffc107, #e0a800);
  color: #0f172a;
}

.badge-danger {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
}

.badge-info {
  background: linear-gradient(135deg, #17a2b8, #138496);
  color: white;
}

/* =========================================================
   SPINNER DE CARGA
   ========================================================= */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--arb-green-200);
  border-right-color: var(--arb-green-600);
  border-radius: 50%;
  animation: spinner 0.75s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* =========================================================
   SCROLLBAR PERSONALIZADO (unificado)
   ========================================================= */
.tabla-container::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.tabla-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.tabla-container::-webkit-scrollbar-thumb {
  background: var(--arb-green-500);
  border-radius: 10px;
}

.tabla-container::-webkit-scrollbar-thumb:hover {
  background: var(--arb-green-700);
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--arb-green-500);
  border-radius: 10px;
}

/* =========================================================
   ANIMACIONES ADICIONALES
   ========================================================= */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.fade-in {
  animation: slideIn 0.3s ease;
}

.pulse {
  animation: pulse 2s infinite;
}

/* =========================================================
   UTILIDADES
   ========================================================= */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

/* =========================================================
   RESPONSIVE EXTREMO
   ========================================================= */
@media (max-width: 768px) {
  .arbitros-container {
    padding: 16px;
  }
  
  .arbitros-table thead th {
    font-size: 11px;
    padding: 12px 8px;
  }
  
  .arbitros-table tbody td {
    padding: 10px 8px;
    font-size: 12px;
  }
  
  .acciones-cell {
    flex-direction: column;
    gap: 4px;
  }
  
  .btn-editar,
  .btn-eliminar {
    width: 100%;
    padding: 6px 8px;
  }
  
  .pagination-btn {
    min-width: 38px;
    height: 38px;
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .modal-content {
    padding: 20px;
  }
  
  .modal-content h2 {
    font-size: 20px;
  }
  
  .modal-buttons {
    flex-direction: column;
  }
  
  .modal-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .pagination-container {
    gap: 4px;
  }
  
  .pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 4px 8px;
    font-size: 11px;
  }
  
  .pagination-info {
    font-size: 12px;
    padding: 6px 12px;
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
    text-align: center;
  }
}

/* =========================================================
   IMPRESIÓN
   ========================================================= */
@media print {
  .filtros,
  .btn-exportar-csv,
  .pagination-container,
  .acciones-cell {
    display: none !important;
  }
  
  .arbitros-container {
    box-shadow: none;
    border: 1px solid #ddd;
    padding: 0;
  }
  
  .arbitros-table thead th {
    background: #f0f0f0 !important;
    color: black !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .tabla-container {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}