/* ALF light / system / dark theme layer. Original template CSS remains untouched. */
:root {
    --alf-theme-bg: #ffffff;
    --alf-theme-surface: #ffffff;
    --alf-theme-surface-2: #f5f5f5;
    --alf-theme-text: #1d1d1d;
    --alf-theme-muted: #737373;
    --alf-theme-border: #dedede;
    --alf-theme-accent: #954617;
}

html[data-theme="dark"] {
    --alf-theme-bg: #1d1d1d;
    --alf-theme-surface: #1d1d1d;
    --alf-theme-surface-2: #252525;
    --alf-theme-text: #f1f1f1;
    --alf-theme-muted: #b6b6b6;
    --alf-theme-border: #3a3a3a;
    --alf-theme-accent: #c77a4d;
}

html, body, .box-content, .body-content, main, .header, .footer {
    transition: background-color .22s ease, color .22s ease, border-color .22s ease;
}

.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    margin-right: 18px;
    border: 1px solid var(--alf-theme-border);
    border-radius: 999px;
    background: var(--alf-theme-surface-2);
    flex: 0 0 auto;
}
.theme-switcher__button {
    width: 29px;
    height: 29px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--alf-theme-muted);
    cursor: pointer;
    font: 17px/29px Arial, sans-serif;
    text-align: center;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.theme-switcher__button:hover { color: var(--alf-theme-text); }
.theme-switcher__button.is-active {
    background: var(--alf-theme-surface);
    color: var(--alf-theme-accent);
    box-shadow: 0 1px 5px rgba(0,0,0,.13);
}
.theme-switcher__button:focus-visible { outline: 2px solid var(--alf-theme-accent); outline-offset: 2px; }

html[data-theme="dark"] body,
html[data-theme="dark"] .box-content,
html[data-theme="dark"] .body-content,
html[data-theme="dark"] main { background-color: var(--alf-theme-bg); color: var(--alf-theme-text); }
html[data-theme="dark"] .header,
html[data-theme="dark"] .footer { background-color: var(--alf-theme-surface); color: var(--alf-theme-text); }

/* Common typography and links */
html[data-theme="dark"] :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,address,label,strong,b,small) { color: inherit; }
html[data-theme="dark"] :where(.body-content,main,.header,.footer) a:not(.btn) { color: inherit; }
html[data-theme="dark"] :where(.header__contact .phone,.header__contact .email,.header__search) { color: var(--alf-theme-text); }
html[data-theme="dark"] .header__search svg circle,
html[data-theme="dark"] .header__search svg path { stroke: var(--alf-theme-text); }

/* Typical white cards/sections used by the existing template */
html[data-theme="dark"] :where(.catalog-item,.product-item,.news-item,.news-card,.card,.item,.modal,.modal-content,.search-result,.cookie) {
    border-color: var(--alf-theme-border);
}
html[data-theme="dark"] .cookie { background: var(--alf-theme-surface); color: var(--alf-theme-text); }
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background-color: var(--alf-theme-surface-2);
    color: var(--alf-theme-text);
    border-color: var(--alf-theme-border);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--alf-theme-muted); }
html[data-theme="dark"] hr { border-color: var(--alf-theme-border); }

/* Inline SVG icons in header/footer mostly use fixed dark fills in the old template. */
html[data-theme="dark"] .footer svg path:not([fill="none"]) { fill: #b6b6b6; }
html[data-theme="dark"] .footer .fil0,
html[data-theme="dark"] .footer .fil1 { fill: #b6b6b6; }

@media (max-width: 900px) {
    .theme-switcher { margin-right: 10px; }
    .theme-switcher__button { width: 27px; height: 27px; line-height: 27px; }
}
@media (max-width: 600px) {
    .theme-switcher { gap: 0; padding: 2px; margin-right: 8px; }
    .theme-switcher__button { width: 25px; height: 25px; font-size: 15px; line-height: 25px; }
}


/* v3 — desktop control lives in the left panel; old ALF fixed colors are overridden explicitly. */
.theme-switcher--sidebar {
    margin: 24px 0 0 0;
    width: fit-content;
    align-self: flex-start;
    background: #e7e7e7;
    border-color: #d1d1d1;
}
.theme-switcher--sidebar .theme-switcher__button { color: #777; }
.theme-switcher--sidebar .theme-switcher__button:hover { color: #1d1d1d; }
.theme-switcher--sidebar .theme-switcher__button.is-active {
    background: #fff;
    color: #954617;
}

/* Keep the left navigation itself light: it is a separate navigation surface. */
html[data-theme="dark"] .sidebar { color: #1d1d1d; }
html[data-theme="dark"] .sidebar::after { background: #f3f3f3; }
html[data-theme="dark"] .sidebar-menu__link,
html[data-theme="dark"] .sidebar-submenu__link,
html[data-theme="dark"] .sidebar-menu__link.number-box .title,
html[data-theme="dark"] .sidebar-menu__link.number-box .number { color: #3a3a3a; }
html[data-theme="dark"] .sidebar-menu__title path { stroke: #3a3a3a; }

/* The legacy stylesheet uses --black and many hard-coded dark text colors. */
html[data-theme="dark"] { --black: #f1f1f1; }
html[data-theme="dark"] .body-content { background:#1d1d1d; color:#f1f1f1; }
html[data-theme="dark"] .section-preview h1,
html[data-theme="dark"] .section-preview h2,
html[data-theme="dark"] .section-preview h3,
html[data-theme="dark"] .catalog-category__item h3 { color:#f1f1f1 !important; }
html[data-theme="dark"] .section-preview p { color:#b6b6b6 !important; }

/* Header / breadcrumb / search */
html[data-theme="dark"] .header { background:#1d1d1d; color:#f1f1f1; }
html[data-theme="dark"] .header a,
html[data-theme="dark"] .header span,
html[data-theme="dark"] .breadcrumb a,
html[data-theme="dark"] .breadcrumb span { color:#f1f1f1 !important; }
html[data-theme="dark"] .header svg path:not([fill="none"]) { fill:#f1f1f1; }
html[data-theme="dark"] .header svg path[fill="none"],
html[data-theme="dark"] .header svg circle,
html[data-theme="dark"] .header svg line { stroke:#f1f1f1; }
html[data-theme="dark"] .header::after { background:rgba(255,255,255,.14); }

/* Common content text. Specific branded/accent components can override this later. */
html[data-theme="dark"] .body-content article h1,
html[data-theme="dark"] .body-content article h2,
html[data-theme="dark"] .body-content article h3,
html[data-theme="dark"] .body-content article h4 { color:#f1f1f1; }
html[data-theme="dark"] .body-content article p { color:#b6b6b6; }

.theme-switcher--mobile { display:none; }
@media (max-width:1050px) {
    .theme-switcher--sidebar { display:none; }
    .theme-switcher--mobile { display:inline-flex; }
}

/* v4 — catalog filter text in dark mode */
html[data-theme="dark"] .catalog-products__filter,
html[data-theme="dark"] .catalog-products__filter .checkbox-list label,
html[data-theme="dark"] .catalog-products__filter .checkbox-list-box .title span {
    color: #d0d0d0 !important;
}
html[data-theme="dark"] .catalog-products__filter .checkbox-list.type label {
    color: #b85a22 !important;
}
html[data-theme="dark"] .catalog-products__filter .checkbox-list label::after {
    border-color: #777;
}
html[data-theme="dark"] .catalog-products__filter .checkbox-list-box .title svg path {
    stroke: #d0d0d0;
}
@media (max-width: 950px) {
    html[data-theme="dark"] .catalog-products__filter,
    html[data-theme="dark"] .catalog-products__filter .filter-btn {
        background: #1d1d1d;
    }
}

/* v5 — product detail page */
html[data-theme="dark"] .product-detail__preview .left .info h1 {
    color: #f1f1f1 !important;
}
html[data-theme="dark"] .product-detail__preview .left .info .article {
    color: #b85a22 !important;
}
html[data-theme="dark"] .product-detail__preview .left .info .price > * {
    color: #b6b6b6 !important;
}
html[data-theme="dark"] .product-detail__preview .left .info .price .number {
    color: #f1f1f1 !important;
}
html[data-theme="dark"] .product-detail__preview .left .info .property-list > * {
    color: #b6b6b6 !important;
}
html[data-theme="dark"] .product-detail__preview .left .controll .btn span {
    color: #f1f1f1 !important;
}
html[data-theme="dark"] .product-detail__preview .left .controll .btn svg path,
html[data-theme="dark"] .product-detail__preview .left .controll .btn svg line,
html[data-theme="dark"] .product-detail__preview .left .controll .btn svg rect {
    stroke: #b85a22;
}
html[data-theme="dark"] .product-detail__property .tabs-title > * {
    color: #d0d0d0 !important;
}
html[data-theme="dark"] .product-detail__property .content .text,
html[data-theme="dark"] .product-detail__property .content .property-list > * {
    color: #b6b6b6 !important;
}
html[data-theme="dark"] .product-detail__tab > .title span {
    color: #f1f1f1 !important;
}
html[data-theme="dark"] .product-detail__tab > .title svg path,
html[data-theme="dark"] .product-detail__tab > .title svg line {
    stroke: #d0d0d0;
}
html[data-theme="dark"] .product-detail__preview::after,
html[data-theme="dark"] .product-detail__property::after,
html[data-theme="dark"] .product-detail__tab::after {
    background: rgba(255,255,255,.12);
}


/* v6 — become-a-partner page */
html[data-theme="dark"] .section-dealer .left .info,
html[data-theme="dark"] .section-dealer .right {
    color: #c9c9c9 !important;
}
html[data-theme="dark"] .section-dealer .left .info :where(p,span,li,a,strong,b),
html[data-theme="dark"] .section-dealer .right :where(p,span,li,a,strong,b) {
    color: inherit !important;
}
html[data-theme="dark"] .section-dealer .left .info strong,
html[data-theme="dark"] .section-dealer .right strong,
html[data-theme="dark"] .section-dealer .left .info b,
html[data-theme="dark"] .section-dealer .right b {
    color: #f1f1f1 !important;
}

/* Put desktop theme control at the very bottom of the fixed left panel. */
.theme-switcher--sidebar-bottom {
    position: absolute;
    left: 0;
    bottom: 18px;
    margin: 0;
    z-index: 5;
}

/* v7 — vacancies: keep light cards readable inside dark theme */
html[data-theme="dark"] .section-vacancy__item,
html[data-theme="dark"] .section-vacancy__contact {
    background: #eeeeee !important;
}
html[data-theme="dark"] .section-vacancy__item .title,
html[data-theme="dark"] .section-vacancy__item .controll .left .price,
html[data-theme="dark"] .section-vacancy__item .controll .left .time,
html[data-theme="dark"] .section-vacancy__item .controll .left .time span,
html[data-theme="dark"] .section-vacancy__contact h2 {
    color: #1d1d1d !important;
}
html[data-theme="dark"] .section-vacancy__item .text,
html[data-theme="dark"] .section-vacancy__contact address {
    color: #737373 !important;
}
html[data-theme="dark"] .section-vacancy__item .category,
html[data-theme="dark"] .section-vacancy__contact .link a {
    color: #954617 !important;
}
html[data-theme="dark"] .section-vacancy__item .controll .left .time svg path {
    fill: #393232 !important;
}
html[data-theme="dark"] .section-vacancy__item .controll .right .arrow {
    background: #ffffff !important;
}

/* v8 — vacancies: dark cards in dark theme, so all legacy/inherited text stays readable */
html[data-theme="dark"] .section-vacancy__item,
html[data-theme="dark"] .section-vacancy__contact {
    background: #292929 !important;
}
html[data-theme="dark"] .section-vacancy__item .title,
html[data-theme="dark"] .section-vacancy__item .text,
html[data-theme="dark"] .section-vacancy__item .controll,
html[data-theme="dark"] .section-vacancy__item .controll *,
html[data-theme="dark"] .section-vacancy__contact,
html[data-theme="dark"] .section-vacancy__contact h2,
html[data-theme="dark"] .section-vacancy__contact address,
html[data-theme="dark"] .section-vacancy__contact .link,
html[data-theme="dark"] .section-vacancy__contact .link * {
    color: #eeeeee !important;
}
html[data-theme="dark"] .section-vacancy__item .text,
html[data-theme="dark"] .section-vacancy__contact address {
    color: #b9b9b9 !important;
}
html[data-theme="dark"] .section-vacancy__item .category,
html[data-theme="dark"] .section-vacancy__contact .link a {
    color: #c5652d !important;
}
html[data-theme="dark"] .section-vacancy__item .controll .left .time svg path {
    fill: #b9b9b9 !important;
}
html[data-theme="dark"] .section-vacancy__item .controll .right .arrow {
    background: #363636 !important;
}

/* v9 — advantages page */
html[data-theme="dark"] .section-advantages {
    color: #c9c9c9 !important;
}
html[data-theme="dark"] .section-advantages > :where(p, div):not(.section-advantages__cards),
html[data-theme="dark"] .section-advantages > :where(p, div):not(.section-advantages__cards) :where(p, span, li) {
    color: #c9c9c9;
}
html[data-theme="dark"] .section-advantages h1,
html[data-theme="dark"] .section-advantages h2,
html[data-theme="dark"] .section-advantages > h3,
html[data-theme="dark"] .section-advantages b,
html[data-theme="dark"] .section-advantages strong {
    color: #f1f1f1 !important;
}
html[data-theme="dark"] .section-advantages a {
    color: #e0e0e0;
}

/* Advantage tiles are dark in dark mode instead of retaining their legacy white background. */
html[data-theme="dark"] .section-advantages__cards--item {
    background: #292929 !important;
    border: 1px solid rgba(255,255,255,.08);
}
html[data-theme="dark"] .section-advantages__cards--item,
html[data-theme="dark"] .section-advantages__cards--item h3,
html[data-theme="dark"] .section-advantages__cards--item .title,
html[data-theme="dark"] .section-advantages__cards--item .title h3,
html[data-theme="dark"] .section-advantages__cards--item > span:not(.title) {
    color: #eeeeee !important;
}
html[data-theme="dark"] .section-advantages__cards--item > span:not(.title) {
    color: #b9b9b9 !important;
}
html[data-theme="dark"] .section-advantages__cards--item h3 a {
    color: #c5652d !important;
}

/* v10 — dark left navigation panel */
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar .fixed-menu {
    background: #292929 !important;
    color: #eeeeee !important;
}
html[data-theme="dark"] .sidebar::after {
    background: #292929 !important;
}
html[data-theme="dark"] .sidebar-menu__link,
html[data-theme="dark"] .sidebar-submenu__link,
html[data-theme="dark"] .sidebar-menu__link.number-box .title,
html[data-theme="dark"] .sidebar-menu__link.number-box .number,
html[data-theme="dark"] .sidebar nav a,
html[data-theme="dark"] .sidebar nav span:not(.type) {
    color: #d7d7d7 !important;
}
html[data-theme="dark"] .sidebar-menu__link:hover,
html[data-theme="dark"] .sidebar-submenu__link:hover,
html[data-theme="dark"] .sidebar-menu__link.active,
html[data-theme="dark"] .sidebar-submenu__link.active {
    color: #ffffff !important;
}
html[data-theme="dark"] .sidebar-menu__title path,
html[data-theme="dark"] .sidebar svg path:not(.fil0):not(.fil1) {
    stroke: #d7d7d7;
}
/* Sidebar logo in this template is an inline white SVG — keep it readable. */
html[data-theme="dark"] .sidebar .logo .fil0,
html[data-theme="dark"] .sidebar .logo .fil1 {
    fill: #eeeeee !important;
}
html[data-theme="dark"] .sidebar .qr-text {
    color: #b9b9b9 !important;
}
html[data-theme="dark"] .theme-switcher--sidebar {
    background: #1f1f1f !important;
    border-color: #444 !important;
}
html[data-theme="dark"] .theme-switcher--sidebar .theme-switcher__button {
    color: #a9a9a9 !important;
}
html[data-theme="dark"] .theme-switcher--sidebar .theme-switcher__button:hover {
    color: #ffffff !important;
}
html[data-theme="dark"] .theme-switcher--sidebar .theme-switcher__button.is-active {
    background: #3a3a3a !important;
    color: #c5652d !important;
}

/* v11 — preserve hero images in dark mode.
   Legacy template puts .section-preview-bg::after at z-index:-1; a dark background on
   the page then paints over that negative layer. Keep the image inside the section's
   own stacking context instead. */
html[data-theme="dark"] .section-preview-bg {
    isolation: isolate;
    overflow: hidden;
}
html[data-theme="dark"] .section-preview-bg::after {
    z-index: 0 !important;
}
html[data-theme="dark"] .section-preview-bg::before {
    z-index: 1 !important;
}
html[data-theme="dark"] .section-preview-bg > * {
    position: relative;
    z-index: 2 !important;
}

/* v12 — hero image stacking fix.
   Keep the template's original layering: image behind, dark overlay above it,
   content above both. isolation keeps the negative image layer inside the hero
   instead of letting the dark page background cover it. */
html[data-theme="dark"] .section-preview-bg {
    position: relative;
    isolation: isolate;
    z-index: 0;
    overflow: hidden;
    background: transparent !important;
}
html[data-theme="dark"] .section-preview-bg::after {
    z-index: -1 !important;
}
html[data-theme="dark"] .section-preview-bg::before {
    z-index: 0 !important;
}
html[data-theme="dark"] .section-preview-bg > * {
    position: relative;
    z-index: 1 !important;
}

/* v13 — preserve the template hero geometry in dark mode.
   The original background pseudo-element is intentionally 90svw wide, extending
   beyond the section itself. Do not clip it. Keep image/overlay/content as 0/1/2. */
html[data-theme="dark"] .section-preview-bg {
    position: relative;
    isolation: isolate;
    overflow: visible !important;
    background: transparent !important;
}
html[data-theme="dark"] .section-preview-bg::after {
    z-index: 0 !important;
}
html[data-theme="dark"] .section-preview-bg::before {
    z-index: 1 !important;
}
html[data-theme="dark"] .section-preview-bg > * {
    position: relative;
    z-index: 2 !important;
}

/* v14 — constructor category buttons */
html[data-theme="dark"] .section-compare-category__item {
    background: #292929 !important;
    color: #d6d6d6 !important;
    border: 1px solid #3b3b3b;
}
html[data-theme="dark"] .section-compare-category__item:hover {
    background: #343434 !important;
    color: #ffffff !important;
}
html[data-theme="dark"] .section-compare-category__item.active {
    background: #a94d17 !important;
    border-color: #a94d17 !important;
    color: #ffffff !important;
}

/* v15 — brands grid: lighter cells in dark mode so original brand logos stay readable */
html[data-theme="dark"] .section-brand__item {
    background: #3a3a3a !important;
    border-color: #5a5a5a !important;
}
html[data-theme="dark"] .section-brand__item .content .text,
html[data-theme="dark"] .section-brand__item .content .text a {
    color: #ffffff !important;
}
html[data-theme="dark"] .section-brand__item .content ul li,
html[data-theme="dark"] .section-brand__item .content ul li a {
    color: #c9c9c9 !important;
}
html[data-theme="dark"] .section-brand__item:hover {
    background: #424242 !important;
}

/* v16 — brands grid: raise cell luminance for low-contrast grey logos (Impress, GENTAS, ALF) */
html[data-theme="dark"] .section-brand__item {
    background: #686868 !important;
    border-color: #858585 !important;
}
html[data-theme="dark"] .section-brand__item:hover {
    background: #727272 !important;
}
html[data-theme="dark"] .section-brand__item .content ul li,
html[data-theme="dark"] .section-brand__item .content ul li a {
    color: #eeeeee !important;
}

/* v17 — brands: do not wash out dark logos on hover.
   A slightly darker hover keeps GENTAS/Impress readable and also improves white FENIX. */
html[data-theme="dark"] .section-brand__item:hover {
    background: #5c5c5c !important;
    border-color: #7a7a7a !important;
}

/* v18 — FAQ controls: original SVG has a hard-coded dark stroke. */
html[data-theme="dark"] .section-faq__item .controll svg path {
    stroke: #d9d9d9 !important;
}
html[data-theme="dark"] .section-faq__item:hover .controll svg path,
html[data-theme="dark"] .section-faq__item.active .controll svg path {
    stroke: #c5652d !important;
}

/* v19 — white modal forms stay light even when the page uses dark theme. */
html[data-theme="dark"] #modal-subscribe > .box .title,
html[data-theme="dark"] .modal-form > .box .title {
    color: #1d1d1d !important;
}

/* v20 — catalog filter checkboxes: hide the check mark until the option is selected. */
html[data-theme="dark"] .catalog-products__filter .checkbox-list label::before {
    content: none !important;
}
html[data-theme="dark"] .catalog-products__filter .checkbox-list input:checked ~ label::before {
    content: url('data:image/svg+xml,<svg width="12" height="9" viewBox="0 0 12 9" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 3.72727L4.52941 7L11 1" stroke="white" stroke-width="2"/></svg>') !important;
}

/* v21 — product gallery: keep image border inside slider bounds */
.product-detail__preview .right .slide-item img {
    box-sizing: border-box;
}
html[data-theme="dark"] .product-detail__preview .right .slide-item img {
    border-color: #d8d8d8;
}
