/* === UNLIMITPDF MASTER LIGHT MODE & UNIVERSAL CONTROLS (v4.8) === */

/* Controles universales de cabecera (Idioma + Día/Noche) */
.unlimit-ctrl-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.unlimit-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 700;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.2;
  white-space: nowrap;
}
.unlimit-theme-btn:hover {
  background: #334155;
  border-color: #60a5fa;
}
.unlimit-lang-select {
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 700;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f8fafc;
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}
.unlimit-lang-select:hover,
.unlimit-lang-select:focus {
  border-color: #3b82f6;
}
.unlimit-lang-select option {
  background: #0f172a;
  color: #f8fafc;
}
@media (max-width: 480px) {
  .unlimit-theme-btn .unlimit-theme-lbl { display: none; }
  .unlimit-theme-btn { padding: 5px 8px; }
  .unlimit-lang-select { padding: 5px 6px; font-size: 11px; }
}

/* Pastilla flotante discreta cuando se abre un Estudio a pantalla completa (Word / Imagen / Mesa) */
#unlimitOverlayQuickBar {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 95;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(71, 85, 105, 0.75);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}
body.light-mode #unlimitOverlayQuickBar {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.14) !important;
}

/* ==========================================================================
   MODO DÍA INTEGRAL (SIN MEZCLAS DE FONDOS OSCUROS NI TEXTOS PÁLIDOS)
   ========================================================================== */
body.light-mode,
body.light-mode[class*="bg-"] {
  background-color: #f1f5f9 !important;
  background-image: none !important;
  color: #0f172a !important;
}

/* 1. Cabeceras y pies de página */
body.light-mode header,
body.light-mode footer,
body.light-mode #legalFooterBar {
  background-color: rgba(255, 255, 255, 0.97) !important;
  background-image: none !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* 2. Contenedores oscuros (excluyendo backdrops translúcidos .fixed.inset-0 y selectores de tinta) */
body.light-mode :not(.fixed):is(
  [class*="bg-[#0"],
  [class*="bg-[#1"],
  [class*="bg-gray-900"],
  [class*="bg-slate-900"]
),
body.light-mode .fixed:not(.inset-0):is(
  [class*="bg-gray-900"],
  [class*="bg-slate-900"],
  [class*="bg-[#0"],
  [class*="bg-[#1"]
) {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Cajas anidadas profundas (bg-gray-950 / bg-slate-950) -> Gris perla suave */
body.light-mode :not(.fixed):is(
  [class*="bg-gray-950"],
  [class*="bg-slate-950"]
) {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Superficies secundarias (bg-gray-800 / bg-slate-800) */
body.light-mode :is(
  [class*="bg-gray-800"],
  [class*="bg-slate-800"]
):not(.unlimit-keep-dark) {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
body.light-mode button[class*="bg-gray-800"]:hover,
body.light-mode a[class*="bg-gray-800"]:hover,
body.light-mode [class*="hover:bg-gray-800"]:hover,
body.light-mode [class*="hover:bg-gray-700"]:hover {
  background-color: #e2e8f0 !important;
}

/* 3. CORRECCIÓN CRÍTICA DE DEGRADADOS OSCUROS (from-gray-900 / to-blue-950) */
body.light-mode [class*="from-gray-9"],
body.light-mode [class*="from-slate-9"],
body.light-mode [class*="from-gray-8"],
body.light-mode [class*="via-gray-9"],
body.light-mode [class*="to-gray-9"],
body.light-mode [class*="to-blue-950"],
body.light-mode [class*="to-indigo-950"],
body.light-mode [class*="to-emerald-950"] {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 58%, #eff6ff 100%) !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 10px 26px -8px rgba(15, 23, 42, 0.08) !important;
}

/* Mesa / Lienzo alrededor de folios PDF o Word para que destaque el papel blanco */
body.light-mode #pdfViewport,
body.light-mode #canvasScrollArea,
body.light-mode .pdf-desk-bg {
  background-color: #e2e8f0 !important;
}

/* Backdrops de modales (.fixed.inset-0): mantener velo oscuro suave translúcido */
body.light-mode .fixed.inset-0[class*="bg-black"] {
  background-color: rgba(15, 23, 42, 0.52) !important;
}

/* 4. Bordes oscuros -> Bordes nítidos de Modo Día */
body.light-mode [class*="border-gray-9"],
body.light-mode [class*="border-gray-8"],
body.light-mode [class*="border-gray-7"],
body.light-mode [class*="border-slate-8"],
body.light-mode [class*="border-slate-7"] {
  border-color: #cbd5e1 !important;
}

/* 5. TIPOGRAFÍA DE ALTO CONTRASTE (WCAG AA/AAA sobre blanco y gris perla) */
body.light-mode :is(h1, h2, h3, h4, h5, h6, .text-white, .text-gray-100, .text-slate-100):not(#wordPaperSheet *) {
  color: #0f172a !important;
}
body.light-mode :is(p, li, dd, dt, label, .text-gray-200, .text-gray-300, .text-slate-200, .text-slate-300):not(#wordPaperSheet *) {
  color: #1e293b !important;
}
body.light-mode :is(.text-gray-400, .text-gray-500, .text-slate-400, .text-slate-500):not(#wordPaperSheet *) {
  color: #475569 !important;
}

/* Colores de acento pastel oscurecidos para lectura nítida sobre fondo claro */
body.light-mode :is(.text-blue-300, .text-blue-400, .text-sky-300, .text-sky-400):not(#wordPaperSheet *) {
  color: #1d4ed8 !important;
}
body.light-mode :is(.text-emerald-300, .text-emerald-400, .text-green-300, .text-green-400):not(#wordPaperSheet *) {
  color: #047857 !important;
}
body.light-mode :is(.text-teal-300, .text-teal-400):not(#wordPaperSheet *) {
  color: #0f766e !important;
}
body.light-mode :is(.text-amber-300, .text-amber-400, .text-yellow-300, .text-orange-300, .text-orange-400):not(#wordPaperSheet *) {
  color: #b45309 !important;
}
body.light-mode :is(.text-purple-300, .text-purple-400, .text-violet-300, .text-violet-400, .text-indigo-300, .text-indigo-400):not(#wordPaperSheet *) {
  color: #6d28d9 !important;
}
body.light-mode :is(.text-pink-300, .text-pink-400, .text-rose-300, .text-rose-400):not(#wordPaperSheet *) {
  color: #be185d !important;
}
body.light-mode :is(.text-cyan-300, .text-cyan-400):not(#wordPaperSheet *) {
  color: #0e7490 !important;
}
body.light-mode :is(.text-red-300, .text-red-400):not(#wordPaperSheet *) {
  color: #b91c1c !important;
}

/* 6. Píldoras y botones translúcidos (convertidos a pastel limpio en Modo Día) */
body.light-mode [class*="bg-emerald-600/"],
body.light-mode [class*="bg-emerald-500/"] {
  background-color: #ecfdf5 !important;
  border-color: #6ee7b7 !important;
  color: #047857 !important;
}
body.light-mode [class*="bg-teal-600/"],
body.light-mode [class*="bg-teal-500/"] {
  background-color: #f0fdfa !important;
  border-color: #5eead4 !important;
  color: #0f766e !important;
}
body.light-mode [class*="bg-amber-600/"],
body.light-mode [class*="bg-amber-500/"] {
  background-color: #fffbeb !important;
  border-color: #fcd34d !important;
  color: #b45309 !important;
}
body.light-mode [class*="bg-blue-600/"],
body.light-mode [class*="bg-blue-500/"],
body.light-mode [class*="bg-blue-950/"],
body.light-mode [class*="bg-sky-600/"] {
  background-color: #eff6ff !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
}
body.light-mode [class*="bg-indigo-600/"],
body.light-mode [class*="bg-purple-600/"],
body.light-mode [class*="bg-purple-500/"],
body.light-mode [class*="bg-pink-500/"] {
  background-color: #f5f3ff !important;
  border-color: #c4b5fd !important;
  color: #6d28d9 !important;
}
body.light-mode [class*="bg-red-500/"],
body.light-mode [class*="bg-red-900/"] {
  background-color: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
}

/* 7.Formularios, Selectores, Tablas y Bloques de Código */
body.light-mode input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
body.light-mode select,
body.light-mode textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
body.light-mode select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
body.light-mode .unlimit-theme-btn {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
body.light-mode .unlimit-theme-btn:hover {
  background-color: #e2e8f0 !important;
  border-color: #2563eb !important;
}
body.light-mode code,
body.light-mode pre {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
body.light-mode table {
  border-color: #cbd5e1 !important;
}
body.light-mode thead,
body.light-mode thead tr,
body.light-mode th {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
body.light-mode tbody,
body.light-mode tbody tr,
body.light-mode td {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #e2e8f0 !important;
}
body.light-mode tbody tr:nth-child(even) td {
  background-color: #f8fafc !important;
}

/* 8. PROTECCIÓN TOTAL DE BOTONES SÓLIDOS DE ACCIÓN (Texto siempre blanco puro #FFFFFF) */
body.light-mode :is(
  .bg-blue-600, .bg-blue-500, .bg-blue-700,
  .bg-emerald-600, .bg-emerald-500,
  .bg-teal-600, .bg-teal-500,
  .bg-purple-600, .bg-purple-500,
  .bg-indigo-600, .bg-indigo-500,
  .bg-cyan-600, .bg-cyan-500,
  .bg-pink-600, .bg-rose-600,
  .bg-red-600, .bg-amber-600,
  .ux-tab-btn.active,
  #uxFloatingToast,
  .unlimit-solid-badge,
  [class*="from-blue-6"], [class*="from-emerald-6"],
  [class*="from-pink-6"], [class*="from-purple-6"],
  [class*="from-indigo-6"], [class*="from-teal-6"]
),
body.light-mode :is(
  .bg-blue-600, .bg-blue-500, .bg-blue-700,
  .bg-emerald-600, .bg-emerald-500,
  .bg-teal-600, .bg-teal-500,
  .bg-purple-600, .bg-purple-500,
  .bg-indigo-600, .bg-indigo-500,
  .bg-cyan-600, .bg-cyan-500,
  .bg-pink-600, .bg-rose-600,
  .bg-red-600, .bg-amber-600,
  .ux-tab-btn.active,
  #uxFloatingToast,
  .unlimit-solid-badge,
  [class*="from-blue-6"], [class*="from-emerald-6"],
  [class*="from-pink-6"], [class*="from-purple-6"],
  [class*="from-indigo-6"], [class*="from-teal-6"]
) :is(span, strong, b, i, svg) {
  color: #ffffff !important;
}

/* Mantener el folio Word siempre como papel blanco real */
#wordPaperSheet {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

/* === ANTI-DUPLICATE CONTROLS === */
#themeToggleBtn,
#landingThemeBtn,
#langBtn,
#proLangSelect,
#staticThemeBtn,
#guideThemeBtn,
.unlimit-hidden-dup {
  display: none !important;
}
