/* ==========================================================================
   TrustHost theme modes — light / dark design tokens and dark-mode layer
   Loaded after every other stylesheet. Dark rules are scoped to
   html[data-theme="dark"], which header.tpl sets before first paint.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
    color-scheme: light;
    --th-bg: #f8fafc;
    --th-surface: #ffffff;
    --th-surface-2: #f8fafc;
    --th-surface-3: #f1f5f9;
    --th-sunken: #f1f5f9;
    --th-border: #e2e8f0;
    --th-border-strong: #cbd5e1;
    --th-text: #0f172a;
    --th-text-2: #334155;
    --th-muted: #64748b;
    --th-primary: #2563eb;
    --th-primary-hover: #1d4ed8;
    --th-primary-soft: rgba(37, 99, 235, 0.08);
    --th-primary-soft-2: rgba(37, 99, 235, 0.14);
    --th-link: #2563eb;
    --th-on-primary: #ffffff;
    --th-success-fg: #047857;
    --th-warning-fg: #b45309;
    --th-danger-fg: #dc2626;
    --th-info-fg: #0e7490;
    --th-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --th-shadow-md: 0 4px 18px -4px rgba(15, 23, 42, 0.08);
    --th-focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --th-bg: #0b1120;
    --th-surface: #111a2c;
    --th-surface-2: #172238;
    --th-surface-3: #1e2b45;
    --th-sunken: #0d1526;
    --th-border: #1f2c44;
    --th-border-strong: #2b3b5a;
    --th-text: #e6ebf3;
    --th-text-2: #c2cbda;
    --th-muted: #93a0b6;
    --th-primary: #3b82f6;
    --th-primary-hover: #2563eb;
    --th-primary-soft: rgba(59, 130, 246, 0.12);
    --th-primary-soft-2: rgba(59, 130, 246, 0.2);
    --th-link: #60a5fa;
    --th-on-primary: #ffffff;
    --th-success-fg: #34d399;
    --th-warning-fg: #fbbf24;
    --th-danger-fg: #f87171;
    --th-info-fg: #22d3ee;
    --th-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --th-shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
    --th-focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.35);

    /* tokens declared by custom.css, remapped for dark */
    --th-bg-main: var(--th-bg);
    --th-card-bg: var(--th-surface);
    --th-text-main: var(--th-text);
    --th-text-muted: var(--th-muted);
    --th-border-color: var(--th-border);
    --th-primary-light: var(--th-primary-soft);
    --th-success-bg: rgba(16, 185, 129, 0.12);
    --th-warning-bg: rgba(245, 158, 11, 0.12);
    --th-danger-bg: rgba(239, 68, 68, 0.12);
    --th-info-bg: rgba(6, 182, 212, 0.12);
}

/* Vendor (ShufyTheme) variables: replace the neutral-gray dark palette with
   the TrustHost navy palette. Specificity beats app.min.css dark block. */
html[data-theme="dark"] body,
html[data-theme="dark"] body.theme-style-one,
html[data-theme="dark"] body.theme-style-two,
html[data-theme="dark"] body.theme-style-three,
html[data-theme="dark"] body.theme-style-four {
    --background: var(--th-bg);
    --background-2: var(--th-surface);
    /* custom.css pins -3/-6/-10 to light blues with !important on body */
    --background-3: var(--th-surface-2) !important;
    --background-6: var(--th-surface) !important;
    --background-10: rgba(59, 130, 246, 0.2) !important;
    --background-5: var(--th-surface-2);
    --background-7: var(--th-surface);
    --background-8: var(--th-sunken);
    --background-12: var(--th-sunken);
    --background-13: var(--th-surface-2);
    --background-14: var(--th-surface);
    --color-h: var(--th-text);
    --color-h-hover: var(--th-text-2);
    --color-gray: var(--th-muted);
    --color-h-sub: var(--th-muted);
    --color-texts: var(--th-text);
    --color-texts-opacity: var(--th-muted);
    --color-sidebar-h: var(--th-text);
    --main-block-text-faded-color: var(--th-text);
    --secondary-block-text-faded-color: var(--th-muted);
    --border-color: var(--th-border);
    --border-color-light: var(--th-border);
    --btn-border: var(--th-border-strong);
    --btn-primary-bg: var(--th-primary);
    --btn-primary-border: var(--th-primary);
    --btn-primary-color: #ffffff;
    --btn-primary-bg-hover: var(--th-primary-hover);
    --btn-primary-border-hover: var(--th-primary-hover);
    --btn-primary-color-hover: #ffffff;
    --btn-primary-light-bg: var(--th-primary-soft);
    --btn-primary-light-border: transparent;
    --btn-primary-light-color: var(--th-link);
    --btn-primary-light-bg-hover: var(--th-primary-soft-2);
    --btn-primary-light-border-hover: transparent;
    --btn-primary-light-color-hover: #93c5fd;
    --btn-primary-outlin-border: var(--th-primary);
    --btn-primary-outlin-color: var(--th-link);
    --btn-primary-outlin-bg-hover: var(--th-primary);
    --btn-primary-outlin-border-hover: var(--th-primary);
    --btn-default-bg: var(--th-surface-2);
    --btn-default-border: var(--th-border-strong);
    --btn-default-color: var(--th-text);
    --btn-default-bg-hover: var(--th-surface-3);
    --btn-default-border-hover: var(--th-border-strong);
    --btn-default-color-hover: var(--th-text);
    --btn-light-bg: var(--th-surface-2);
    --btn-light-border: var(--th-border);
    --btn-light-color: var(--th-text);
    --btn-light-bg-hover: var(--th-surface-3);
    --btn-light-border-hover: var(--th-border-strong);
    --btn-light-color-hover: var(--th-text);
    --btn-lighter-bg: var(--th-surface-2);
    --btn-lighter-border: var(--th-border);
    --btn-lighter-color: var(--th-text-2);
    --btn-lighter-bg-hover: var(--th-surface-3);
    --btn-lighter-border-hover: var(--th-border-strong);
    --btn-lighter-color-hover: var(--th-text);
    --checkbox-first-color: var(--th-border-strong);
    --options-icons-color: var(--th-muted);
    --options-icons-container-bg: var(--th-surface-2);
    --options-icons-container-bg-hover: var(--th-surface-3);
    --header-shoping-cart-number-background: var(--th-primary);
    --alertbgprimary: rgba(59, 130, 246, 0.12);
    --alertcolorprimary: #93c5fd;
    --alertbgsecondary: var(--th-surface-2);
    --alertcolorsecondary: var(--th-text-2);
    --alertbgsuccess: rgba(16, 185, 129, 0.12);
    --alertcolorsuccess: #6ee7b7;
    --alertbgdanger: rgba(239, 68, 68, 0.12);
    --alertcolordanger: #fca5a5;
    --alertbgwarning: rgba(245, 158, 11, 0.12);
    --alertcolorwarning: #fcd34d;
    --alertbginfo: rgba(6, 182, 212, 0.12);
    --alertcolorinfo: #67e8f9;
    --alertbglight: var(--th-surface-2);
    --alertcolorlight: var(--th-text-2);
    --alertbgdark: var(--th-sunken);
    --alertcolordark: var(--th-text);
    background: var(--th-bg);
    color: var(--th-text);
}

/* 2. Mode switch: smooth only while toggling, never on page load ----------- */
html.th-theme-switching,
html.th-theme-switching *,
html.th-theme-switching *::before,
html.th-theme-switching *::after {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.2s ease, fill 0.2s ease, box-shadow 0.25s ease !important;
}
@media (prefers-reduced-motion: reduce) {
    html.th-theme-switching,
    html.th-theme-switching * {
        transition: none !important;
    }
}

/* 3. Theme toggle button (header) ------------------------------------------ */
.th-theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-inline-end: 8px;
    padding: 0;
    border: 1px solid var(--th-border);
    border-radius: 12px;
    background: var(--th-surface);
    color: var(--th-text-2);
    cursor: pointer;
    overflow: hidden;
    box-shadow: var(--th-shadow-sm);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.th-theme-toggle:hover {
    color: var(--th-primary);
    border-color: var(--th-border-strong);
    background: var(--th-surface-2);
}
.th-theme-toggle:active {
    transform: scale(0.94);
}
.th-theme-toggle:focus-visible {
    outline: none;
    box-shadow: var(--th-focus-ring);
}
.th-theme-toggle svg {
    position: absolute;
    width: 19px;
    height: 19px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
.th-theme-toggle .th-icon-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}
.th-theme-toggle .th-icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}
html[data-theme="dark"] .th-theme-toggle .th-icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}
html[data-theme="dark"] .th-theme-toggle .th-icon-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
    color: #fbbf24;
}
@media (prefers-reduced-motion: reduce) {
    .th-theme-toggle svg {
        transition: none;
    }
}
.th-theme-toggle--floating {
    position: fixed;
    z-index: 1050;
    bottom: 20px;
    left: 20px;
    margin: 0;
    box-shadow: var(--th-shadow-md);
}

/* 4. Light-mode contrast fixes (WCAG AA) ----------------------------------- */
html:not([data-theme="dark"]) li.breadcrumb-item > a,
html:not([data-theme="dark"]) .th-footer__copyright,
html:not([data-theme="dark"]) .th-footer span > small {
    color: #64748b !important;
}
html:not([data-theme="dark"]) .th-footer__email,
html:not([data-theme="dark"]) .th-footer__phone {
    color: #0e7490 !important;
}
html:not([data-theme="dark"]) li.paginate_button:not(.active) > a.page-link,
html:not([data-theme="dark"]) .text-gray,
html:not([data-theme="dark"]) .user__management__table__user__text p,
html:not([data-theme="dark"]) .user__management__table__user__last-login p {
    color: #64748b !important;
}
html:not([data-theme="dark"]) .coodiv-text-9.font-weight-300,
html:not([data-theme="dark"]) .coodiv-text-10.font-weight-300,
html:not([data-theme="dark"]) .coodiv-text-11.font-weight-400,
html:not([data-theme="dark"]) .coodiv-text-11.font-weight-500,
html:not([data-theme="dark"]) .coodiv-text-12.font-weight-400 {
    color: #64748b;
}
html:not([data-theme="dark"]) .label-info {
    color: #0e7490;
}
html:not([data-theme="dark"]) #order-standard_cart .summary-container .product-group {
    color: #1d4ed8;
}
.sidebar .th-nav-item .text-danger,
.sidebar .sidebar__logout {
    color: #f87171 !important;
}
.btn-info,
a.btn.btn-info {
    background-color: #0e7490 !important;
    border-color: #0e7490 !important;
    color: #ffffff !important;
}
.btn-info:hover,
a.btn.btn-info:hover {
    background-color: #155e75 !important;
    border-color: #155e75 !important;
}
.btn-warning,
a.btn.btn-warning,
a.btn.btn-warning.text-dark {
    color: #1f1300 !important;
}
#activateAffiliate.btn-success,
.btn-success {
    background-color: #047857 !important;
    border-color: #047857 !important;
    color: #ffffff !important;
}
.btn-success:hover {
    background-color: #065f46 !important;
    border-color: #065f46 !important;
}
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success,
.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary {
    background: #2563eb !important;
    color: #ffffff !important;
}
code {
    color: #be185d;
}
.thgpu__price del {
    color: #64748b;
}
