/* --- Paleta de Colores y Fuente --- */
/* Nota: Google Fonts (Roboto) se carga en header.php */

:root {
  --color-cesped-oscuro: #004d00; /* Verde principal (para botones, navbars) */
  --color-cesped-claro: #0a8a0a;  /* Verde para 'hover' y enlaces */
  --color-fondo-app: #f4f9f4;     /* Un tinte verde muy claro para el fondo */
  --color-linea-blanca: #ffffff;
  --color-texto-oscuro: #212529;

  /* Colores del Capitán (Ámbar/Dorado) */
  --color-capitan: #b8860b;
  --color-capitan-hover: #d4a017;
  --color-capitan-bg: #f5e6c8;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--color-fondo-app);
}

/* --- Sobrescribir Estilos de Bootstrap --- */

/* Botón Primario (Verde Césped) */
.btn-primary {
  --bs-btn-bg: var(--color-cesped-oscuro);
  --bs-btn-border-color: var(--color-cesped-oscuro);
  --bs-btn-hover-bg: var(--color-cesped-claro);
  --bs-btn-hover-border-color: var(--color-cesped-claro);
  --bs-btn-active-bg: var(--color-cesped-claro);
  --bs-btn-active-border-color: var(--color-cesped-claro);
  --bs-btn-focus-shadow-rgb: 49, 132, 253; /* Puedes dejar el de bootstrap o cambiarlo */
}

/* Botón Capitán (Ámbar) */
.btn-capitan {
  background-color: var(--color-capitan);
  border-color: var(--color-capitan);
  color: #fff;
  font-weight: 500;
}
.btn-capitan:hover,
.btn-capitan:focus {
  background-color: var(--color-capitan-hover);
  border-color: var(--color-capitan-hover);
  color: #fff;
}

/* Navbar Primaria (Verde Césped) */
.bg-primary {
  background-color: var(--color-cesped-oscuro) !important;
}

/* Enlaces */
a {
  color: var(--color-cesped-claro);
  text-decoration: none;
}
a:hover {
  color: var(--color-cesped-oscuro);
}

/* Ajustes a los menús */
.navbar-dark .navbar-brand:hover,
.navbar-dark .nav-link:hover {
  color: var(--color-linea-blanca);
}
.navbar-brand {
    font-weight: 700;
}

/* Marquee animation for long team names in navbar */
.marquee-wrapper {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.marquee-text {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.marquee-text.marquee-active {
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  animation: marquee-scroll 8s ease-in-out infinite alternate;
}

@keyframes marquee-scroll {
  0%, 20% { transform: translateX(0); }
  80%, 100% { transform: translateX(var(--marquee-shift, 0px)); }
}
/* --- Estilos de Componentes --- */

/* Tarjetas (Cards) */
.card {
  border: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  border-radius: 8px;
}

/* Badges (Etiquetas de estado) */
.badge.bg-warning {
  color: var(--color-texto-oscuro) !important;
}

/* --- Estilos de Pantalla Específicos --- */

/* Contenedor para centrar las pantallas de Login */
.login-wrapper {
  min-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem !important;
  background: linear-gradient(135deg, #f4f9f4 0%, #e0f2e9 100%);
  position: relative;
  overflow: hidden;
}

/* Formas de fondo para el login */
.login-wrapper::before,
.login-wrapper::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 0;
  opacity: 0.5;
}

.login-wrapper::before {
  top: -10%; left: -10%;
  width: 400px; height: 400px;
  background: rgba(10, 138, 10, 0.2);
}

.login-wrapper::after {
  bottom: -10%; right: -10%;
  width: 300px; height: 300px;
  background: rgba(184, 134, 11, 0.15);
}

.login-container {
  width: 100%;
  max-width: 450px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.login-image-section {
  padding: 2rem 2rem 0;
  text-align: center;
}

.login-image-section img {
  max-width: 150px;
  filter: drop-shadow(0 5px 10px rgba(0,0,0,0.05));
}

.login-form-section {
  padding: 2rem;
}

.login-form-section .card-title {
  font-weight: 800;
  color: var(--color-cesped-oscuro);
  font-size: 1.5rem;
}

/* Modificadores de tarjetas de login */
.login-card .card-title {
  font-weight: 700;
  color: var(--color-cesped-oscuro);
}

/* --- Responsividad --- */

/* Esto es CLAVE. 
  Hace que cualquier tabla dentro de este div 
  tenga scroll horizontal en móviles.
*/
.table-responsive-wrapper {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==================================================================
   ESTILOS DEL HOME - Tarjetas de Selección de Rol
   ================================================================== */

.home-hero {
  min-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  /* Fondo con gradiente sutil */
  background: linear-gradient(135deg, #003300 0%, #004d00 40%, #006600 100%);
  position: relative;
  overflow: hidden;
}

/* Patrón decorativo sutil en el fondo */
.home-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(255,255,255,0.03) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(255,255,255,0.05) 0%, transparent 40%);
  pointer-events: none;
}

.home-hero .home-logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.home-hero .home-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 1.05rem;
  font-weight: 300;
  letter-spacing: 0.5px;
  margin-bottom: 2.5rem;
}

/* Grid de tarjetas */
.home-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
  max-width: 1000px;
  position: relative;
  z-index: 1;
}

@media (min-width: 600px) {
  .home-cards-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .home-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tarjeta de rol */
.home-role-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.home-role-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

/* Variante Admin */
.home-role-card--admin:hover {
  border-color: rgba(10, 138, 10, 0.5);
}

/* Variante Capitán */
.home-role-card--capitan:hover {
  border-color: rgba(212, 160, 23, 0.5);
}

/* Icono de la tarjeta */
.home-role-card__icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
}

.home-role-card--admin .home-role-card__icon {
  background: linear-gradient(135deg, var(--color-cesped-oscuro), var(--color-cesped-claro));
  color: #fff;
}

.home-role-card--capitan .home-role-card__icon {
  background: linear-gradient(135deg, #8B6914, var(--color-capitan-hover));
  color: #fff;
}

.home-role-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.home-role-card__desc {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.6);
  margin: 0;
  line-height: 1.4;
}

/* Botón dentro de la tarjeta */
.home-role-card__btn {
  display: inline-block;
  padding: 0.6rem 1.8rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  transition: background-color 0.2s ease, transform 0.15s ease;
  text-decoration: none;
  border: none;
}

.home-role-card--admin .home-role-card__btn {
  background-color: var(--color-cesped-claro);
  color: #fff;
}
.home-role-card--admin:hover .home-role-card__btn {
  background-color: #0cad0c;
}

.home-role-card--capitan .home-role-card__btn {
  background-color: var(--color-capitan-hover);
  color: #fff;
}
.home-role-card--capitan:hover .home-role-card__btn {
  background-color: #e6b422;
}

/* Enlace SuperAdmin discreto */
.home-superadmin-link {
  margin-top: 2.5rem;
  position: relative;
  z-index: 1;
}
.home-superadmin-link a {
  color: rgba(255,255,255,0.3);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s ease;
}
.home-superadmin-link a:hover {
  color: rgba(255,255,255,0.6);
}

/* ==================================================================
   ESTILOS DE LOGIN CON IMAGEN
   ================================================================== */

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  margin: auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.login-image-section {
  background-color: var(--color-cesped-oscuro);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  width: 100%;
  gap: 1rem;
}

/* Variante ámbar para el login de capitán */
.login-image-section--capitan {
  background: linear-gradient(135deg, #6b4c00 0%, var(--color-capitan) 60%, var(--color-capitan-hover) 100%);
}

/* Variante verde para el login de admin (explícita) */
.login-image-section--admin {
  background: linear-gradient(135deg, #003300 0%, var(--color-cesped-oscuro) 60%, var(--color-cesped-claro) 100%);
}

.login-image-section img {
  max-width: 160px;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

/* Icono grande del rol en la sección de imagen del login */
.login-role-icon {
  font-size: 3rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 0.25rem;
}

.login-role-label {
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  font-weight: 300;
  letter-spacing: 0.5px;
}

.login-form-section {
  background-color: var(--color-linea-blanca);
  padding: 2.5rem;
  width: 100%;
}

/* Banner de enlace cruzado entre roles */
.role-switch-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1.25rem;
  font-size: 0.85rem;
  transition: background-color 0.2s ease;
}

.role-switch-banner--to-capitan {
  background-color: var(--color-capitan-bg);
  color: var(--color-capitan);
}
.role-switch-banner--to-capitan:hover {
  background-color: #f0ddb0;
}
.role-switch-banner--to-capitan a {
  color: var(--color-capitan);
  font-weight: 600;
  text-decoration: underline;
}

.role-switch-banner--to-admin {
  background-color: #e0f2e0;
  color: var(--color-cesped-oscuro);
}
.role-switch-banner--to-admin:hover {
  background-color: #c8e6c8;
}
.role-switch-banner--to-admin a {
  color: var(--color-cesped-oscuro);
  font-weight: 600;
  text-decoration: underline;
}

/* En pantallas grandes (md en adelante), cambia el layout */
@media (min-width: 768px) {
  .login-container {
    flex-direction: row;
    min-height: 550px;
  }
  .login-image-section,
  .login-form-section {
    width: 50%;
    padding: 3rem;
  }
}

/* --- Estilos del Botón de Copiar --- */
.btn-copy-link {
  /* Asegura que el botón no sea muy ancho */
  min-width: 40px; 
  text-align: center;
}
.btn-copy-link .bi-check-lg {
  /* Color verde para el ícono de "copiado" */
  color: var(--color-cesped-claro) !important;
}

/* ===================================================================== */
/* MOBILE FIRST & PREMIUM UI REDESIGN */
/* ===================================================================== */

/* Glassmorphism Classes */
.glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.glass-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.12);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.06);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Typography & Layout Tweaks */
.text-gradient {
  background: linear-gradient(135deg, var(--color-cesped-oscuro) 0%, var(--color-cesped-claro) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.content-wrapper {
  padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)); /* Space for bottom nav & safe area */
}

/* Torneo Grid Cards */
.torneo-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  background: white;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.torneo-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0,0,0,0.1);
  color: inherit;
}

.torneo-card-header {
  height: 100px;
  background: linear-gradient(135deg, #198754 0%, #20c997 100%);
  position: relative;
}

.torneo-card-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 4px solid white;
  position: absolute;
  bottom: -35px;
  left: 20px;
  background-color: white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  object-fit: contain;
}

.torneo-card-body {
  padding: 45px 20px 20px;
}

/* Feed & Posts */
.post-card {
  border-radius: 24px;
  background: rgba(17, 24, 39, 0.55) !important;
  backdrop-filter: blur(15px) !important;
  -webkit-backdrop-filter: blur(15px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
  margin-bottom: 24px;
}

.carousel-inner {
  background-color: rgba(0, 0, 0, 0.2) !important;
}

.post-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.post-actions {
  display: flex;
  gap: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.btn-like {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  font-weight: 600;
  transition: all 0.2s ease;
  min-height: 42px;
}

.btn-like:hover, .btn-like.active {
  background: rgba(233, 62, 140, 0.18) !important;
  color: #e93e8c !important;
  border-color: rgba(233, 62, 140, 0.35) !important;
}

.btn-like i {
  transition: transform 0.2s ease;
}

.btn-like:active i {
  transform: scale(1.3);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(11, 14, 23, 0.92) !important;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.35);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 5px calc(8px + env(safe-area-inset-bottom, 10px)); /* Safe area padding */
  z-index: 1030;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #94a3b8;
  flex: 1;
  padding: 4px 0;
  min-height: 48px; /* Standard 48px touch target */
  min-width: 48px;
  transition: all 0.2s ease;
  position: relative;
}

.bottom-nav-item i {
  font-size: 1.35rem;
  margin-bottom: 2px;
  transition: all 0.2s ease;
}

.bottom-nav-item span {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.bottom-nav-item.active {
  color: var(--color-cesped-claro) !important;
}

.bottom-nav-item.active i {
  transform: translateY(-2px);
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-cesped-oscuro) 0%, var(--color-cesped-claro) 100%);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  box-shadow: 0 6px 15px rgba(25, 135, 84, 0.4);
  z-index: 1020;
  border: none;
  transition: transform 0.2s;
}

.fab:active {
  transform: scale(0.9);
}

/* Responsive Hide/Show */
.d-mobile-only {
  display: flex; /* Must be flex to not break bottom-nav horizontal layout */
}

.d-desktop-only {
  display: none;
}

@media (min-width: 992px) {
  .bottom-nav {
    display: none; /* Hide bottom nav on desktop */
  }
  .content-wrapper {
    padding-bottom: 20px; /* Reset padding */
  }
  .d-mobile-only {
    display: none !important;
  }
  .d-desktop-only {
    display: block !important;
  }
  .fab {
    display: none;
  }
}

/* Animations */
.animation-pulse {
  animation: ui-pulse 1.8s infinite ease-in-out;
}

@keyframes ui-pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(0.96);
  }
}

/* --- REDISEÑO GLOBAL DARK UI, GLASSMORPHISM & MATERIAL DESIGN 3 --- */

/* 1. Cambiar Fuente y Fondo Base de la Aplicación */
body {
  font-family: 'Outfit', 'Roboto', sans-serif !important;
  background-color: #0b0e17 !important;
  background-image: 
      radial-gradient(at 0% 0%, rgba(10, 138, 10, 0.08) 0px, transparent 40%),
      radial-gradient(at 100% 0%, rgba(41, 121, 255, 0.08) 0px, transparent 40%),
      radial-gradient(at 50% 100%, rgba(233, 62, 140, 0.06) 0px, transparent 40%) !important;
  background-attachment: fixed !important;
  color: #f8f9fa !important;
}

/* 2. Sobrescribir variables de Bootstrap en :root para el tema oscuro */
:root {
  --color-fondo-app: #0b0e17;
  --color-texto-oscuro: #f8f9fa;
  --color-cesped-oscuro: #0a8a0a;
  --color-cesped-claro: #00e676;
}

/* 3. Re-diseño de las Tarjetas (Cards y Torneo-Cards) a Glassmorphism */
.card, .glass-card, .torneo-card {
  background: rgba(17, 24, 39, 0.6) !important;
  backdrop-filter: blur(15px) !important;
  -webkit-backdrop-filter: blur(15px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 20px !important;
  color: #f8f9fa !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}

.card:hover, .torneo-card:hover {
  transform: translateY(-5px) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35) !important;
}

/* Ajustes para encabezados y pies de tarjetas */
.card-header, .torneo-card-header {
  background: rgba(255, 255, 255, 0.03) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-top-left-radius: 20px !important;
  border-top-right-radius: 20px !important;
}

.card-footer {
  background: rgba(255, 255, 255, 0.01) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-bottom-left-radius: 20px !important;
  border-bottom-right-radius: 20px !important;
}

/* 4. Tablas en Dark Theme */
.table {
  --bs-table-bg: transparent !important;
  --bs-table-hover-bg: rgba(255, 255, 255, 0.04) !important;
  --bs-table-color: #f8f9fa !important;
  --bs-table-border-color: rgba(255, 255, 255, 0.08) !important;
  color: #f8f9fa !important;
}

.table th, .table td {
  color: #f8f9fa !important;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(255, 255, 255, 0.03) !important;
  color: #f8f9fa !important;
  --bs-table-color-state: #f8f9fa !important;
  --bs-table-bg-state: rgba(255, 255, 255, 0.03) !important;
}

.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: transparent !important;
  color: #f8f9fa !important;
  --bs-table-color-state: #f8f9fa !important;
  --bs-table-bg-state: transparent !important;
}

.table-hover > tbody > tr:hover > * {
  background-color: rgba(255, 255, 255, 0.07) !important;
  color: #ffffff !important;
  --bs-table-color-state: #ffffff !important;
  --bs-table-bg-state: rgba(255, 255, 255, 0.07) !important;
}

.table thead th {
  color: #ffffff !important;
  font-weight: 700 !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12) !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
}

thead, tbody, tfoot, tr, td, th {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* 5. Inputs y selectores de formularios estilo MD3 */
.form-control, .form-select {
  background-color: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #f8f9fa !important;
  border-radius: 12px !important;
  padding: 0.6rem 1rem !important;
  transition: all 0.2s ease !important;
}

.form-control:focus, .form-select:focus {
  background-color: rgba(15, 23, 42, 0.85) !important;
  border-color: var(--color-cesped-claro) !important;
  box-shadow: 0 0 0 0.25rem rgba(0, 230, 118, 0.15) !important;
  color: #ffffff !important;
}

.form-control::placeholder {
  color: #64748b !important;
}

.form-label, label {
  color: #94a3b8 !important;
  font-weight: 500 !important;
  font-size: 0.9rem !important;
  margin-bottom: 0.5rem !important;
}

/* 6. Botones MD3 de Píldora */
.btn {
  border-radius: 100px !important; /* MD3 pill shape */
  font-weight: 600 !important;
  padding: 0.55rem 1.6rem !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-primary {
  background-color: var(--color-cesped-oscuro) !important;
  border-color: var(--color-cesped-oscuro) !important;
}
.btn-primary:hover {
  background-color: var(--color-cesped-claro) !important;
  border-color: var(--color-cesped-claro) !important;
  box-shadow: 0 0 15px rgba(0, 230, 118, 0.3) !important;
}

.btn-light {
  background-color: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #f8f9fa !important;
}
.btn-light:hover {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

.btn-outline-primary {
  border-color: var(--color-cesped-oscuro) !important;
  color: var(--color-cesped-claro) !important;
}
.btn-outline-primary:hover {
  background-color: var(--color-cesped-oscuro) !important;
  border-color: var(--color-cesped-oscuro) !important;
  color: #ffffff !important;
}

/* 7. Navbars y barras de navegación */
.navbar {
  background: rgba(11, 14, 23, 0.8) !important;
  backdrop-filter: blur(15px) !important;
  -webkit-backdrop-filter: blur(15px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.navbar-dark .navbar-nav .nav-link {
  color: #cbd5e1 !important;
  font-weight: 600 !important;
  transition: color 0.2s ease;
}
.navbar-dark .navbar-nav .nav-link:hover {
  color: #ffffff !important;
}
.navbar-dark .navbar-nav .nav-link.active {
  color: var(--color-cesped-claro) !important;
}

/* 8. Modales oscuros de cristal */
.modal-content {
  background: rgba(15, 23, 42, 0.9) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 24px !important;
  color: #f8f9fa !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
}

.modal-header, .modal-footer {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* 9. Badges de estado modernos */
.badge {
  border-radius: 100px !important;
  padding: 0.4em 0.8em !important;
  font-weight: 600 !important;
}

/* 10. Elementos de texto general y links */
.text-dark {
  color: #ffffff !important;
}
.text-muted {
  color: #94a3b8 !important;
}
.bg-light, .bg-white {
  background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Enlaces */
a {
  color: var(--color-cesped-claro) !important;
}
a:hover {
  color: #ffffff !important;
}

/* Botones de acción circular */
.btn-circle {
  border-radius: 50% !important;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
}

/* Bottom Nav en móvil */
.bottom-nav {
  background: rgba(11, 14, 23, 0.8) !important;
  backdrop-filter: blur(15px) !important;
  -webkit-backdrop-filter: blur(15px) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.bottom-nav-link {
  color: #94a3b8 !important;
}

.bottom-nav-link.active {
  color: var(--color-cesped-claro) !important;
}

/* Alertas estilo cristal oscuro */
.alert {
  border-radius: 16px !important;
  background-color: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #f8f9fa !important;
}
.alert-success {
  background-color: rgba(0, 230, 118, 0.1) !important;
  border-color: rgba(0, 230, 118, 0.2) !important;
  color: #00e676 !important;
}
.alert-danger {
  background-color: rgba(233, 62, 140, 0.1) !important;
  border-color: rgba(233, 62, 140, 0.2) !important;
  color: #e93e8c !important;
}
.alert-warning {
  background-color: rgba(255, 179, 0, 0.1) !important;
  border-color: rgba(255, 179, 0, 0.2) !important;
  color: #ffb300 !important;
}

/* --- MEJORAS DE CONTRASTE DE FUENTES Y ESTADOS --- */

/* Títulos y textos principales en blanco */
h1, h2, h3, h4, h5, h6, .card-title, .torneo-card h5 {
  color: #ffffff !important;
}

/* Colores de texto auxiliares */
.text-dark {
  color: #ffffff !important;
}

.text-muted, .text-secondary, .text-black-50, .text-white-50 {
  color: #94a3b8 !important; /* Gris pizarra claro para máxima legibilidad en fondo oscuro */
}

.text-body, p {
  color: #cbd5e1 !important; /* Blanco suave */
}

/* Overrides para Badges Sutiles de Bootstrap 5 en tema oscuro */
.bg-success-subtle {
  background-color: rgba(0, 230, 118, 0.15) !important;
  color: #00e676 !important;
}
.text-success {
  color: #00e676 !important;
}

.bg-danger-subtle {
  background-color: rgba(233, 62, 140, 0.15) !important;
  color: #e93e8c !important;
}
.text-danger {
  color: #e93e8c !important;
}

.bg-warning-subtle {
  background-color: rgba(255, 179, 0, 0.15) !important;
  color: #ffb300 !important;
}
.text-warning, .text-warning-emphasis {
  color: #ffb300 !important;
}

.bg-info-subtle {
  background-color: rgba(41, 121, 255, 0.15) !important;
  color: #2979ff !important;
}
.text-info, .text-info-emphasis {
  color: #2979ff !important;
}

.bg-secondary-subtle {
  background-color: rgba(148, 163, 184, 0.15) !important;
  color: #cbd5e1 !important;
}

/* Estilo para los bloques de estadísticas rápidas */
.bg-primary.bg-opacity-10, .bg-secondary.bg-opacity-10, .bg-success.bg-opacity-10 {
  background-color: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.bg-primary.bg-opacity-10 h5, .bg-secondary.bg-opacity-10 h5 {
  color: #ffffff !important;
}

/* --- ESTILOS DE PESTAÑAS (TABS) EN TEMA OSCURO --- */
.nav-tabs {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin-bottom: 1.5rem !important;
}

.nav-tabs .nav-link {
  color: #94a3b8 !important;
  font-weight: 600 !important;
  border: 1px solid transparent !important;
  border-radius: 12px 12px 0 0 !important;
  padding: 0.75rem 1.25rem !important;
  transition: all 0.3s ease !important;
}

.nav-tabs .nav-link:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.08) rgba(255, 255, 255, 0.08) transparent !important;
}

.nav-tabs .nav-link.active {
  color: var(--color-cesped-claro) !important;
  background-color: rgba(17, 24, 39, 0.55) !important;
  border-color: rgba(255, 255, 255, 0.08) rgba(255, 255, 255, 0.08) transparent !important;
}

/* Pestañas Horizontales Deslizables en Móvil */
@media (max-width: 767.98px) {
  .nav-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap !important;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  .nav-tabs .nav-item {
    flex-shrink: 0;
  }
  .nav-tabs .nav-link {
    padding: 0.6rem 1rem !important;
    font-size: 0.88rem !important;
  }
}

/* --- OPTIMIZACIÓN MOBILE-FIRST & PREVENCIÓN AUTO-ZOOM IOS --- */
@media (max-width: 768px) {
  .form-control, .form-select, input, select, textarea {
    font-size: 16px !important; /* Estándar iOS para prevenir zoom automático al enfocar */
    min-height: 44px;
  }
  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* --- AUDITORÍA DE CONTRASTE Y LEGIBILIDAD EN TEMA OSCURO --- */

/* 1. Homologación de Cabeceras de Tablas (.table-light en dark theme) */
.table-light, thead.table-light th, .table thead.table-light {
  --bs-table-bg: rgba(255, 255, 255, 0.05) !important;
  --bs-table-color: #ffffff !important;
  --bs-table-border-color: rgba(255, 255, 255, 0.08) !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #ffffff !important;
}

.table-responsive {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Textos secundarios en tablas con contraste nítido */
.table .text-muted, .table small, .list-group-item .text-muted, .list-group-item small {
  color: #a0aec0 !important;
}

/* 2. List Groups en Tema Oscuro */
.list-group {
  --bs-list-group-bg: rgba(255, 255, 255, 0.03) !important;
  --bs-list-group-color: #f8f9fa !important;
  --bs-list-group-border-color: rgba(255, 255, 255, 0.08) !important;
  --bs-list-group-action-hover-bg: rgba(255, 255, 255, 0.08) !important;
  --bs-list-group-action-hover-color: #ffffff !important;
  --bs-list-group-active-bg: rgba(0, 230, 118, 0.2) !important;
  --bs-list-group-active-color: #00e676 !important;
  --bs-list-group-active-border-color: rgba(0, 230, 118, 0.3) !important;
}

.list-group-item {
  background-color: transparent !important;
  color: #f8f9fa !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.list-group-item-action {
  color: #cbd5e1 !important;
}

.list-group-item-action:hover, .list-group-item-action:focus {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

/* 3. Badges con Alto Contraste Seguro */
.badge.bg-warning, .badge.text-bg-warning, .btn-warning {
  color: #0b0e17 !important; /* Texto negro sobre fondo amarillo sólido para legibilidad perfecta (WCAG AAA) */
  font-weight: 700 !important;
}

.badge.bg-light {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.badge.bg-secondary {
  background-color: rgba(148, 163, 184, 0.2) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
}

/* 4. Botón de Cierre de Modales y Alertas (.btn-close) */
.btn-close {
  filter: invert(1) grayscale(100%) brightness(200%) !important;
  opacity: 0.8 !important;
}

.btn-close:hover {
  opacity: 1 !important;
}

/* 5. Selectores <option> y <optgroup> en Modo Oscuro */
select option {
  background-color: #0f172a !important;
  color: #f8f9fa !important;
}

select optgroup {
  background-color: #1e293b !important;
  color: #38bdf8 !important;
  font-weight: 700 !important;
}

/* 6. Menús Desplegables (.dropdown-menu) */
.dropdown-menu {
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
  color: #f8f9fa !important;
  padding: 0.5rem !important;
}

.dropdown-item {
  color: #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 0.5rem 1rem !important;
  transition: all 0.2s ease !important;
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.dropdown-divider {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* 7. Acordeones (.accordion) */
.accordion {
  --bs-accordion-bg: transparent !important;
  --bs-accordion-color: #f8f9fa !important;
  --bs-accordion-border-color: rgba(255, 255, 255, 0.08) !important;
  --bs-accordion-btn-color: #f8f9fa !important;
  --bs-accordion-btn-bg: rgba(255, 255, 255, 0.03) !important;
  --bs-accordion-active-color: var(--color-cesped-claro) !important;
  --bs-accordion-active-bg: rgba(10, 138, 10, 0.12) !important;
}

.accordion-item {
  background-color: transparent !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.accordion-button::after {
  filter: invert(1) !important;
}

/* 8. Input Group Addons (.input-group-text) */
.input-group-text {
  background-color: rgba(15, 23, 42, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

/* 9. Paginación (.pagination, .page-link) */
.pagination {
  --bs-pagination-bg: rgba(15, 23, 42, 0.6) !important;
  --bs-pagination-color: #cbd5e1 !important;
  --bs-pagination-border-color: rgba(255, 255, 255, 0.1) !important;
  --bs-pagination-hover-bg: rgba(255, 255, 255, 0.08) !important;
  --bs-pagination-hover-color: #ffffff !important;
  --bs-pagination-active-bg: var(--color-cesped-oscuro) !important;
  --bs-pagination-active-border-color: var(--color-cesped-claro) !important;
  --bs-pagination-disabled-bg: rgba(15, 23, 42, 0.3) !important;
  --bs-pagination-disabled-color: #64748b !important;
}

.page-link {
  background-color: var(--bs-pagination-bg) !important;
  border-color: var(--bs-pagination-border-color) !important;
  color: var(--bs-pagination-color) !important;
  border-radius: 8px !important;
  margin: 0 2px !important;
}

/* 10. Bordes Generales */
.border, .border-top, .border-bottom, .border-start, .border-end {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* 11. Toggle de visualización de contraseña */
.password-toggle-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: 44px;
  z-index: 5;
  transition: color 0.2s ease;
}

.password-toggle-btn:hover {
  color: #ffffff;
}