/* ========================================
   MOBILE FLUIDITY (cero cambio visual)
======================================== */
html, body { -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
* { -webkit-tap-highlight-color: transparent; }
button, [role="button"], a, label, input[type="checkbox"], input[type="radio"] { touch-action: manipulation; }
/* Renderizar fuera del viewport sólo cuando se acerque (mejora scroll en listas largas) */
#playersList > .glass-card { content-visibility: auto; contain-intrinsic-size: 0 130px; }

/* ========================================
   CONFIGURACIÓN BASE MODO OSCURO
======================================== */

/* Forzar transición suave */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Modo claro (por defecto) */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
}

/* Modo oscuro */
:root.dark,
html.dark,
.dark {
  --bg-primary: #1f2937;
  --bg-secondary: #111827;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
}

/* Aplicar colores base */
html {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

body {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}



/* ========================================
   VARIABLES Y RESET
======================================== */
:root {
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --yellow-500: #eab308;
  --yellow-600: #f59e0b;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ========================================
   MODO OSCURO
======================================== */
.dark {
  color-scheme: dark;
}

/* ========================================
   ANIMACIONES
======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

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

.animate-fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

.animate-slide-in {
  animation: slideIn 0.4s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.3s ease-out;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* ========================================
   NAVEGACIÓN BOTTOM
======================================== */
.nav-item {
  color: #9ca3af;
  transition: all 0.3s;
}

.nav-item.active {
  color: #0d9488;
  background-color: rgba(13, 148, 136, 0.1);
}

.nav-item:active {
  transform: scale(0.95);
}

/* ========================================
   CARDS
======================================== */
.card-hover {
  transition: all 0.3s;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.card-hover:active {
  transform: translateY(-2px);
}

/* ========================================
   BADGES
======================================== */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background-color: #dcfce7;
  color: #16a34a;
}

.badge-warning {
  background-color: #fef3c7;
  color: #f59e0b;
}

.badge-danger {
  background-color: #fee2e2;
  color: #dc2626;
}

.badge-info {
  background-color: #dbeafe;
  color: #2563eb;
}

.dark .badge-success {
  background-color: rgba(22, 163, 74, 0.2);
  color: #86efac;
}

.dark .badge-warning {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fde047;
}

.dark .badge-danger {
  background-color: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
}

.dark .badge-info {
  background-color: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

/* ========================================
   SCROLL PERSONALIZADO
======================================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ========================================
   LOADING
======================================== */
.spinner {
  border: 3px solid rgba(13, 148, 136, 0.1);
  border-left-color: #0d9488;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}

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

/* ========================================
   EMPTY STATE
======================================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 64px;
  opacity: 0.3;
  margin-bottom: 16px;
}

/* ========================================
   PROGRESS BAR
======================================== */
.progress-bar {
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.dark .progress-bar {
  background-color: #374151;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d9488, #14b8a6);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ========================================
   TOOLTIPS
======================================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: #1f2937;
  color: white;
  font-size: 12px;
  white-space: nowrap;
  border-radius: 6px;
  margin-bottom: 8px;
  z-index: 1000;
}

/* ========================================
   CALENDARIO
======================================== */
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
}

.calendar-day:hover {
  background-color: #f3f4f6;
}

.dark .calendar-day:hover {
  background-color: #374151;
}

.calendar-day.today {
  background-color: #0d9488;
  color: white;
}

.calendar-day.has-event {
  position: relative;
}

.calendar-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: currentColor;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 640px) {
  .calendar-day {
    font-size: 12px;
  }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
  body {
    background: white !important;
  }
  
  header,
  nav,
  button,
  .no-print {
    display: none !important;
  }
}

/* ========================================
   UTILIDADES ADICIONALES
======================================== */
.text-gradient {
  background: linear-gradient(135deg, #0d9488, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.shadow-glow {
  box-shadow: 0 0 20px rgba(13, 148, 136, 0.5);
}

.border-gradient {
  border: 2px solid transparent;
  background: linear-gradient(white, white) padding-box,
              linear-gradient(135deg, #0d9488, #3b82f6) border-box;
}

.dark .border-gradient {
  background: linear-gradient(#1f2937, #1f2937) padding-box,
              linear-gradient(135deg, #0d9488, #3b82f6) border-box;
}
/* ========================================
   BOTÓN DE INSTALACIÓN
======================================== */
#installButton,
#installButtonLogin {
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
}

#installButton:hover,
#installButtonLogin:hover {
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.6);
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.animate-bounce {
  animation: bounce 2s infinite;
}
/* ========================================
   BARRA DE DESPLAZAMIENTO PARA TODOS LOS SELECTS
======================================== */

/* Aplicar a todos los select de la app */
select::-webkit-scrollbar {
  width: 8px;
}

select::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.dark select::-webkit-scrollbar-track {
  background: #374151;
}

select::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #0d9488, #14b8a6);
  border-radius: 10px;
}

select::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #0f766e, #0d9488);
}

/* Para Firefox */
select {
  scrollbar-width: thin;
  scrollbar-color: #0d9488 #f1f5f9;
}

.dark select {
  scrollbar-color: #0d9488 #374151;
}

/* Padding a todas las opciones */
select option {
  padding: 10px;
}

select option:hover {
  background-color: rgba(13, 148, 136, 0.1);
}

/* Animación para el buscador */
.animate-slide-down {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mejorar área táctil en móvil */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Asegurar que los botones sean táctiles en móvil */
@media (max-width: 640px) {
    button {
        min-height: 44px; /* Tamaño mínimo recomendado para táctil */
        min-width: 44px;
    }
}

/* ========================================
   🔍 ESTILOS PARA BUSCADOR DE JUGADORES
   ======================================== */

/* Contenedor de resultados */
#playerSearchResults {
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

#playerSearchResults::-webkit-scrollbar {
  width: 6px;
}

#playerSearchResults::-webkit-scrollbar-track {
  background: transparent;
}

#playerSearchResults::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.5);
  border-radius: 3px;
}

#playerSearchResults::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.7);
}

/* Items de jugador */
.player-search-item {
  transition: all 0.2s ease;
}

.player-search-item:hover {
  transform: translateX(4px);
}

.player-search-item img {
  transition: transform 0.2s ease;
}

.player-search-item:hover img {
  transform: scale(1.05);
}

/* Animación para el jugador seleccionado */
#selectedPlayerDisplay {
  animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Estado vacío */
#playerSearchResults:empty::after {
  content: "Cargando jugadores...";
  display: block;
  text-align: center;
  padding: 2rem;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* Focus en input de búsqueda */
#playerSearchInput:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

/* Responsive */
@media (max-width: 640px) {
  #playerSearchResults {
    max-height: 200px;
  }

  .player-search-item img {
    width: 40px;
    height: 40px;
  }
}

/* ========================================
   ANIMACIONES DE MODALES
======================================== */
@keyframes scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.animate-scale-in {
    animation: scale-in 0.2s ease-out;
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

.animate-pulse-slow {
    animation: pulse-slow 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ========================================
   GLASSMORPHISM — EFECTO VIDRIO
   En reposo: semi-transparente (se ve el escudo de fondo)
   Al tocar / hover: fondo sólido para leer bien
======================================== */
.glass-card {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.dark .glass-card {
    background: rgba(17, 24, 39, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

/* Al tocar o hacer hover → sólido para leer bien */
.glass-card:hover,
.glass-card:active,
.glass-card:focus-within {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(255, 255, 255, 0.6);
}

.dark .glass-card:hover,
.dark .glass-card:active,
.dark .glass-card:focus-within {
    background: rgba(31, 41, 55, 0.97);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ========================================
   MARCA DE AGUA DEL CLUB
======================================== */
body.has-watermark::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: var(--club-logo-url, none);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    opacity: 0.13;
    pointer-events: none;
    z-index: 0;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transform: translateZ(0);
}

/* ========================================
   MODOS DE CALIDAD VISUAL
   El usuario elige entre Alto / Medio / Bajo en Configuración.
   Se aplica la clase perf-low / perf-medium / perf-high al body.
======================================== */

/* MODO BAJO — máxima velocidad, mínimos efectos */
body.perf-low .glass-card {
    /* Sin blur ni transparencia */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    /* Sin sombras */
    box-shadow: none !important;
    /* Sin bordes redondeados grandes */
    border-radius: 8px !important;
}

body.perf-low.dark .glass-card {
    background: #1f2937 !important;
    border: 1px solid #374151 !important;
    box-shadow: none !important;
}

/* Sin animaciones de entrada */
body.perf-low .animate-fade-in,
body.perf-low .animate-slide-in,
body.perf-low .animate-scale-in,
body.perf-low .animate-slide-up,
body.perf-low .animate-slide-down,
body.perf-low .animate-bounce,
body.perf-low .animate-pulse,
body.perf-low .animate-pulse-slow {
    animation: none !important;
}

/* Transiciones a cero — cambios instantáneos */
body.perf-low * {
    transition: none !important;
}

/* Sin elevación ni sombra al hacer hover */
body.perf-low .card-hover:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Sin sombras en botones y elementos destacados */
body.perf-low .shadow-glow,
body.perf-low #installButton,
body.perf-low #installButtonLogin {
    box-shadow: none !important;
}

/* Barras de progreso: color plano en vez de gradiente */
body.perf-low .progress-bar-fill {
    background: #0d9488 !important;
}

/* Marca de agua desactivada (ahorra repintado) */
body.perf-low::before {
    display: none !important;
}

/* MODO MEDIO — reduce un poco sin sacrificar lo visual */
body.perf-medium .glass-card {
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}

body.perf-medium .animate-fade-in,
body.perf-medium .animate-slide-in,
body.perf-medium .animate-scale-in {
    animation-duration: 0.15s !important;
}

/* ========================================
   NOTIFICACIONES EXPANSIBLES (Press to Peek)
======================================== */
.notif-card {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

.notif-card.is-expanded {
    background-color: white !important;
    transform: scale(1.01);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 10;
    border-color: #0d9488 !important;
}

.dark .notif-card.is-expanded {
    background-color: #1f2937 !important;
}

.notif-card.is-expanded .truncate {
    white-space: normal !important;
    overflow: visible !important;
}

.notif-card.is-expanded .line-clamp-1 {
    display: block !important;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
}

