/* ══════════════════════════════════════════════════════════════════
   MODO OSCURO DE FLOWY (23 oct 2026)
   Solo actúa cuando el body tiene la clase .fw-dark (la pone app.js
   con el botón luna/sol). El modo claro no se toca.
   Para desactivarlo del todo: quitar el <link> de dark.css en index.html.
   ══════════════════════════════════════════════════════════════════ */

/* 1. Variables globales en oscuro */
body.fw-dark{
  --bg:#0d1117;--bg2:#161b26;--bg3:#1e2533;
  --border:#2a3243;--border2:#38425a;
  --text:#e6e9f2;--muted:#9aa3b8;--muted2:#6b7489;
  --blue3:rgba(59,130,246,.16);--blue4:rgba(59,130,246,.26);
  --green:#34d399;--green-bg:rgba(16,185,129,.15);
  --red:#f87171;--red-bg:rgba(239,68,68,.15);
  --orange:#fb923c;--orange-bg:rgba(249,115,22,.15);
  --gold:#fbbf24;--gold-bg:rgba(245,158,11,.15);
  background:var(--bg);color:var(--text);color-scheme:dark;
}
body.fw-dark .admin-corp{
  --adm-bg:#0d1117;--adm-bg-card:#161b26;--adm-sidebar:#0a0f18;
  --adm-text:#e6e9f2;--adm-text-mut:#9aa3b8;--adm-border:#2a3243;
  --adm-blue:#7b9cf2;--adm-blue-bg:rgba(47,95,219,.2);
  --adm-green:#34d399;--adm-green-bg:rgba(31,157,85,.18);
  --adm-amber:#fbbf24;--adm-amber-bg:rgba(185,137,0,.18);
  --adm-red:#f87171;--adm-red-bg:rgba(198,45,59,.18);
}

/* 2. Reglas de style.css que tenían blanco fijo */
body.fw-dark .stat-card-v2,
body.fw-dark .acc-card-v2,
body.fw-dark .table-wrap table tr,
body.fw-dark .log-track-selector,
body.fw-dark .log-track-side-input{background:var(--bg2);box-shadow:none;}
body.fw-dark .stat-card-v2 .sc-value{color:var(--text);}
body.fw-dark .stat-card-v2 .sc-label,
body.fw-dark .stat-card-v2 .sc-sub{color:var(--muted);}
body.fw-dark .alert-gold{border-color:rgba(245,158,11,.35);}
body.fw-dark .alert-red{border-color:rgba(239,68,68,.35);}
body.fw-dark .vc2-alert{border-color:rgba(249,115,22,.35);}
body.fw-dark .btn-outline-red:hover{background:rgba(239,68,68,.2);}

/* 3. Colores escritos directamente en las pantallas (style="...").
   El !important es necesario para ganarle al estilo en línea.
   Las imágenes y los logos de ML/Amazon se dejan con su fondo blanco. */

/* Fondos blancos → tarjeta oscura */
body.fw-dark [style*="background:#fff"]:not(img),
body.fw-dark [style*="background: #fff"]:not(img),
body.fw-dark [style*="background:white"]:not(img),
body.fw-dark [style*="background-color:#fff"]:not(img){background:var(--bg2) !important;}
/* Los logos de Mercado Libre y Amazon necesitan fondo blanco */
html body.fw-dark #badge-ml,html body.fw-dark #badge-scraper{background:#fff !important;}

/* Fondos grises muy claros → fondo de sección */
body.fw-dark [style*="background:#f8fafc"],body.fw-dark [style*="background:#f5f7fb"],
body.fw-dark [style*="background:#f1f5f9"],body.fw-dark [style*="background:#fafafa"],
body.fw-dark [style*="background:#eef1f6"],body.fw-dark [style*="background:#fafbfd"],
body.fw-dark [style*="background:#f7f9fc"],body.fw-dark [style*="background:#f7f7f7"],
body.fw-dark [style*="background:#f5f5f5"],body.fw-dark [style*="background:#f5f8ff"],
body.fw-dark [style*="background:#f5f6fa"],body.fw-dark [style*="background:#eef0f7"]{background:var(--bg3) !important;}

/* Tintes suaves → mismo color, versión oscura (van después del blanco para ganarle) */
html body.fw-dark [style*="background:#eff6ff"],html body.fw-dark [style*="background:#eef4ff"],
html body.fw-dark [style*="background:#eef2ff"],html body.fw-dark [style*="background:#eaf4ff"],
html body.fw-dark [style*="background:#ecfeff"],html body.fw-dark [style*="background:#dbeafe"],
html body.fw-dark [style*="background:#f5f3ff"]{background:rgba(59,130,246,.16) !important;}
html body.fw-dark [style*="background:#ecfdf5"],html body.fw-dark [style*="background:#ecfdf3"],
html body.fw-dark [style*="background:#f0fdf4"],html body.fw-dark [style*="background:#dcfce7"],
html body.fw-dark [style*="background:#d1fae5"]{background:rgba(16,185,129,.16) !important;}
html body.fw-dark [style*="background:#fef2f2"],html body.fw-dark [style*="background:#fff5f5"],
html body.fw-dark [style*="background:#fee2e2"]{background:rgba(239,68,68,.16) !important;}
html body.fw-dark [style*="background:#fff7ed"],html body.fw-dark [style*="background:#fffaf0"],
html body.fw-dark [style*="background:#fffbeb"],html body.fw-dark [style*="background:#fffbe6"],
html body.fw-dark [style*="background:#fef3c7"],html body.fw-dark [style*="background:#fff7cc"]{background:rgba(245,158,11,.16) !important;}

/* Textos oscuros → texto claro */
body.fw-dark [style*="color:#0f172a"],body.fw-dark [style*="color:#1e293b"],
body.fw-dark [style*="color:#1a1f36"],body.fw-dark [style*="color:#111827"],
body.fw-dark [style*="color:#334155"],body.fw-dark [style*="color:#374151"],
body.fw-dark [style*="color:#1e2530"],body.fw-dark [style*="color:#2d3277"]{color:var(--text) !important;}
body.fw-dark [style*="color:#475569"],body.fw-dark [style*="color:#4b5563"],
body.fw-dark [style*="color:#64748b"],body.fw-dark [style*="color:#6b7194"],
body.fw-dark [style*="color:#6b7280"]{color:var(--muted) !important;}
/* Los azules muy oscuros se pierden sobre fondo oscuro */
body.fw-dark [style*="color:#1d4ed8"],body.fw-dark [style*="color:#1e3a8a"]{color:#60a5fa !important;}

/* Bordes claros → borde oscuro */
body.fw-dark [style*="solid #e2e8f0"],body.fw-dark [style*="solid #f1f5f9"],
body.fw-dark [style*="solid #f1f4f9"],body.fw-dark [style*="solid #dfe6f0"],
body.fw-dark [style*="solid #e5e9f2"],body.fw-dark [style*="solid #eef2f7"],
body.fw-dark [style*="solid #eeeeee"],body.fw-dark [style*="solid #edf1f7"],
body.fw-dark [style*="solid #d9dee8"],body.fw-dark [style*="solid #d1d5db"],
body.fw-dark [style*="solid #cfd6e2"],body.fw-dark [style*="solid #cfd4dc"],
body.fw-dark [style*="solid #dbe6fe"],body.fw-dark [style*="solid #e3ecff"],
body.fw-dark [style*="solid #dbeafe"]{border-color:var(--border) !important;}

/* Sombras: en oscuro casi no se ven, se suavizan */
body.fw-dark .card,body.fw-dark .stat-card-v2{box-shadow:none;}

/* 4. Encabezado de Halloween (body.fw-hw) en oscuro */
body.fw-dark.fw-hw #hero-vendedor{background:linear-gradient(135deg,#172036 0%,#1b2a4a 60%,#1e3a8a 100%) !important;color:var(--text) !important;}
body.fw-dark .hw-frase{color:var(--muted) !important;}
body.fw-dark.fw-hw #hero-vendedor #ml-avatar{background:var(--bg2) !important;border-color:var(--border) !important;}

/* 5. Botón luna/sol */
#tema-btn i{transition:transform .25s ease;}
#tema-btn:hover i{transform:rotate(-20deg);}
