/* =========================================================
   NEXENG Home v8 Dark Mode Hotfix
   Corrige contraste y jerarquía visual en modo oscuro.
   Capa CSS segura: no toca base de datos ni lógica.
   ========================================================= */

/* Fondo general */
body.nx-theme-dark {
    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;
    color: #eaf6ff !important;
}

body.nx-theme-dark::before {
    opacity: .28 !important;
}

/* Header */
body.nx-theme-dark .nx-header {
    background: rgba(7, 18, 31, .96) !important;
    border-bottom-color: rgba(125, 211, 252, .18) !important;
    box-shadow: 0 18px 50px rgba(0,0,0,.32) !important;
}

body.nx-theme-dark .nx-header::after {
    background: linear-gradient(90deg, transparent, rgba(94,203,255,.28), transparent) !important;
}

body.nx-theme-dark .nx-nav-link,
body.nx-theme-dark .nx-icon-btn,
body.nx-theme-dark .nx-menu-trigger {
    color: #ecf8ff !important;
}

body.nx-theme-dark .nx-nav-link:hover,
body.nx-theme-dark .nx-icon-btn:hover {
    background: rgba(94, 203, 255, .08) !important;
    border-color: rgba(94, 203, 255, .18) !important;
}

body.nx-theme-dark .nx-nav-sep {
    background: rgba(125,211,252,.22) !important;
}

/* Secciones principales */
body.nx-theme-dark .nx-hero-main,
body.nx-theme-dark .nx-stats-card,
body.nx-theme-dark .nx-tools-section,
body.nx-theme-dark .nx-lower-card,
body.nx-theme-dark .nx-method,
body.nx-theme-dark .nx-foot-card {
    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, .17) !important;
    box-shadow: 0 24px 70px rgba(0,0,0,.30) !important;
}

/* Tipografía general */
body.nx-theme-dark h1,
body.nx-theme-dark h2,
body.nx-theme-dark h3,
body.nx-theme-dark .nx-hero h1,
body.nx-theme-dark .nx-section-head h2,
body.nx-theme-dark .nx-app-card h3,
body.nx-theme-dark .nx-stat strong,
body.nx-theme-dark .nx-stat span,
body.nx-theme-dark .nx-modal-card h2 {
    color: #f3fbff !important;
    text-shadow: none !important;
}

body.nx-theme-dark p,
body.nx-theme-dark .nx-desc,
body.nx-theme-dark .nx-category-description,
body.nx-theme-dark .nx-stat small,
body.nx-theme-dark .nx-method-card p,
body.nx-theme-dark .nx-lower-card p,
body.nx-theme-dark .nx-foot-card,
body.nx-theme-dark .nx-modal-card p {
    color: #a9bdd2 !important;
}

body.nx-theme-dark .nx-section-label,
body.nx-theme-dark .nx-view-all,
body.nx-theme-dark .nx-category {
    color: #5ecbff !important;
}

/* Buscador */
body.nx-theme-dark .nx-search {
    background: rgba(13, 34, 55, .96) !important;
    border-color: rgba(125,211,252,.20) !important;
    box-shadow: 0 18px 44px rgba(0,0,0,.22) !important;
}

body.nx-theme-dark .nx-search input {
    color: #f3fbff !important;
}

body.nx-theme-dark .nx-search input::placeholder {
    color: #8ba1b8 !important;
}

body.nx-theme-dark .nx-search-icon,
body.nx-theme-dark .nx-search kbd {
    background: rgba(22, 55, 86, .92) !important;
    border-color: rgba(125,211,252,.20) !important;
    color: #dff6ff !important;
}

body.nx-theme-dark .nx-search:focus-within {
    border-color: rgba(94,203,255,.46) !important;
    box-shadow: 0 22px 50px rgba(0,174,239,.12) !important;
}

/* Stats */
body.nx-theme-dark .nx-stat {
    background: rgba(13, 34, 55, .92) !important;
    border-color: rgba(125,211,252,.18) !important;
}

body.nx-theme-dark .nx-stat-icon {
    background: rgba(20, 56, 88, .95) !important;
    border-color: rgba(125,211,252,.22) !important;
    color: #65d5ff !important;
}

body.nx-theme-dark .nx-chart {
    background-color: rgba(7, 22, 38, .52) !important;
}

/* Filtros */
body.nx-theme-dark .nx-filter {
    background: rgba(14, 38, 61, .92) !important;
    border-color: rgba(125,211,252,.20) !important;
    color: #e8f7ff !important;
}

body.nx-theme-dark .nx-filter:hover {
    background: rgba(20, 52, 82, .96) !important;
    border-color: rgba(94,203,255,.30) !important;
}

body.nx-theme-dark .nx-filter.is-active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #0877e8, #00a6df) !important;
    border-color: transparent !important;
    box-shadow: 0 16px 36px rgba(0,174,239,.20), inset 0 1px 0 rgba(255,255,255,.18) !important;
}

body.nx-theme-dark .nx-result-count {
    background: rgba(15, 44, 70, .92) !important;
    border-color: rgba(94,203,255,.28) !important;
    color: #82dcff !important;
}

/* CARDS: fix principal */
body.nx-theme-dark .nx-app-card {
    background:
        radial-gradient(circle at 18% 0%, rgba(0,174,239,.11), transparent 32%),
        linear-gradient(180deg, #102a43 0%, #0c2238 55%, #0b1d31 100%) !important;
    border-color: rgba(125, 211, 252, .22) !important;
    box-shadow: 0 18px 52px rgba(0,0,0,.30) !important;
}

body.nx-theme-dark .nx-app-card:hover {
    border-color: rgba(94,203,255,.38) !important;
    box-shadow: 0 28px 72px rgba(0,0,0,.40), 0 0 0 1px rgba(94,203,255,.08) !important;
}

body.nx-theme-dark .nx-app-card::before {
    background: radial-gradient(circle at 20% 0%, rgba(94,203,255,.11), transparent 36%) !important;
}

body.nx-theme-dark .nx-app-card::after {
    background: radial-gradient(circle, rgba(0,174,239,.09), transparent 65%) !important;
}

body.nx-theme-dark .nx-app-card h3 {
    color: #f5fbff !important;
}

body.nx-theme-dark .nx-desc {
    color: #b6c7d8 !important;
}

/* Iconos en cards */
body.nx-theme-dark .nx-app-icon,
body.nx-theme-dark .nx-v7-icon-ready .nx-app-icon {
    background:
        radial-gradient(circle at 30% 22%, rgba(125,211,252,.16), transparent 28%),
        linear-gradient(135deg, rgba(21, 65, 99, .98), rgba(13, 45, 72, .98)) !important;
    border-color: rgba(125,211,252,.28) !important;
    color: #65d5ff !important;
    box-shadow: 0 14px 32px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08) !important;
}

body.nx-theme-dark .nx-app-card:hover .nx-app-icon {
    box-shadow: 0 18px 42px rgba(0,174,239,.12), inset 0 1px 0 rgba(255,255,255,.10) !important;
}

/* Badges */
body.nx-theme-dark .nx-badge {
    background: rgba(32, 201, 151, .15) !important;
    color: #7ff0c9 !important;
    border-color: rgba(32,201,151,.35) !important;
}

body.nx-theme-dark .nx-badge.is-pro {
    background: rgba(255, 159, 67, .16) !important;
    color: #ffc47d !important;
    border-color: rgba(255,159,67,.38) !important;
}

/* Tags */
body.nx-theme-dark .nx-tag {
    background: rgba(23, 58, 89, .96) !important;
    border-color: rgba(125,211,252,.22) !important;
    color: #d9f4ff !important;
}

body.nx-theme-dark .nx-app-card:hover .nx-tag {
    background: rgba(28, 70, 106, .98) !important;
    border-color: rgba(94,203,255,.30) !important;
}

/* Footer card */
body.nx-theme-dark .nx-card-footer {
    border-top-color: transparent !important;
    background:
        linear-gradient(rgba(12,34,56,0), rgba(12,34,56,0)) padding-box,
        linear-gradient(90deg, transparent, rgba(125,211,252,.24), transparent) border-box !important;
}

body.nx-theme-dark .nx-category {
    color: #61d4ff !important;
}

/* Botón Abrir */
body.nx-theme-dark .nx-open {
    color: #eaf6ff !important;
    background: rgba(26, 64, 96, .96) !important;
    border-color: rgba(125,211,252,.28) !important;
}

body.nx-theme-dark .nx-open span {
    color: inherit !important;
}

body.nx-theme-dark .nx-open:hover,
body.nx-theme-dark .nx-open:focus-visible,
body.nx-theme-dark .nx-app-card:hover .nx-open {
    color: #ffffff !important;
    background: linear-gradient(135deg, #0877e8, #00a6df) !important;
    border-color: transparent !important;
    box-shadow: 0 14px 30px rgba(0,174,239,.18) !important;
}

body.nx-theme-dark .nx-open:hover span,
body.nx-theme-dark .nx-app-card:hover .nx-open span {
    color: #ffffff !important;
}

/* Dropdowns / modal / toast */
body.nx-theme-dark .nx-dropdown,
body.nx-theme-dark .nx-modal-card,
body.nx-theme-dark .nx-toast {
    background: rgba(11, 30, 50, .98) !important;
    border-color: rgba(125,211,252,.22) !important;
    color: #eaf6ff !important;
    box-shadow: 0 26px 70px rgba(0,0,0,.38) !important;
}

body.nx-theme-dark .nx-dropdown a,
body.nx-theme-dark .nx-dropdown button,
body.nx-theme-dark .nx-modal-close,
body.nx-theme-dark .nx-login-form input {
    background: transparent !important;
    color: #eaf6ff !important;
    border-color: rgba(125,211,252,.20) !important;
}

body.nx-theme-dark .nx-dropdown a:hover,
body.nx-theme-dark .nx-dropdown button:hover,
body.nx-theme-dark .nx-dropdown a.is-active {
    background: rgba(94,203,255,.10) !important;
    color: #72d8ff !important;
}

/* Premium lower */
body.nx-theme-dark .nx-lower-mark,
body.nx-theme-dark .nx-premium-points span,
body.nx-theme-dark .nx-lower-icons span {
    background: rgba(20, 55, 86, .92) !important;
    border-color: rgba(125,211,252,.22) !important;
    color: #74d6ff !important;
}

body.nx-theme-dark .nx-premium-btn {
    color: #ffffff !important;
    background: linear-gradient(135deg, #0877e8, #00a6df) !important;
    border-color: transparent !important;
}

/* Modo oscuro mobile */
@media (max-width: 640px) {
    body.nx-theme-dark .nx-header {
        background: rgba(7, 18, 31, .98) !important;
    }

    body.nx-theme-dark .nx-app-card {
        box-shadow: 0 16px 42px rgba(0,0,0,.28) !important;
    }
}
