/* ============================================================
   ChemSmog Header — Figma v4 layout (defensive selectors)
   ============================================================ */

/* Force resets on our scope */
body .cs-header,
body .cs-header *,
body .cs-header-mobile,
body .cs-header-mobile * {
    box-sizing: border-box;
}

body .cs-header {
    font-family: var(--cs-font-primary);
    background: var(--cs-white);
    border-bottom: 1px solid var(--cs-divider);
    width: 100%;
    display: block;
}

/* ---------- Top promo bar ---------- */
body .cs-header .cs-header__promo {
    background: var(--cs-white);
    color: var(--cs-text);
    padding: 8px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--cs-divider);
    width: 100%;
}
body .cs-header .cs-header__promo > .cs-container {
    width: 100% !important;
    max-width: 1440px !important;
    margin: 0 auto !important;
    padding: 0 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px;
}
body .cs-header .cs-header__promo-center {
    flex: 1;
    text-align: center;
    color: var(--cs-green);
    font-weight: 500;
    font-size: 12px;
}
body .cs-header .cs-header__promo-left,
body .cs-header .cs-header__promo-right {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 180px;
}
body .cs-header .cs-header__promo-right { justify-content: flex-end; }
body .cs-header .cs-header__promo-right a {
    color: var(--cs-text);
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}
body .cs-header .cs-header__promo-right a:hover { color: var(--cs-blue); }
body .cs-header .cs-social {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: #0a66c2;
}
body .cs-header .cs-social.instagram { color: #e1306c; }

/* ---------- Main bar ---------- */
body .cs-header .cs-header__main {
    background: var(--cs-bg);
    padding: 16px 0;
    width: 100%;
}
body .cs-header .cs-header__main > .cs-container {
    width: 100% !important;
    max-width: 1440px !important;
    margin: 0 auto !important;
    padding: 0 24px !important;
    display: flex !important;
    align-items: center !important;
    gap: 24px !important;
    flex-wrap: nowrap;
}

/* Logo */
body .cs-header .cs-header__logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}
body .cs-header .cs-header__logo img {
    max-height: 50px;
    width: auto;
    display: block;
}

/* Main nav */
body .cs-header .cs-header__nav {
    flex: 1 1 auto;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 24px;
}
body .cs-header .cs-header__nav-list {
    display: flex !important;
    gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-direction: row !important;
}
body .cs-header .cs-header__nav-list > li {
    list-style: none;
    margin: 0;
    padding: 0;
}
body .cs-header .cs-header__nav-list > li > a {
    color: var(--cs-blue);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0;
    transition: color .15s ease;
    text-decoration: none;
    white-space: nowrap;
}
body .cs-header .cs-header__nav-list > li > a:hover { color: var(--cs-teal); }

/* Shop by Category CTA */
body .cs-header .cs-shop-category-wrap { position: relative; flex: 0 0 auto; }
body .cs-header .cs-shop-category-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: linear-gradient(90deg, var(--cs-btn-g1) 0%, var(--cs-btn-g2) 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,123,169,0.2);
    transition: transform .15s ease, box-shadow .15s ease;
    text-decoration: none;
    white-space: nowrap;
}
body .cs-header .cs-shop-category-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,123,169,0.3);
    color: #ffffff !important;
}
body .cs-header .cs-shop-category-btn .cs-icon-burger { font-size: 14px; line-height: 1; }

/* Right utilities (search/user/cart) */
body .cs-header .cs-header__utils {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}
body .cs-header .cs-header__utils > a {
    color: var(--cs-blue);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    position: relative;
    transition: background .15s ease;
    text-decoration: none;
}
body .cs-header .cs-header__utils > a:hover { background: rgba(0,123,169,0.08); }
body .cs-header .cs-header__utils > a > svg { width: 20px; height: 20px; }
body .cs-header .cs-header__utils .cs-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--cs-blue);
    color: var(--cs-white);
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Hide Farmart default header */
body > header.header,
body > .header,
body header.header.header-js-handler:not(.cs-header):not(.cs-header-mobile) {
    display: none !important;
}

/* Mobile / desktop visibility */
@media (max-width: 991.98px) {
    body .cs-header { display: none !important; }
    body .cs-header-mobile { display: flex !important; }
}
@media (min-width: 992px) {
    body .cs-header { display: block !important; }
    body .cs-header-mobile { display: none !important; }
}

/* Menu + top-bar font size bump (client request +10%, Figma sizes) */
body .cs-header .cs-header__nav-list > li > a { font-size: 16px !important; }
body .cs-header .cs-header__promo,
body .cs-header .cs-header__promo-center,
body .cs-header .cs-header__promo-left,
body .cs-header .cs-header__promo-right,
body .cs-header .cs-header__promo-right a { font-size: 14px !important; }

/* Language switcher (dropdown EN/IT nella top-bar) */
.cs-lang { position: relative; display: inline-flex; align-items: center; cursor: pointer; outline: none; }
.cs-lang__current { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: inherit; white-space: nowrap; }
.cs-lang__current svg { transition: transform .15s ease; }
.cs-lang:hover .cs-lang__current svg, .cs-lang:focus-within .cs-lang__current svg { transform: rotate(180deg); }
.cs-lang__menu {
    position: absolute; top: 100%; right: 0; margin: 6px 0 0; padding: 6px 0; min-width: 130px;
    list-style: none; background: #fff; border: 1px solid var(--cs-divider, #d9d9d9); border-radius: 10px;
    box-shadow: 0 12px 28px rgba(11, 64, 84, 0.16); z-index: 60;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.cs-lang:hover .cs-lang__menu, .cs-lang:focus-within .cs-lang__menu { opacity: 1; visibility: visible; transform: none; }
.cs-lang__menu li { margin: 0; }
.cs-lang__menu a { display: block; padding: 8px 16px; font-size: 14px; color: var(--cs-text, #575757); text-decoration: none; white-space: nowrap; }
.cs-lang__menu a:hover { background: var(--cs-bg, #f5f5f5); color: var(--cs-blue, #007ba9); }
.cs-lang__menu a.is-active { color: var(--cs-blue, #007ba9); font-weight: 600; }

