/* ==================== VARIABLES GLOBALES ==================== */

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --secondary-color: #f1f5f9;
  --accent-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --dark-bg: #1e293b;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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);
  --border-radius: 0.5rem;
  --transition: all 0.2s ease-in-out;
}

/* ==================== RESET Y BASE ==================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ==================== LAYOUT PRINCIPAL ==================== */

.dashboard-container {
  display: flex;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ==================== SIDEBAR ==================== */

.sidebar {
  width: 280px;
  background: var(--dark-bg);
  color: white;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 1000;
  transition: var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(45deg, var(--primary-color), var(--primary-dark));
}

.sidebar-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-subtitle {
  font-size: 0.875rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-item {
  margin: 0.25rem 0;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: var(--transition);
  border-left: 3px solid transparent;
  gap: 0.75rem;
  font-weight: 500;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(5px);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.05));
  border-left-color: var(--primary-color);
  color: white;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

/* ==================== CONTENIDO PRINCIPAL ==================== */

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 2rem;
  min-height: 100vh;
}

.page-header {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  border-left: 4px solid var(--primary-color);
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

/* ==================== TARJETAS ==================== */

.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(90deg, var(--secondary-color), rgba(99, 102, 241, 0.05));
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.5rem;
  color: var(--text-primary);
}

/* FIX LEGIBILIDAD - Asegurar contraste en todos los textos */

.card-body p,
.card-body div,
.card-body span,
.card-body strong,
.card-body b,
.card-body td {
  color: var(--text-primary) !important;
}

.table td {
  color: var(--text-primary) !important;
}

/* ==================== GRIDS ==================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 4px solid var(--primary-color);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

.stat-label {
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.5rem;
}

/* ==================== BOTONES ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  gap: 0.5rem;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(45deg, var(--primary-color), var(--primary-dark));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.btn-success {
  background: linear-gradient(45deg, var(--accent-color), #059669);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(45deg, var(--danger-color), #dc2626);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.btn-warning {
  background: linear-gradient(45deg, var(--warning-color), #d97706);
  color: white;
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

/* ==================== FORMULARIOS ==================== */

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--card-bg);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control:disabled {
  background: var(--secondary-color);
  cursor: not-allowed;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row.three-cols {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ==================== TABLAS ==================== */

.table-container {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.table th {
  background: linear-gradient(90deg, var(--secondary-color), rgba(99, 102, 241, 0.05));
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: rgba(99, 102, 241, 0.05);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ==================== BADGES Y ESTADOS ==================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  gap: 0.25rem;
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-color);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger-color);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-primary {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ==================== ALERTAS ==================== */

.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  border-left: 4px solid;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-left-color: var(--accent-color);
  color: var(--accent-color);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: var(--danger-color);
  color: var(--danger-color);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: var(--warning-color);
  color: var(--warning-color);
}

.alert-info {
  background: rgba(99, 102, 241, 0.1);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

/* ==================== UTILIDADES ==================== */

/* FIX ADICIONAL - Forzar legibilidad en todos los elementos */

p,
div,
span,
strong,
b,
em,
i,
label,
td,
th,
li,
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary) !important;
}

/* Excepciones para elementos que deben mantener colores específicos */

.sidebar,
.sidebar *,
.btn,
.btn *,
.badge,
.badge *,
.alert,
.alert * {
  color: inherit !important;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-success {
  color: var(--accent-color) !important;
}

.text-danger {
  color: var(--danger-color) !important;
}

.text-warning {
  color: var(--warning-color) !important;
}

.text-muted {
  color: var(--text-secondary) !important;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.mb-1 {
  margin-bottom: 0.5rem !important;
}

.mb-2 {
  margin-bottom: 1rem !important;
}

.mb-3 {
  margin-bottom: 1.5rem !important;
}

.mb-4 {
  margin-bottom: 2rem !important;
}

.mt-0 {
  margin-top: 0 !important;
}

.mt-1 {
  margin-top: 0.5rem !important;
}

.mt-2 {
  margin-top: 1rem !important;
}

.mt-3 {
  margin-top: 1.5rem !important;
}

.mt-4 {
  margin-top: 2rem !important;
}

.d-flex {
  display: flex;
}

.d-grid {
  display: grid;
}

.gap-2 {
  gap: 1rem;
}

.gap-3 {
  gap: 1.5rem;
}

.justify-between {
  justify-content: space-between;
}

.items-center {
  align-items: center;
}

/* ==================== ANIMACIONES ==================== */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-row.three-cols {
    grid-template-columns: 1fr;
  }
  .page-header {
    padding: 1.5rem;
  }
  .page-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 0.5rem;
  }
  .card-body,
  .card-header {
    padding: 1rem;
  }
  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
  }
}

/* ==================== DARK MODE DESHABILITADO ==================== */

/* Comentado para evitar problemas de legibilidad */

/*
@media (prefers-color-scheme: dark) {
     :root {
        --card-bg: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border-color: #334155;
        --secondary-color: #334155;
    }
    body {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }
}
*/

/* ==================== SPINNERS Y LOADING ==================== */

.spinner {
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-radius: 50%;
  border-top: 3px solid var(--primary-color);
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

/* ==================== CONTROLES ESPECÍFICOS ==================== */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.action-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 3px solid var(--primary-color);
  transition: var(--transition);
  cursor: pointer;
}

.action-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.action-icon {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.action-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.action-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ==================== STATUS INDICATORS ==================== */

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-online .status-dot {
  background: var(--accent-color);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-offline .status-dot {
  background: var(--danger-color);
}

.status-warning .status-dot {
  background: var(--warning-color);
}

/* ==================== MODALES ==================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.modal {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.3s ease-out;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.close-btn:hover {
  background: var(--secondary-color);
  color: var(--text-primary);
}

/* ==================== FIXES ESPECÍFICOS ==================== */

select.form-control {
  cursor: pointer;
}

input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table .btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.table .badge {
  font-size: 0.7rem;
}

.prediction-preview {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  border: 2px dashed var(--primary-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  margin: 1rem 0;
}

.prediction-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.prediction-options {
  display: flex;
  justify-content: space-around;
  margin-top: 1rem;
}

.prediction-option {
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-weight: 500;
}

.prediction-option.team1 {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-color);
}

.prediction-option.team2 {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
}

.cache-info {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--warning-color);
}

.data-section {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

.data-header {
  background: var(--secondary-color);
  padding: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.data-content {
  padding: 1rem;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.data-cell {
  padding: 0.75rem;
  border-radius: var(--border-radius);
  text-align: center;
  font-weight: 500;
}

.data-cell.team1 {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-color);
}

.data-cell.team2 {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger-color);
}

.data-cell.mapa {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--warning-color);
}
