/* =========================================================
   NEXENG Duct Sizer Dark Mode Hotfix v2
   Corrige contraste del modo oscuro después del Core Shell v1.
   Capa CSS segura: no toca cálculos ni JS principal.
   ========================================================= */

/* Fondo general */
body.nx-theme-dark,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark {
    color: #eaf6ff !important;
    background:
        radial-gradient(circle at 10% 8%, rgba(0,174,239,.13), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(8,103,216,.16), transparent 30%),
        linear-gradient(180deg, #071522 0%, #081a2c 46%, #0d2438 100%) !important;
}

/* Header y barra */
body.nx-theme-dark .nx-topbar,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-topbar {
    background: rgba(7,18,31,.97) !important;
    border-bottom-color: rgba(125,211,252,.20) !important;
    box-shadow: 0 18px 50px rgba(0,0,0,.35) !important;
}

body.nx-theme-dark .nx-action-dock,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-action-dock {
    background: rgba(6,18,31,.94) !important;
    border-bottom-color: rgba(125,211,252,.16) !important;
    box-shadow: 0 14px 38px rgba(0,0,0,.30) !important;
}

body.nx-theme-dark .nx-action-dock-inner,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-action-dock-inner {
    background: rgba(11,31,51,.92) !important;
    border-color: rgba(125,211,252,.20) !important;
}

/* Botones */
body.nx-theme-dark .nx-btn,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-btn {
    color: #eaf6ff !important;
    background: rgba(13,34,55,.94) !important;
    border-color: rgba(125,211,252,.24) !important;
}

body.nx-theme-dark .nx-btn:hover,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-btn:hover {
    background: rgba(20,55,86,.96) !important;
    border-color: rgba(94,203,255,.34) !important;
}

body.nx-theme-dark .nx-btn-primary,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-btn-primary {
    color: #fff !important;
    background: linear-gradient(135deg, #0877e8, #00a6df) !important;
    border-color: transparent !important;
}

/* HERO: fix principal */
body.nx-theme-dark .nx-hero,
body.nx-theme-dark .nx-hero-main,
body.nx-theme-dark .nx-hero-content,
body.nx-theme-dark .nx-hero-copy,
body.nx-theme-dark .nx-hero-card,
body.nx-theme-dark .nx-hero-left,
body.nx-theme-dark .nx-hero-panel,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-main,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-content,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-copy,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-card,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-left,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-panel {
    background:
        radial-gradient(circle at 16% 0%, rgba(0,174,239,.08), transparent 34%),
        linear-gradient(180deg, rgba(12,35,58,.98), rgba(8,24,40,.98)) !important;
    border-color: rgba(125,211,252,.20) !important;
    color: #f3fbff !important;
    box-shadow: 0 24px 70px rgba(0,0,0,.34) !important;
}

/* Si el hero usa un grid interno con fondo claro */
body.nx-theme-dark .nx-hero > div,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero > div {
    border-color: rgba(125,211,252,.18) !important;
}

/* Texto hero y títulos */
body.nx-theme-dark .nx-hero h1,
body.nx-theme-dark .nx-hero h2,
body.nx-theme-dark .nx-hero h3,
body.nx-theme-dark .nx-hero strong,
body.nx-theme-dark .nx-sheet-title h2,
body.nx-theme-dark .nx-summary-card strong,
body.nx-theme-dark .nx-info-panel h2,
body.nx-theme-dark .nx-quick h2,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero h1,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero h2,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero h3,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero strong,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet-title h2,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-summary-card strong,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-info-panel h2,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-quick h2 {
    color: #f3fbff !important;
    text-shadow: none !important;
}

body.nx-theme-dark .nx-hero p,
body.nx-theme-dark .nx-hero small,
body.nx-theme-dark .nx-sheet-title p,
body.nx-theme-dark .nx-summary-card span,
body.nx-theme-dark .nx-info-panel p,
body.nx-theme-dark .nx-quick p,
body.nx-theme-dark .nx-disclaimer p,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero p,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero small,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet-title p,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-summary-card span,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-info-panel p,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-quick p,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-disclaimer p {
    color: #a9bdd2 !important;
}

/* Kicker y tags */
body.nx-theme-dark .nx-kicker,
body.nx-theme-dark .nx-hero-tags span,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-kicker,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-tags span {
    background: rgba(20,55,86,.94) !important;
    border-color: rgba(125,211,252,.26) !important;
    color: #dff6ff !important;
}

body.nx-theme-dark .nx-kicker,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-kicker {
    box-shadow: inset 3px 0 0 #20c997 !important;
}

/* Hero summary / diámetro recomendado */
body.nx-theme-dark .nx-hero-summary,
body.nx-theme-dark .nx-result-card,
body.nx-theme-dark .nx-recommend-card,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-summary,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-result-card,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-recommend-card {
    background:
        radial-gradient(circle at 20% 0%, rgba(0,174,239,.10), transparent 36%),
        linear-gradient(180deg, rgba(12,35,58,.98), rgba(8,24,40,.98)) !important;
    border: 1px solid rgba(125,211,252,.20) !important;
    color: #f3fbff !important;
    box-shadow: 0 22px 62px rgba(0,0,0,.30) !important;
}

body.nx-theme-dark .nx-hero-summary strong,
body.nx-theme-dark .nx-result-card strong,
body.nx-theme-dark .nx-recommend-card strong,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero-summary strong,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-result-card strong,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-recommend-card strong {
    color: #118cff !important;
}

/* KPI strip: evitar fondo blanco */
body.nx-theme-dark .nx-summary-grid,
body.nx-theme-dark .nx-kpi-grid,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-summary-grid,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-kpi-grid {
    background: transparent !important;
    border-color: transparent !important;
}

body.nx-theme-dark .nx-summary-card,
body.nx-theme-dark .nx-kpi-card,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-summary-card,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-kpi-card {
    background:
        radial-gradient(circle at 18% 0%, rgba(0,174,239,.07), transparent 34%),
        linear-gradient(180deg, rgba(12,35,58,.98), rgba(8,24,40,.98)) !important;
    border: 1px solid rgba(125,211,252,.20) !important;
    color: #f3fbff !important;
    box-shadow: 0 16px 42px rgba(0,0,0,.24) !important;
}

/* Panel de hoja */
body.nx-theme-dark .nx-sheet-panel,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet-panel {
    background:
        radial-gradient(circle at 12% 0%, rgba(0,174,239,.055), transparent 34%),
        linear-gradient(180deg, rgba(11,31,51,.98), rgba(8,24,40,.98)) !important;
    border-color: rgba(125,211,252,.20) !important;
    color: #f3fbff !important;
    box-shadow: 0 24px 70px rgba(0,0,0,.34) !important;
}

body.nx-theme-dark .nx-sheet-title,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet-title {
    background:
        radial-gradient(circle at 12% 0%, rgba(94,203,255,.075), transparent 34%),
        linear-gradient(180deg, #102a43, #0b1f33) !important;
    border-bottom-color: rgba(125,211,252,.16) !important;
}

/* Tabla:
   Conserva colores funcionales, pero baja blanco puro en modo oscuro */
body.nx-theme-dark .nx-sheet-scroll,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet-scroll {
    background: #0b1f33 !important;
}

body.nx-theme-dark .nx-sheet,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet {
    background: #0b1f33 !important;
}

body.nx-theme-dark .nx-sheet thead th,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet thead th {
    color: #d8f2ff !important;
    background: linear-gradient(180deg, #14334f, #102a43) !important;
    border-color: rgba(125,211,252,.18) !important;
}

body.nx-theme-dark .nx-sheet td,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet td {
    border-color: rgba(125,211,252,.16) !important;
}

/* Celdas funcionales en oscuro: mantienen lectura */
body.nx-theme-dark .nx-sheet td:not(.nx-cell-editable):not(.nx-cell-calculated):not(.nx-cell-locked),
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet td:not(.nx-cell-editable):not(.nx-cell-calculated):not(.nx-cell-locked) {
    color: #eaf6ff !important;
}

body.nx-theme-dark .nx-cell-editable,
body.nx-theme-dark td.nx-editable,
body.nx-theme-dark td.is-editable,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-cell-editable,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark td.nx-editable,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark td.is-editable {
    background: #fff7d0 !important;
    color: #102033 !important;
}

body.nx-theme-dark .nx-cell-calculated,
body.nx-theme-dark td.nx-calculated,
body.nx-theme-dark td.is-calculated,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-cell-calculated,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark td.nx-calculated,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark td.is-calculated {
    background: #dff2ff !important;
    color: #102033 !important;
}

body.nx-theme-dark .nx-sheet input,
body.nx-theme-dark .nx-sheet select,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet input,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet select {
    color: inherit !important;
}

/* Badges estado OK */
body.nx-theme-dark .nx-status-ok,
body.nx-theme-dark .nx-badge-ok,
body.nx-theme-dark .nx-ok,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-status-ok,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-badge-ok,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-ok {
    background: rgba(32,201,151,.16) !important;
    border-color: rgba(32,201,151,.34) !important;
    color: #7ff0c9 !important;
}

/* Paneles inferiores */
body.nx-theme-dark .nx-info-panel,
body.nx-theme-dark .nx-quick,
body.nx-theme-dark .nx-disclaimer,
body.nx-theme-dark .nx-note-box,
body.nx-theme-dark .nx-selection-help,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-info-panel,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-quick,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-disclaimer,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-note-box,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-selection-help {
    background:
        radial-gradient(circle at 15% 0%, rgba(0,174,239,.055), transparent 32%),
        linear-gradient(180deg, rgba(11,31,51,.96), rgba(8,24,40,.96)) !important;
    border-color: rgba(125,211,252,.18) !important;
    color: #eaf6ff !important;
    box-shadow: 0 20px 54px rgba(0,0,0,.28) !important;
}

/* Select menus dentro de tabla */
body.nx-theme-dark select option,
body.nx-duct-sizer-core-shell-v1.nx-theme-dark select option {
    background: #0b1f33 !important;
    color: #eaf6ff !important;
}

/* Mobile dark refinements */
@media (max-width: 920px) {
    body.nx-theme-dark .nx-action-dock,
    body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-action-dock {
        background: rgba(6,18,31,.97) !important;
    }
}

@media (max-width: 640px) {
    body.nx-theme-dark .nx-hero,
    body.nx-theme-dark .nx-sheet-panel,
    body.nx-theme-dark .nx-summary-card,
    body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-hero,
    body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-sheet-panel,
    body.nx-duct-sizer-core-shell-v1.nx-theme-dark .nx-summary-card {
        box-shadow: 0 16px 42px rgba(0,0,0,.30) !important;
    }
}
