/* =====================================================================
   DlinkShop redesign 2026-11 — header (mockup "DlinkShop — редизайн главной")
   Colors: white, accent #00A8E8, text #0F1419. Font: Onest.
   Loaded from template/common/header.twig after the theme CSS.
   ===================================================================== */
:root {
    --dl-accent: #00A8E8;
    --dl-accent-soft: #E6F6FD;
    --dl-ink: #0F1419;
    --dl-ink-2: #4A5260;
    --dl-line: #E3E8EC;
    --dl-field: #F8FAFB;
    --dl-gray-bg: #F4F7F9;
    --dl-link: #00729F;
    --dl-font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ---------- 1. Black Friday promo strip ---------- */
.dl-promo,
.dl-promo:visited {
    display: block;
    background: var(--dl-ink);
    color: #ffffff;
    text-decoration: none;
    font-family: var(--dl-font);
}
.dl-promo:hover { color: #ffffff; }
.dl-promo-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 16px;
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}
.dl-promo-tag {
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--dl-accent);
    color: var(--dl-ink);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .06em;
}
.dl-promo-text b { color: var(--dl-accent); font-weight: 800; }
.dl-promo-more { color: var(--dl-accent); font-weight: 800; }
.dl-promo:hover .dl-promo-more { text-decoration: underline; }
@media (max-width: 575.98px) {
    .dl-promo-inner { gap: 8px; padding-top: 8px; padding-bottom: 8px; font-size: 13px; }
    .dl-promo-tag { font-size: 11px; padding: 3px 8px; }
}

/* ---------- 2. Top info bar (≥992px) ---------- */
.dl-topbar {
    background: var(--dl-gray-bg);
    border-bottom: 1px solid var(--dl-line);
    font-family: var(--dl-font);
    font-size: 13px;
    color: var(--dl-ink-2);
}
.dl-topbar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 28px;
    padding-top: 9px;
    padding-bottom: 9px;
}
.dl-topbar-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 24px; }
.dl-topbar-addr { display: inline-flex; align-items: center; gap: 6px; }
.dl-topbar-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.dl-topbar-links a,
.dl-topbar-links a:visited { color: var(--dl-ink-2); text-decoration: none; }
.dl-topbar-links a:hover { color: var(--dl-link); }

/* ---------- 3. Header shell ---------- */
.light-theme .ds-header.dl-header,
.ds-header.dl-header {
    background: #ffffff;
    box-shadow: none;
    border-bottom: 1px solid var(--dl-line);
    font-family: var(--dl-font);
}
.dl-header .ds-header-right .badge {
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #ffffff;
    border-radius: 10px;
    background: var(--dl-ink-2);
    color: #ffffff;
    font-family: var(--dl-font);
    font-size: 11px;
    font-weight: 800;
    align-items: center;
    justify-content: center;
    top: -6px;
    right: -6px;
}
.dl-header .ds-header-right .badge.active,
.dl-header .ds-cart-qty.active { background: var(--dl-accent); color: var(--dl-ink); }

/* account: icon only at every width (text kept for screen readers) */
.dl-header .ds-header-user-button > span:not(.button-icon-user) {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* phone dropdown toggle: number + "Передзвоніть мені" */
.dl-header .dl-phone-text { flex-direction: column; align-items: flex-start; line-height: 1.25; }
.dl-header .dl-hb-phone .ds-dropdown-toggle span { text-decoration: none; }
.dl-header .dl-phone-number { color: var(--dl-ink) !important; }
.dl-header .dl-phone-callback { color: var(--dl-link); font-size: 13px; font-weight: 600; }

/* ---------- 4. Desktop layout (≥992px) ---------- */
@media (min-width: 992px) {
    .ds-header.dl-header { padding-top: 16px !important; padding-bottom: 0 !important; }
    .dl-header > .container-xl > .d-flex { gap: 20px; margin-bottom: 14px !important; }

    /* right side: search · phone · icons, evenly spaced */
    .dl-header .ds-header-right { gap: 6px; padding-right: 0 !important; }
    .dl-header .ds-header-right > * { margin-left: 0 !important; margin-right: 0 !important; }
    .dl-header .ds-header-search { order: 0; margin-right: 18px; }
    .dl-header .dl-hb-phone { order: 1; margin-right: 12px !important; }
    .dl-header .ds-header-viewed-button { order: 2; }
    .dl-header .ds-header-compare-button { order: 3; }
    .dl-header .ds-header-wishlist-button { order: 4; }
    .dl-header .dl-hb-user { order: 5; }
    .dl-header #cart { order: 6; }

    /* phone */
    .dl-header .dl-hb-phone .ds-dropdown-toggle { width: auto !important; height: auto !important; }
    .dl-header .dl-hb-phone .button-icon-phone,
    .dl-header .dl-hb-phone .ds-arrow-down { display: none !important; }
    .dl-header .dl-phone-number { font-size: 17px !important; font-weight: 800 !important; letter-spacing: -.01em; white-space: nowrap; }

    /* icon buttons: 48×48 tiles */
    .dl-header .ds-header-right .ds-header-viewed-button,
    .dl-header .ds-header-right .ds-header-compare-button,
    .dl-header .ds-header-right .ds-header-wishlist-button,
    .dl-header .ds-header-right .ds-header-user-button,
    .dl-header .ds-header-right #cart {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        flex: 0 0 48px !important;
        border-radius: 12px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        transition: background .2s;
    }
    .dl-header .ds-header-right .ds-header-viewed-button:hover,
    .dl-header .ds-header-right .ds-header-compare-button:hover,
    .dl-header .ds-header-right .ds-header-wishlist-button:hover,
    .dl-header .ds-header-right .ds-header-user-button:hover { background: var(--dl-accent-soft) !important; }
    .dl-header .ds-header-right .button-transparent > svg { width: 22px; height: 22px; }
    .dl-header .ds-header-right .button-transparent:hover > svg path { fill: var(--dl-ink) !important; }

    .dl-header .ds-header-user-button .button-icon-user { width: 22px !important; height: 22px !important; background: var(--dl-ink); }

    /* cart: dark tile, white icon */
    .dl-header .ds-header-right #cart { background: var(--dl-ink) !important; }
    .dl-header .ds-header-right #cart:hover { background: var(--dl-accent) !important; }
    .dl-header #cart .button-icon-cart { width: 22px; height: 22px; background: #ffffff !important; }
    .dl-header #cart:hover .button-icon-cart { background: var(--dl-ink) !important; }

    /* dropdowns open under the 48px tiles */
    .dl-header .ds-dropdown { top: calc(100% + 10px); }
    /* account menu sits near the right edge now: open it leftwards */
    .dl-header .dl-hb-user .ds-dropdown { left: auto !important; right: 0 !important; }

    /* logo + catalog button */
    .dl-header #logo { max-width: 120px; }
}

/* ---------- 5. Catalog button (≥1200px, from common/menu.twig) ---------- */
.dl-header .button.ds-header-catalog-button {
    height: 48px;
    padding: 0 20px;
    gap: 10px;
    background: var(--dl-accent) !important;
    border: 0 !important;
    border-radius: 12px !important;
    color: var(--dl-ink) !important;
    font-family: var(--dl-font);
    white-space: nowrap;
    box-shadow: none !important;
    transition: background .2s, color .2s;
}
.dl-header .button.ds-header-catalog-button .button-text { font-size: 15px !important; font-weight: 700; color: inherit !important; }
.dl-header .button.ds-header-catalog-button svg path { fill: currentColor !important; }
.dl-header .button.ds-header-catalog-button:hover { background: var(--dl-ink) !important; color: #ffffff !important; }

/* ---------- 6. Search field (≥768px; on phones the theme slides it in) ---------- */
@media (min-width: 768px) {
    .dl-header .ds-header-search { flex: 1 1 320px; min-width: 0; padding-left: 0 !important; }
    .dl-header .ds-header-search .form-control {
        height: 48px;
        padding: 0 56px 0 18px;
        border: 1.5px solid #D5DCE2;
        border-radius: 12px !important;
        background: var(--dl-field);
        color: var(--dl-ink);
        font-family: var(--dl-font);
        font-size: 15px !important;
        font-weight: 500;
    }
    .dl-header .ds-header-search .form-control::placeholder { font-size: 15px; color: #6B7380; }
    .dl-header .ds-header-search .form-control:focus {
        border-color: var(--dl-accent);
        background: #ffffff;
        box-shadow: 0 0 0 3px rgba(0, 168, 232, .18);
    }
    .dl-header #ds-search-button.ds-header-search-button {
        right: 4px;
        width: 40px !important;
        height: 40px !important;
        border-radius: 9px;
        background: var(--dl-ink);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .dl-header #ds-search-button svg { width: 18px; height: 18px; }
    .dl-header #ds-search-button svg path,
    .dl-header #ds-search-button:hover svg path { fill: #ffffff !important; }
    .dl-header #ds-search-button:hover { background: var(--dl-accent); }
    .dl-header .ds-header-search .spinner-border { right: 52px; top: 14px; }
}

/* ---------- 7. Sections row (≥992px) ---------- */
.dl-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 14px;
    font-family: var(--dl-font);
}
.dl-chip,
.dl-chip:visited {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--dl-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    flex: 0 0 auto;
    text-decoration: none;
    transition: background .2s, color .2s;
}
.dl-chips::-webkit-scrollbar { display: none; }
.dl-chip:hover { background: var(--dl-gray-bg); color: var(--dl-ink); }
.dl-chip-dark,
.dl-chip-dark:visited,
.dl-chip-dark:hover { background: var(--dl-ink); color: #ffffff; }
.dl-chip-dark:hover { background: #26303b; }
.dl-chip-light,
.dl-chip-light:visited { background: var(--dl-accent-soft); }
.dl-chip-light:hover { background: #cdeefb; }
.dl-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dl-accent); }

/* ---------- 8. Phones / tablets (<992px): lighter touch, same colors ---------- */
@media (max-width: 991.98px) {
    .dl-header #cart .button-icon-cart { background: var(--dl-ink); }
    .dl-header .ds-header-catalog-button { display: none; }
}

/* ---------- 9. v2: text logo from the mockup ---------- */
.dl-logo,
.dl-logo:visited,
.dl-logo:hover {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    color: var(--dl-ink);
    text-decoration: none;
    font-family: var(--dl-font);
}
.dl-logo-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    background: var(--dl-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.dl-logo-word {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--dl-ink);
}
.dl-logo-word span { color: var(--dl-accent); }
@media (max-width: 575.98px) {
    .dl-logo { gap: 7px; }
    .dl-logo-mark { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; }
    .dl-logo-mark svg { width: 18px; height: 18px; }
    .dl-logo-word { font-size: 22px; }
}

/* ---------- 10. v3: account link (no dropdown) + phone dropdown hover gap ---------- */
.dl-header .dl-hb-user-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.dl-header .dl-hb-user-link .button-icon-user { width: 22px; height: 22px; background: var(--dl-ink); }
.dl-header .dl-hb-user-link:hover .button-icon-user { background: var(--dl-ink); }
@media (min-width: 768px) {
    /* the contacts dropdown opens right under the phone (no gap the cursor can fall into) */
    .dl-header .dl-hb-phone .ds-dropdown { top: 100% !important; }
    /* invisible bridge between the phone and the dropdown keeps it open while the mouse moves down */
    .dl-header .dl-hb-phone .ds-dropdown::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: -16px;
        height: 24px;
    }
}

/* ---------- 11. v4: mobile / tablet header icons (<992px) ----------
   no account icon; phone, search and cart as equal 40px tiles with 20px icons */
@media (max-width: 991.98px) {
    .dl-header .dl-hb-user { display: none !important; }
    .dl-header .ds-header-right { gap: 6px; padding-right: 0 !important; }
    .dl-header .ds-header-right > .dl-hb-phone,
    .dl-header .ds-header-right > .ds-header-search-toggle-button,
    .dl-header .ds-header-right > #cart { margin: 0 !important; }
    .dl-header .dl-hb-phone .ds-dropdown-toggle,
    .dl-header .ds-header-search-toggle-button,
    .dl-header .ds-header-right #cart {
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 40px;
        width: 40px !important;
        min-width: 40px !important;
        max-width: none !important;
        height: 40px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 12px !important;
        background: var(--dl-gray-bg) !important;
        box-shadow: none !important;
    }
    .dl-header .dl-hb-phone .dl-phone-text,
    .dl-header .dl-hb-phone .ds-arrow-down { display: none !important; }
    .dl-header .dl-hb-phone .button-icon-phone,
    .dl-header .ds-header-search-toggle-button .button-icon-search,
    .dl-header #cart .button-icon-cart {
        flex: 0 0 20px;
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
        background: var(--dl-ink) !important;
    }
    /* cart stands out: dark tile, white icon (as on desktop) */
    .dl-header .ds-header-right #cart { background: var(--dl-ink) !important; }
    .dl-header #cart .button-icon-cart { background: #ffffff !important; }
    .dl-header .ds-header-right #cart .badge { top: -5px; right: -5px; }
}
@media (max-width: 374.98px) {
    .dl-header .ds-header-right { gap: 4px; }
    .dl-header .dl-hb-phone .ds-dropdown-toggle,
    .dl-header .ds-header-search-toggle-button,
    .dl-header .ds-header-right #cart { flex-basis: 36px; width: 36px !important; min-width: 36px !important; height: 36px !important; border-radius: 10px !important; }
}
