/* =========================================================================
   ValueStats · Dark Mode (infra GLOBAL, activación LOCAL)
   -------------------------------------------------------------------------
   Este archivo se carga en TODA la web, pero CADA regla está scopeada bajo
   [data-theme="dark"]. Si ningún elemento tiene ese atributo, no hace nada.
   De momento el atributo SOLO se pone en el wrapper de la sección LIVE
   (templates/v2/live/show.html.twig), así que solo afecta a /directo.

   Estrategia: sobreescribir las utilidades Tailwind que ya usa el HTML
   ([data-theme="dark"] .bg-white, etc.) -> con specificidad (0,2,0) ganan a
   las utilidades de un solo nivel sin necesidad de !important.

   Para ampliar a otra sección en el futuro: basta con poner data-theme="dark"
   en el wrapper de esa sección y, si usa clases nuevas, añadirlas aquí.
   ========================================================================= */

/* Paleta dark (slate). Centralizada por si queremos afinar.
   No las usamos como var en las reglas de abajo para mantenerlas explícitas
   y fáciles de leer/editar, pero quedan documentadas aquí: */
/*
   --d-app        #0f172a   fondo de página (el más oscuro)
   --d-surface    #1e293b   tarjetas / superficies
   --d-raised     #334155   chips, barras, recesos
   --d-border     #334155 / #475569
   --d-text-hi    #f1f5f9   texto principal
   --d-text-mid   #cbd5e1
   --d-text-low   #94a3b8
*/

/* Hint al navegador: scrollbars, inputs, etc. en modo oscuro */
[data-theme="dark"] {
    color-scheme: dark;
}

/* -------------------------------------------------------------------------
   Fondo de página (canvas). El tema es GLOBAL (data-theme en <html>):
   oscurecemos el body en toda la web y apagamos el resplandor radial claro.
   Las secciones con fondo propio opaco (bg-gray-100/50) se igualan al canvas
   con la clase marcadora .theme-canvas (ver "HOSTS DE SECCIÓN" más abajo).
   ------------------------------------------------------------------------- */
html[data-theme="dark"] body {
    background: #0f172a;
}
html[data-theme="dark"] body::before {
    opacity: 0;
}

/* -------------------------------------------------------------------------
   Superficies (backgrounds)
   ------------------------------------------------------------------------- */
[data-theme="dark"] .bg-white      { background-color: #1e293b; }
[data-theme="dark"] .bg-gray-50    { background-color: #15202e; } /* hundido: algo más oscuro que la card para que filas/paneles internos se distingan */
[data-theme="dark"] .bg-gray-100   { background-color: #243044; }
[data-theme="dark"] .bg-gray-200   { background-color: #334155; }

/* Overlays translúcidos: en dark un velo blanco (p.ej. el de carga al cambiar
   de día) da un fogonazo claro -> lo cambiamos por un velo oscuro. */
[data-theme="dark"] .bg-white\/50  { background-color: rgba(15, 23, 42, 0.6); }

/* Tintes/acentos suaves -> versiones translúcidas para que respiren */
[data-theme="dark"] .bg-green-100   { background-color: rgba(16, 185, 129, 0.16); }
[data-theme="dark"] .bg-emerald-50  { background-color: rgba(16, 185, 129, 0.12); }
[data-theme="dark"] .bg-emerald-100 { background-color: rgba(16, 185, 129, 0.18); }
[data-theme="dark"] .bg-red-50      { background-color: rgba(248, 113, 113, 0.14); }
[data-theme="dark"] .bg-red-100     { background-color: rgba(248, 113, 113, 0.18); }
[data-theme="dark"] .bg-amber-50    { background-color: rgba(251, 191, 36, 0.12); }

/* Sólidos de acento (badges, puntos, avatares de indicadores) se dejan tal
   cual: bg-green-500/600/700, bg-emerald-400/500, bg-red-400/500,
   bg-yellow-400, bg-gray-400/500 leen bien sobre fondo oscuro. */

/* -------------------------------------------------------------------------
   Texto (grises). Los acentos de color (green/emerald/red/yellow) se ajustan
   solo donde hace falta legibilidad.
   ------------------------------------------------------------------------- */
[data-theme="dark"] .text-gray-900 { color: #f1f5f9; }
[data-theme="dark"] .text-gray-800 { color: #e2e8f0; }
[data-theme="dark"] .text-gray-700 { color: #cbd5e1; }
[data-theme="dark"] .text-gray-600 { color: #9aa7ba; }
[data-theme="dark"] .text-gray-500 { color: #94a3b8; }
[data-theme="dark"] .text-gray-400 { color: #7c8aa0; }
[data-theme="dark"] .text-gray-300 { color: #64748b; }

/* Verdes oscuros (headings/acentos) -> aclarar para que destaquen en dark */
[data-theme="dark"] .text-emerald-800 { color: #6ee7b7; }
[data-theme="dark"] .text-emerald-600 { color: #34d399; }
[data-theme="dark"] .text-green-800   { color: #6ee7b7; }
[data-theme="dark"] .text-green-700   { color: #4ade80; }
[data-theme="dark"] .text-green-600   { color: #4ade80; }

/* -------------------------------------------------------------------------
   Bordes y divisores
   ------------------------------------------------------------------------- */
[data-theme="dark"] .border-gray-100 { border-color: #334155; }
[data-theme="dark"] .border-gray-200 { border-color: #334155; }
[data-theme="dark"] .border-gray-300 { border-color: #475569; }
[data-theme="dark"] .border-gray-400 { border-color: #475569; }
[data-theme="dark"] .divide-gray-100 > :not([hidden]) ~ :not([hidden]) { border-color: #334155; }

/* -------------------------------------------------------------------------
   Sombras y tarjetas: en dark las sombras claras desaparecen -> reforzamos
   con sombra negra suave + un borde sutil en las cards.
   ------------------------------------------------------------------------- */
[data-theme="dark"] .shadow,
[data-theme="dark"] .shadow-sm,
[data-theme="dark"] .shadow-md,
[data-theme="dark"] .shadow-lg,
[data-theme="dark"] .shadow-soft {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .card-match {
    border: 1px solid #243044;
}

/* LIVE · cabecera de la tarjeta de partido. El HTML base usa una cabecera
   clara; aquí la llevamos al tono oscuro de la vista live sin afectar light. */
[data-theme="dark"] .live-match-header {
    background: #0b1220;
    border-color: rgba(16, 185, 129, 0.35);
    color: #f8fafc;
}
[data-theme="dark"] .live-match-league-name,
[data-theme="dark"] .live-match-team-name,
[data-theme="dark"] .live-match-score {
    color: #f8fafc;
}
[data-theme="dark"] .live-match-score-separator,
[data-theme="dark"] .live-match-action {
    color: #94a3b8;
}
[data-theme="dark"] .live-match-action:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #6ee7b7;
}
[data-theme="dark"] .live-match-crest {
    background-color: #f8fafc;
}

/* -------------------------------------------------------------------------
   Estados :hover -> hay que re-declararlos porque comparten especificidad
   con las utilidades hover de Tailwind y, al cargar después, las pisarían
   dejando el hover "muerto". Aquí ganamos por specificidad ([data-theme]).
   ------------------------------------------------------------------------- */
[data-theme="dark"] .hover\:bg-emerald-50:hover     { background-color: #1e3a32; }
[data-theme="dark"] .hover\:bg-emerald-50\/50:hover { background-color: #1e3a32; }
/* Hover de fila en tablas con 1ª columna FIJA (sticky): esa celda usa
   group-hover:bg-emerald-50 y debe quedar OPACA y del mismo tono que el resto
   de la fila (si no, se veía verde claro mientras la fila iba en verde oscuro). */
[data-theme="dark"] .group:hover .group-hover\:bg-emerald-50 { background-color: #1e3a32; }
[data-theme="dark"] .hover\:bg-green-100:hover  { background-color: rgba(16, 185, 129, 0.22); }
[data-theme="dark"] .hover\:bg-gray-50:hover    { background-color: #273349; }
[data-theme="dark"] .hover\:bg-gray-100:hover   { background-color: #2f3d52; }
[data-theme="dark"] .hover\:bg-gray-200:hover   { background-color: #3a4a63; }

[data-theme="dark"] .hover\:text-gray-700:hover    { color: #e2e8f0; }
[data-theme="dark"] .hover\:text-emerald-600:hover { color: #34d399; }
[data-theme="dark"] .hover\:text-green-600:hover   { color: #4ade80; }
[data-theme="dark"] .hover\:text-green-700:hover   { color: #4ade80; }

[data-theme="dark"] .hover\:border-gray-300:hover { border-color: #475569; }
[data-theme="dark"] .hover\:border-emerald-200:hover { border-color: rgba(52, 211, 153, 0.42); }

/* -------------------------------------------------------------------------
   Transición suave al alternar tema (solo superficies/texto/borde clave para
   no meter jank en todo el árbol).
   ------------------------------------------------------------------------- */
[data-theme="dark"],
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-100,
[data-theme="dark"] .bg-gray-200,
[data-theme="dark"] .card-match {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* =========================================================================
   HOSTS DE SECCIÓN (canvas)
   Wrappers de sección con fondo propio opaco en claro (bg-gray-100/50). En
   dark los igualamos al canvas oscuro. Va DESPUÉS de las superficies para
   ganar por orden de fuente a .bg-gray-50/.bg-gray-100 en el mismo nodo.
   Añadir la clase .theme-canvas a la raíz de cada sección con fondo propio.
   ------------------------------------------------------------------------- */
[data-theme="dark"] .theme-canvas {
    background-color: #0f172a;
}

/* =========================================================================
   UTILIDADES ADICIONALES (introducidas por TENDENCIAS, pero comunes/reusables)
   ========================================================================= */

/* Superficies extra */
[data-theme="dark"] .bg-gray-300    { background-color: #475569; }
[data-theme="dark"] .bg-emerald-200 { background-color: rgba(16, 185, 129, 0.22); }
[data-theme="dark"] .bg-green-50    { background-color: rgba(16, 185, 129, 0.10); }
[data-theme="dark"] .bg-yellow-100  { background-color: rgba(234, 179, 8, 0.16); }
[data-theme="dark"] .bg-blue-100    { background-color: rgba(59, 130, 246, 0.18); }
[data-theme="dark"] .bg-blue-50     { background-color: rgba(59, 130, 246, 0.12); }
[data-theme="dark"] .bg-purple-100  { background-color: rgba(168, 85, 247, 0.18); }

/* Texto de acento oscuro -> aclarar para contraste sobre fondo dark */
[data-theme="dark"] .text-emerald-700 { color: #34d399; }
[data-theme="dark"] .text-green-700   { color: #4ade80; }
[data-theme="dark"] .text-yellow-700  { color: #facc15; }
[data-theme="dark"] .text-red-700     { color: #f87171; }
[data-theme="dark"] .text-blue-900    { color: #dbeafe; }
[data-theme="dark"] .text-blue-800    { color: #93c5fd; }
[data-theme="dark"] .text-blue-700    { color: #60a5fa; }
[data-theme="dark"] .text-blue-600    { color: #60a5fa; }
[data-theme="dark"] .text-purple-700  { color: #c084fc; }

/* Bordes de acento suave */
[data-theme="dark"] .border-blue-100  { border-color: rgba(59, 130, 246, 0.35); }
[data-theme="dark"] .border-blue-200  { border-color: rgba(96, 165, 250, 0.45); }
[data-theme="dark"] .border-green-200 { border-color: rgba(16, 185, 129, 0.30); }
[data-theme="dark"] .border-emerald-200 { border-color: rgba(52, 211, 153, 0.32); }
[data-theme="dark"] .border-emerald-300 { border-color: rgba(52, 211, 153, 0.48); }
[data-theme="dark"] .border-emerald-400 { border-color: rgba(52, 211, 153, 0.68); }

/* Extras del listado de ligas */
[data-theme="dark"] .divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: #334155; }
[data-theme="dark"] .hover\:bg-green-50:hover { background-color: rgba(16, 185, 129, 0.12); }

/* Hover extra */
[data-theme="dark"] .hover\:bg-gray-300:hover { background-color: #475569; }

/* Gradientes claros (p.ej. banners from-gray-50 to-emerald-50) -> oscurecer
   sobreescribiendo las custom properties que genera Tailwind. */
[data-theme="dark"] .from-gray-50 {
    --tw-gradient-from: #1e293b var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(30 41 59 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
[data-theme="dark"] .to-emerald-50 {
    --tw-gradient-to: rgba(16, 185, 129, 0.12) var(--tw-gradient-to-position);
}

/* =========================================================================
   FORMULARIOS · inputs/selects/textarea legibles en dark (común a todo)
   Solo campos de texto: no tocamos checkbox/radio/range.
   ========================================================================= */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input:not([type]),
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #64748b;
}

/* =========================================================================
   HOME / portada (y utilidades comunes que introduce)
   ========================================================================= */

/* Superficies/elementos medios */
[data-theme="dark"] .bg-gray-400 { background-color: #475569; }
[data-theme="dark"] .bg-gray-500 { background-color: #64748b; }

/* Texto de acento adicional */
[data-theme="dark"] .text-red-600    { color: #f87171; }
[data-theme="dark"] .text-purple-600 { color: #c084fc; }
[data-theme="dark"] .text-amber-700  { color: #fbbf24; }

/* Bordes / anillos (focus rings) */
[data-theme="dark"] .border-emerald-100 { border-color: rgba(16, 185, 129, 0.25); }
[data-theme="dark"] .ring-gray-200 { --tw-ring-color: #334155; }
[data-theme="dark"] .ring-gray-300 { --tw-ring-color: #475569; }

/* Hover extra */
[data-theme="dark"] .hover\:bg-red-100:hover     { background-color: rgba(248, 113, 113, 0.18); }
[data-theme="dark"] .hover\:bg-white:hover       { background-color: #243044; }
[data-theme="dark"] .hover\:bg-emerald-200:hover { background-color: rgba(16, 185, 129, 0.25); }
[data-theme="dark"] .hover\:text-gray-600:hover  { color: #cbd5e1; }
[data-theme="dark"] .hover\:text-gray-500:hover  { color: #cbd5e1; }

/* Hover unificado de fila de partido (lo pone JS por grupo de partido; el
   <style> inline lo fuerza con !important). Lift neutral y sutil, en línea con
   el claro (que es un gris apenas perceptible). */
[data-theme="dark"] .match-row.hover-active { background-color: #273345 !important; }

/* Fondos translúcidos verdes (home y estados seleccionados del onboarding).
   En dark los /NN claros se ven lavados -> versiones oscuras del mismo tono. */
[data-theme="dark"] .bg-emerald-50\/50 { background-color: rgba(16, 185, 129, 0.14); }
[data-theme="dark"] .bg-emerald-50\/60 { background-color: rgba(16, 185, 129, 0.15); }
[data-theme="dark"] .bg-emerald-50\/70 { background-color: rgba(16, 185, 129, 0.16); }
[data-theme="dark"] .bg-emerald-50\/80 { background-color: rgba(16, 185, 129, 0.16); }
[data-theme="dark"] .bg-gray-50\/50    { background-color: rgba(30, 41, 59, 0.55); }

/* Gradientes claros de la home -> oscurecer las custom properties de Tailwind.
   Promo: from-emerald-50 via-white to-blue-50 | Cabecera liga: from-emerald-50 to-white */
[data-theme="dark"] .from-emerald-50 {
    --tw-gradient-from: #0f2a22 var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(15 42 34 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
[data-theme="dark"] .via-white {
    --tw-gradient-to: rgb(30 41 59 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), #1e293b var(--tw-gradient-via-position), var(--tw-gradient-to);
}
[data-theme="dark"] .to-white   { --tw-gradient-to: #1e293b var(--tw-gradient-to-position); }
[data-theme="dark"] .to-blue-50 { --tw-gradient-to: #0f1f3a var(--tw-gradient-to-position); }

/* =========================================================================
   APERCIBIDOS / disciplina
   ========================================================================= */
[data-theme="dark"] .bg-yellow-50    { background-color: rgba(234, 179, 8, 0.12); }
[data-theme="dark"] .text-yellow-800 { color: #fde047; }
[data-theme="dark"] .border-red-200    { border-color: rgba(248, 113, 113, 0.30); }
[data-theme="dark"] .border-yellow-200 { border-color: rgba(234, 179, 8, 0.30); }
[data-theme="dark"] .hover\:bg-yellow-100:hover { background-color: rgba(234, 179, 8, 0.16); }

/* Borde inferior de las .player-card en móvil (un <style> inline lo fija claro
   con !important) -> en dark, borde oscuro. */
@media (max-width: 639px) {
    [data-theme="dark"] .player-card { border-bottom-color: #334155 !important; }
}

/* Fallback para <select> nativos: opciones oscuras (evita texto claro sobre
   fondo blanco del sistema). */
[data-theme="dark"] select option {
    background-color: #1e293b;
    color: #e2e8f0;
}

/* =========================================================================
   SELECT2 (tema "default") en DARK
   Select2 sustituye el <select> por su propio DOM (caja + pills + panel), que
   no usa utilidades Tailwind -> se quedaba blanco ("blanco sobre blanco").
   El panel se inyecta en <body>, pero data-theme va en <html>, así que lo
   cubrimos igual. Vale para los filtros de árbitro y los modales de stats.
   ========================================================================= */

/* Caja de selección (single + multiple) */
[data-theme="dark"] .select2-container--default .select2-selection--single,
[data-theme="dark"] .select2-container--default .select2-selection--multiple {
    background-color: #0c1813 !important;
    border-color: #344a3e !important;
}
[data-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--single,
[data-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #10b981;
}
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #dfeae4;
}
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #91a39a;
}
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #91a39a transparent transparent transparent;
}

/* Pills (selección múltiple). Select2 4.1 mete el texto en __choice__display y
   pinta el fondo en el <li> -> forzamos ambos con !important para que no quede
   "blanco sobre blanco" al seleccionar varias opciones. */
[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #173126 !important;
    border-color: #355344 !important;
    color: #dfeae4 !important;
}
[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    color: #dfeae4 !important;
}
[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #91a39a;
}
[data-theme="dark"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background-color: transparent;
    color: #f0f8f4;
}
[data-theme="dark"] .select2-container--default .select2-search--inline .select2-search__field {
    color: #dfeae4;
}

/* Panel desplegable */
[data-theme="dark"] .select2-dropdown {
    background-color: #0c1813 !important;
    border-color: #344a3e !important;
}
[data-theme="dark"] .select2-results__option {
    color: #c5d5cc;
}
[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected],
[data-theme="dark"] .select2-container--default .select2-results__option--highlighted {
    background-color: #14372a !important;
    color: #f0f8f4 !important;
}
[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #173126 !important;
    color: #dfeae4 !important;
}
[data-theme="dark"] .select2-results__option[aria-disabled="true"] {
    color: #607269;
}

/* Buscador dentro del dropdown */
[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: #08130f;
    border-color: #344a3e;
    color: #dfeae4;
}

/* =========================================================================
   FICHA DE PARTIDO (fixture_v2/show_unified + pestañas)
   ========================================================================= */

/* Canvas del shell (clase única -> no necesita .theme-canvas). Además anula el
   <style> inline que en MÓVIL forzaba .fixture-v2-app-shell { background:#fff }
   (la ficha entera se ponía blanca en móvil). */
[data-theme="dark"] .fixture-v2-app-shell { background-color: #0f172a; }

/* Pills y opciones del overlay sobre el campo (vienen de <style> inline con
   blancos literales). */
[data-theme="dark"] .lineup-ui-pill { background: rgba(15, 23, 42, 0.92); color: #e2e8f0; }

/* Utilidades de color nuevas de la ficha */
[data-theme="dark"] .text-blue-500   { color: #60a5fa; }
[data-theme="dark"] .text-purple-500 { color: #c084fc; }
[data-theme="dark"] .text-amber-600  { color: #fbbf24; }
[data-theme="dark"] .text-amber-500  { color: #fbbf24; }
[data-theme="dark"] .ring-gray-100    { --tw-ring-color: #334155; }
[data-theme="dark"] .ring-emerald-200 { --tw-ring-color: rgba(16, 185, 129, 0.30); }
[data-theme="dark"] .ring-emerald-300 { --tw-ring-color: rgba(52, 211, 153, 0.42); }
[data-theme="dark"] .group:hover .group-hover\:text-emerald-600 { color: #34d399; }
[data-theme="dark"] .hover\:text-purple-800:hover { color: #c084fc; }

/* Fondos translúcidos claros -> versiones oscuras */
[data-theme="dark"] .bg-purple-50\/50 { background-color: rgba(168, 85, 247, 0.12); }
[data-theme="dark"] .bg-red-50\/50    { background-color: rgba(248, 113, 113, 0.12); }
[data-theme="dark"] .bg-blue-50\/50   { background-color: rgba(59, 130, 246, 0.12); }
[data-theme="dark"] .bg-gray-50\/60   { background-color: rgba(30, 41, 59, 0.6); }
[data-theme="dark"] .bg-gray-50\/70   { background-color: rgba(30, 41, 59, 0.7); }

/* Gradientes claros de la ficha -> oscurecer custom-props de Tailwind.
   (from-gray-50, from-emerald-50, to-white, to-blue-50, via-white ya estaban) */
[data-theme="dark"] .from-gray-100,
[data-theme="dark"] .from-slate-100,
[data-theme="dark"] .from-slate-50 {
    --tw-gradient-from: #1e293b var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(30 41 59 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
[data-theme="dark"] .from-gray-100\/40 {
    --tw-gradient-from: rgb(30 41 59 / 0.4) var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(30 41 59 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
[data-theme="dark"] .from-purple-50 {
    --tw-gradient-from: #251a36 var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(37 26 54 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
[data-theme="dark"] .from-blue-50 {
    --tw-gradient-from: #0f1f3a var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(15 31 58 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
[data-theme="dark"] .from-amber-50,
[data-theme="dark"] .from-yellow-50 {
    --tw-gradient-from: #2a2411 var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(42 36 17 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
[data-theme="dark"] .to-gray-50,
[data-theme="dark"] .to-gray-100  { --tw-gradient-to: #1e293b var(--tw-gradient-to-position); }
[data-theme="dark"] .to-sky-50    { --tw-gradient-to: #0f2233 var(--tw-gradient-to-position); }
[data-theme="dark"] .to-amber-50  { --tw-gradient-to: #2a2411 var(--tw-gradient-to-position); }
[data-theme="dark"] .to-indigo-50 { --tw-gradient-to: #1a1f3d var(--tw-gradient-to-position); }
[data-theme="dark"] .via-gray-50 {
    --tw-gradient-to: rgb(30 41 59 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), #1e293b var(--tw-gradient-via-position), var(--tw-gradient-to);
}
[data-theme="dark"] .via-teal-50 {
    --tw-gradient-to: rgb(14 46 44 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), #0e2e2c var(--tw-gradient-via-position), var(--tw-gradient-to);
}

/* =========================================================================
   ALINEACIONES (iconos de columna) + RIVALES (opponents)
   ========================================================================= */

/* Iconos de stats de las tablas de alineaciones: PNGs monocromos negros
   (/assets/images/icons/*.png) -> invisibles sobre fondo oscuro. Los invertimos
   a blanco. Los escudos de equipo / fotos van por otra ruta y NO se tocan. */
[data-theme="dark"] img[src*="/assets/images/icons/"]:not([src*="yellowCard"]):not([src*="redCard"]) {
    filter: invert(1);
}

/* Rivales: botones de filtro (ubicación/equipo) activos usan ring-green-200 */
[data-theme="dark"] .ring-green-200 { --tw-ring-color: rgba(34, 197, 94, 0.35); }

/* Rivales: resultado (partial _opponents_results) -> tarjeta con gradiente verde
   claro from-green-50/to-green-50, border-green-100 y text-green-900. */
[data-theme="dark"] .text-green-900   { color: #6ee7b7; }
[data-theme="dark"] .border-green-100 { border-color: rgba(34, 197, 94, 0.22); }
[data-theme="dark"] .from-green-50 {
    --tw-gradient-from: #122b1e var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(18 43 30 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
[data-theme="dark"] .to-green-50 { --tw-gradient-to: #122b1e var(--tw-gradient-to-position); }

/* =========================================================================
   PREVIA / predicciones prematch
   ========================================================================= */
/* Cajitas de "marcadores más probables" -> usan bg-sky-50 (se veían blancas). */
[data-theme="dark"] .bg-sky-50      { background-color: rgba(56, 189, 248, 0.10); }
[data-theme="dark"] .text-sky-600   { color: #38bdf8; }
[data-theme="dark"] .ring-amber-200 { --tw-ring-color: rgba(251, 191, 36, 0.30); }

/* =========================================================================
   OVERLAYS / backdrops de modales
   El backdrop estándar del sitio es .bg-gray-500.bg-opacity-75 (filtros de
   equipo/jugador/árbitro, paneles de leyenda, modales...). Mi override sólido
   de .bg-gray-500 lo volvía OPACO y tapaba toda la pantalla; aquí lo devolvemos
   a un velo OSCURO translúcido. (Selector combinado -> gana a .bg-gray-500.)
   ========================================================================= */
[data-theme="dark"] .bg-gray-500.bg-opacity-75 {
    background-color: rgba(2, 6, 23, 0.70);
}

/* Utilidades slate (tab de análisis de equipo, generada por JS) */
[data-theme="dark"] .text-slate-600 { color: #9aa7ba; }
[data-theme="dark"] .text-slate-400 { color: #7c8aa0; }
[data-theme="dark"] .bg-slate-400   { background-color: #475569; }

/* Overlays de carga de los análisis inline. Ambos llevan un velo blanco inline,
   por eso necesitan !important para integrarse con el canvas oscuro. */
[data-theme="dark"] :is(#teamInlineLoadingOverlay, #inlineLoadingOverlay) {
    background: rgba(4, 15, 10, .78) !important;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

[data-theme="dark"] :is(#teamInlineLoadingOverlay, #inlineLoadingOverlay) > div {
    border-color: #2c473a !important;
    border-radius: .34rem !important;
    background: #0f2119 !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .28) !important;
}

[data-theme="dark"] :is(#teamInlineLoadingOverlay, #inlineLoadingOverlay) > div > span {
    color: #dfeae4 !important;
}

[data-theme="dark"] :is(#teamInlineLoadingOverlay, #inlineLoadingOverlay) .animate-spin {
    border-color: #34d399 !important;
    border-top-color: transparent !important;
}

/* Cabecera de sub-tabs del análisis (Resumen / vs Rival / Resultados):
   bg-gradient-to-r from-emerald-50/60 to-white -> oscurecer el stop claro. */
[data-theme="dark"] .from-emerald-50\/60 {
    --tw-gradient-from: rgb(15 42 34 / 0.6) var(--tw-gradient-from-position);
    --tw-gradient-to: rgb(15 42 34 / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

/* text-black (p.ej. minutos jugados del jugador en stats_by_player, sobre las
   barras) -> en negro era invisible sobre fondo oscuro. */
[data-theme="dark"] .text-black { color: #e2e8f0; }
[data-theme="dark"] .group:hover .group-hover\:text-black { color: #e2e8f0; }

/* Overlay de carga del modal de stats de jugador (#loadingOverlay): usa
   bg-white bg-opacity-90 -> velo oscuro en dark (el id gana en specificidad). */
[data-theme="dark"] #loadingOverlay {
    background-color: rgba(15, 23, 42, 0.92);
}

/* Lista "vs Equipo" del análisis de jugador: las cajitas de valores
   (.bg-green-100, sin clase de texto) heredaban texto oscuro -> invisible. */
[data-theme="dark"] #vsTeamList .bg-green-100 { color: #6ee7b7; }

/* Modales de stats (jugador/equipo): el <style> inyectado fija .modal con
   `background: white` literal y alta specificidad (#statsModal .modal), que mis
   overrides de bg-white no pisaban. En desktop el contenedor del gráfico es
   transparent y dejaba ver ese blanco (se notaba al cambiar de stat). */
[data-theme="dark"] .modal { background-color: #1e293b !important; }

/* Sección estadísticas (equipo): border-black era invisible en dark, y el
   group-hover:bg-emerald-50 no estaba cubierto (solo el hover normal). */
[data-theme="dark"] .border-black { border-color: #475569; }
[data-theme="dark"] .group:hover .group-hover\:bg-emerald-50 { background-color: #1e3a32; }

/* Selectores segmentados de suscripción y periodo. Ambos usan fondos blancos
   para marcar la opción activa en claro; en dark les damos superficies y
   estados propios para conservar el contraste sin depender de overrides
   genéricos de utilidades. */
[data-theme="dark"] .subscription-plan-switch {
    background-color: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .subscription-plan-option {
    color: #94a3b8;
}
[data-theme="dark"] .subscription-plan-option:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: #f8fafc;
}
[data-theme="dark"] .subscription-plan-option--monthly[aria-pressed="true"] {
    background-color: #f8fafc;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(2, 6, 23, 0.35);
}
[data-theme="dark"] .subscription-plan-option--annual[aria-pressed="true"] {
    background-color: #34d399;
    color: #052e16;
    box-shadow: 0 1px 3px rgba(2, 6, 23, 0.35);
}

[data-theme="dark"] .team-period-switch {
    background-color: #0f172a;
    box-shadow: inset 0 0 0 1px #334155;
}
[data-theme="dark"] .team-period-option {
    color: #94a3b8;
}
[data-theme="dark"] .team-period-option:hover {
    background-color: #243044;
    color: #e2e8f0;
}
[data-theme="dark"] .team-period-option[aria-current="page"] {
    background-color: #1e293b;
    color: #6ee7b7;
    box-shadow: 0 1px 3px rgba(2, 6, 23, 0.55), inset 0 0 0 1px #475569;
}

/* =========================================================================
   DESPLEGABLES de la top bar (.dropdown-menu / .dropdown-item de base.css con
   fondo blanco fijo -> no los pisaban los overrides de utilidades). Menú de
   usuario y "disciplina" en desktop. (El de móvil usa bg-white y ya iba dark.)
   ========================================================================= */
[data-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .dropdown-item { color: #cbd5e1; }
[data-theme="dark"] .dropdown-item:hover { background-color: #334155; }

/* =========================================================================
   PALETA "primary" (verde de marca, escala aparte de emerald/green; usada en
   todo el sitio: activo del menú de ajustes, enlaces, etc.). Mapeamos los
   fondos/textos/bordes CLAROS a versiones dark. Los sólidos de acento
   (bg-primary-500/600, hover:bg-primary-700, border/ring-primary-300..500) se
   dejan: son verde de marca y leen bien sobre oscuro.
   ========================================================================= */
[data-theme="dark"] .bg-primary-50  { background-color: rgba(16, 185, 129, 0.12); }
[data-theme="dark"] .bg-primary-100 { background-color: rgba(16, 185, 129, 0.18); }
[data-theme="dark"] .text-primary-500 { color: #34d399; }
[data-theme="dark"] .text-primary-600 { color: #4ade80; }
[data-theme="dark"] .text-primary-700 { color: #6ee7b7; }
[data-theme="dark"] .text-primary-800 { color: #6ee7b7; }
[data-theme="dark"] .border-primary-100 { border-color: rgba(16, 185, 129, 0.25); }
[data-theme="dark"] .border-primary-200 { border-color: rgba(16, 185, 129, 0.30); }
[data-theme="dark"] .ring-primary-100 { --tw-ring-color: rgba(16, 185, 129, 0.25); }
[data-theme="dark"] .hover\:bg-primary-100:hover { background-color: rgba(16, 185, 129, 0.18); }
[data-theme="dark"] .hover\:text-primary-500:hover { color: #34d399; }
[data-theme="dark"] .hover\:text-primary-600:hover { color: #4ade80; }
[data-theme="dark"] .hover\:text-primary-700:hover { color: #6ee7b7; }

/* =========================================================================
   Tab "Equipos" de la liga (_global_stats_content): un <style> inline define
   .bg-gray-25 (#fafafa, filas alternas casi blancas) y un scrollbar claro.
   ========================================================================= */
[data-theme="dark"] .bg-gray-25 { background-color: #1b2532; }
/* Tab "Jugadores" de la liga: filas pares con bg-gray-50/30 (translúcido claro)
   -> quedaban claras y el hover parecía oscurecer en vez de resaltar. */
[data-theme="dark"] .bg-gray-50\/30 { background-color: rgba(30, 41, 59, 0.3); }

/* =========================================================================
   PALETA "slate" (landing del mundial: secciones de contenido claras + wrapper
   bg-slate-50). El héroe oscuro (text-white, bg-white/10..20, ámbar, gradiente
   emerald-900, bg-slate-900) se deja: ya es oscuro por diseño.
   (text-slate-600/400 y bg-slate-400 ya estaban en la sección de análisis.)
   ========================================================================= */
[data-theme="dark"] .bg-slate-50  { background-color: #15202e; }
[data-theme="dark"] .bg-slate-100 { background-color: #243044; }
[data-theme="dark"] .bg-slate-200 { background-color: #334155; }
[data-theme="dark"] .text-slate-900 { color: #f1f5f9; }
[data-theme="dark"] .text-slate-800 { color: #e2e8f0; }
[data-theme="dark"] .text-slate-700 { color: #cbd5e1; }
[data-theme="dark"] .text-slate-500 { color: #94a3b8; }
[data-theme="dark"] .text-slate-300 { color: #64748b; }
[data-theme="dark"] .border-slate-100 { border-color: #334155; }
[data-theme="dark"] .border-slate-200 { border-color: #334155; }
[data-theme="dark"] .ring-slate-200 { --tw-ring-color: #334155; }
[data-theme="dark"] .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: #334155; }
[data-theme="dark"] .hover\:bg-slate-50:hover { background-color: #273349; }

/* Tarjeta "frosted" (bg-white/80) de la sección de goleadores bloqueada. */
[data-theme="dark"] .bg-white\/80 { background-color: rgba(30, 41, 59, 0.8); }
[data-theme="dark"] .overflow-x-auto { scrollbar-color: #475569 #1e293b; }
[data-theme="dark"] .overflow-x-auto::-webkit-scrollbar-track { background: #1e293b; }
[data-theme="dark"] .overflow-x-auto::-webkit-scrollbar-thumb { background: #475569; }
[data-theme="dark"] .overflow-x-auto::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* =========================================================================
   PROMO flotante de registro/suscripción
   Superficie y contraste propios para que destaque sobre cualquier página,
   también cuando el tema global está en oscuro.
   ========================================================================= */
[data-theme="dark"] .subscription-promo-card {
    background-color: rgba(15, 23, 42, 0.96);
    border-color: #34d399;
    box-shadow: 0 18px 55px rgba(2, 6, 23, 0.62), 0 0 0 1px rgba(52, 211, 153, 0.18);
}
[data-theme="dark"] .subscription-promo-icon {
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.24);
}
[data-theme="dark"] .subscription-promo-title { color: #f8fafc; }
[data-theme="dark"] .subscription-promo-description { color: #cbd5e1; }
[data-theme="dark"] .subscription-promo-cta {
    background-color: #10b981;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.22);
}
[data-theme="dark"] .subscription-promo-cta:hover { background-color: #059669; }
[data-theme="dark"] .subscription-promo-close { color: #94a3b8; }
[data-theme="dark"] .subscription-promo-close:hover {
    background-color: rgba(52, 211, 153, 0.14);
    color: #6ee7b7;
}

/* Consentimiento comercial: tarjeta presente en onboarding y preferencias. */
[data-theme="dark"] .marketing-consent-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.13), rgba(15, 23, 42, 0.38));
    border-color: rgba(52, 211, 153, 0.50);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
[data-theme="dark"] .marketing-consent-title { color: #f1f5f9; }
[data-theme="dark"] .marketing-consent-description { color: #a8b5c7; }
[data-theme="dark"] .marketing-consent-link { color: #6ee7b7; }
[data-theme="dark"] .marketing-consent-link:hover { color: #a7f3d0; }

/* -------------------------------------------------------------------------
   Páginas legales y de texto largo

   Tailwind Typography aplica el color en los descendientes de .prose, por lo
   que las reglas genéricas de utilidades no bastan para términos, privacidad
   y cookies. Este bloque mantiene el contraste de todo el contenido legal.
   ------------------------------------------------------------------------- */
[data-theme="dark"] .legal-page .bg-white {
    border: 1px solid #334155;
}

[data-theme="dark"] .legal-content,
[data-theme="dark"] .legal-content p,
[data-theme="dark"] .legal-content li,
[data-theme="dark"] .legal-content blockquote {
    color: #cbd5e1;
}

[data-theme="dark"] .legal-content h1,
[data-theme="dark"] .legal-content h2,
[data-theme="dark"] .legal-content h3,
[data-theme="dark"] .legal-content h4,
[data-theme="dark"] .legal-content strong {
    color: #f1f5f9;
}

[data-theme="dark"] .legal-content a {
    color: #4ade80;
}

[data-theme="dark"] .legal-content a:hover {
    color: #86efac;
}

[data-theme="dark"] .legal-content hr {
    border-color: #334155;
}
[data-theme="dark"] .marketing-consent-checkbox {
    background-color: #0f172a;
    border-color: #64748b;
}
[data-theme="dark"] .marketing-consent-checkbox:checked {
    background-color: #10b981;
    border-color: #10b981;
}
