/* ==========================================================================
   Lindhaus Custom Header
   ========================================================================== */

/* --- Variables --- */
:root {
    --lh-blue: #4992BB;
    --lh-blue-light: #DCEBF3;
    --lh-gray-bg: #EBEBEB;
    --lh-text: #565656;
    --lh-dark: #333;
    --lh-white: #fff;
    --lh-container: 1140px;
    --lh-radius: 10px;
    --lh-font-heading: 'Inter', sans-serif;
    --lh-font-body: 'Inter', sans-serif;
    --lh-header-height: 80px;
    --lh-topbar-height: 36px;
    --lh-transition: 0.25s ease;
}

/* --- Global utility rules --- */
[hidden] {
    display: none !important;
}

/* --- Container --- */
.lh-header .lh-container {
    max-width: var(--lh-container);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ==========================================================================
   TOP BAR
   ========================================================================== */
.lh-topbar {
    background: var(--lh-gray-bg);
    height: var(--lh-topbar-height);
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--lh-text);
    font-family: var(--lh-font-body);
}

.lh-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    width: 100%;
}

.lh-topbar__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 20px;
}

.lh-topbar__list a {
    color: var(--lh-text);
    text-decoration: none;
    font-size: 13px;
    transition: color var(--lh-transition);
}

.lh-topbar__list a:hover {
    color: var(--lh-blue);
}

/* ==========================================================================
   LANGUAGE SWITCHER
   ========================================================================== */
.lh-lang {
    position: relative;
}

.lh-lang__toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--lh-text);
    padding: 4px 0;
    font-family: var(--lh-font-body);
}

.lh-lang__toggle:hover {
    color: var(--lh-blue);
}

.lh-lang__flag {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
}

.lh-lang__arrow {
    transition: transform var(--lh-transition);
}

.lh-lang.is-open .lh-lang__arrow {
    transform: rotate(180deg);
}

.lh-lang__dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--lh-white);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    list-style: none;
    margin: 4px 0 0;
    padding: 4px 0;
    min-width: 100px;
    z-index: 1001;
    display: none;
}

.lh-lang.is-open .lh-lang__dropdown {
    display: block;
}

.lh-lang__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    color: var(--lh-text);
    text-decoration: none;
    font-size: 13px;
    transition: background var(--lh-transition);
}

.lh-lang__option:hover {
    background: var(--lh-gray-bg);
}

/* ==========================================================================
   MAIN NAV
   ========================================================================== */
.lh-mainnav {
    background: var(--lh-white);
    height: var(--lh-header-height);
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1000;
    transition: box-shadow var(--lh-transition);
}

.lh-mainnav.is-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    animation: lh-slideDown 0.3s ease;
}

@keyframes lh-slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Body padding when sticky */
body.lh-sticky-active {
    padding-top: var(--lh-header-height);
}

.lh-mainnav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 30px;
}

/* --- Logo --- */
.lh-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.lh-logo__img {
    height: 45px;
    width: auto;
}

.lh-logo__text {
    font-size: 24px;
    font-weight: 700;
    color: var(--lh-dark);
    font-family: var(--lh-font-heading);
}

/* --- Nav list --- */
.lh-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.lh-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0;
}

.lh-nav__item {
    position: static;
}

.lh-nav__link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    color: var(--lh-dark);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--lh-font-heading);
    white-space: nowrap;
    transition: color var(--lh-transition);
    position: relative;
}

.lh-nav__link:hover,
.lh-nav__item--current>.lh-nav__link {
    color: var(--lh-blue);
}

.lh-nav__link::after {
    display: none;
}

.lh-nav__arrow {
    width: 10px;
    height: 6px;
    transition: transform var(--lh-transition);
    flex-shrink: 0;
}

.lh-nav__item--has-dropdown:hover .lh-nav__arrow,
.lh-nav__link[aria-expanded="true"] .lh-nav__arrow {
    transform: rotate(180deg);
}

/* --- Search toggle --- */
.lh-search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--lh-dark);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--lh-transition);
    flex-shrink: 0;
}

.lh-search-toggle:hover {
    color: var(--lh-blue);
}

/* --- Hamburger --- */
.lh-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    outline: none;
}

.lh-hamburger__line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--lh-dark);
    border-radius: 2px;
    transition: transform var(--lh-transition), opacity var(--lh-transition);
}

/* ==========================================================================
   MEGA MENU DROPDOWN
   ========================================================================== */
.lh-mega {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--lh-white);
    border-top: 3px solid var(--lh-blue);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    padding: 40px 0;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--lh-transition), visibility var(--lh-transition), transform var(--lh-transition);
}

.lh-mega[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lh-mega__grid {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 12px;
    max-width: var(--lh-container);
    margin: 0 auto;
    padding: 0 20px;
}

.lh-mega__grid--circle {
    gap: 24px;
    flex-wrap: wrap;
}

.lh-mega__grid--circle .lh-mega__item {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 140px;
}

.lh-mega__grid--cards {
    gap: 16px;
}

.lh-mega__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 8px;
    transition: background var(--lh-transition);
    flex: 1 1 0;
    min-width: 0;
    max-width: 160px;
}

.lh-mega__item:hover {
    outline: 1px solid var(--lh-blue);
    border-radius: 8px;
}

.lh-mega__img-wrap {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lh-mega__img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Settori: immagini circolari */
.lh-mega__img-wrap--circle {
    width: 100px;
    height: 100px;
    border-radius: 999px;
    overflow: hidden;
}

.lh-mega__img-wrap--circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lh-mega__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--lh-dark);
    font-family: var(--lh-font-heading);
    line-height: 1.3;
}

/* --- Perché Lindhaus: card blu --- */
.lh-mega__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 100px;
    max-width: 140px;
}

.lh-mega__card:hover .lh-mega__card-icon {
    background: #7ab3d2;
    transform: translateY(-2px);
}

.lh-mega__card-icon {
    width: 100%;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #8DC1DD;
    border-radius: var(--lh-radius);
    padding: 30px;
    transition: background var(--lh-transition), transform var(--lh-transition);
}

@supports not (aspect-ratio: 3/4) {
    .lh-mega__card-icon {
        min-height: 200px;
    }
}

.lh-mega__card-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lh-mega__card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--lh-dark);
    font-family: var(--lh-font-heading);
    line-height: 1.3;
}

/* ==========================================================================
   SEARCH OVERLAY
   ========================================================================== */
.lh-search-overlay {
    position: fixed;
    top: calc(var(--lh-topbar-height) + var(--lh-header-height));
    left: 0;
    right: 0;
    background: var(--lh-white);
    z-index: 999;
    padding: 0 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
}

.lh-search-overlay.is-open {
    max-height: 500px;
    overflow: visible;
    opacity: 1;
    padding: 20px 0;
}

.lh-mainnav.is-sticky~.lh-search-overlay,
.lh-sticky-active .lh-search-overlay {
    top: var(--lh-header-height);
}

.lh-search-form {
    display: flex;
    align-items: center;
}

.lh-search-form__input {
    flex: 1;
    border: 2px solid var(--lh-blue);
    border-radius: var(--lh-radius);
    padding: 12px 16px;
    font-size: 16px;
    font-family: var(--lh-font-body);
    color: var(--lh-dark);
    outline: none;
    background: var(--lh-white);
}

/* ---------- Search Wrapper & Autocomplete ---------- */
.lh-search-wrapper {
    position: relative;
    width: 100%;
}

.lh-search-loading {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.lh-search-loading__spinner {
    display: block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--lh-gray-bg);
    border-top-color: var(--lh-blue);
    border-radius: 50%;
    animation: lh-spin 0.6s linear infinite;
}

@keyframes lh-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Results dropdown */
.lh-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--lh-white);
    border-radius: var(--lh-radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-height: 420px;
    overflow-y: auto;
}

.lh-search-results[hidden] {
    display: none;
}

/* Individual result item */
.lh-search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--lh-dark);
    border-bottom: 1px solid var(--lh-gray-bg);
    transition: background var(--lh-transition);
}

.lh-search-result:last-child {
    border-bottom: none;
}

.lh-search-result:hover,
.lh-search-result:focus {
    background: var(--lh-blue-light);
    outline: none;
}

.lh-search-result__title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Type chip */
.lh-search-result__chip {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.lh-search-result__chip--prodotto {
    background: var(--lh-blue);
    color: var(--lh-white);
    border-radius: 50px;
}

.lh-search-result__chip--articolo {
    background: var(--lh-blue);
    color: var(--lh-white);
    border-radius: 50px;
}

/* "Altri risultati" button */
.lh-search-results__more {
    display: block;
    width: 100%;
    padding: 14px 16px;
    text-align: center;
    background: var(--lh-gray-bg);
    color: var(--lh-blue);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #ddd;
    border-radius: 0 0 var(--lh-radius) var(--lh-radius);
    transition: background var(--lh-transition);
}

.lh-search-results__more:hover {
    background: var(--lh-blue-light);
}

/* No results message */
.lh-search-results__empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--lh-text);
    font-size: 14px;
}

/* Keyboard focus state */
.lh-search-result.is-focused {
    background: var(--lh-blue-light);
}

/* ==========================================================================
   MOBILE MENU
   ========================================================================== */
.lh-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lh-mobile-overlay.is-open {
    opacity: 1;
}

.lh-mobile-menu {
    position: absolute;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 380px;
    height: 100%;
    background: var(--lh-white);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    padding: 0 0 40px;
}

.lh-mobile-overlay.is-open .lh-mobile-menu {
    transform: translateX(0);
}

.lh-mobile-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--lh-gray-bg);
}

.lh-mobile-menu__header .lh-logo__img {
    height: 35px;
}

.lh-mobile-menu__close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--lh-dark);
    padding: 0 4px;
    line-height: 1;
}

/* --- Mobile nav list --- */
.lh-mobile-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.lh-mobile-nav__row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--lh-gray-bg);
}

.lh-mobile-nav__link {
    flex: 1;
    padding: 14px 20px;
    color: var(--lh-dark);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    font-family: var(--lh-font-heading);
}

.lh-mobile-nav__toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 14px 16px;
    color: var(--lh-dark);
    display: flex;
    align-items: center;
    transition: transform var(--lh-transition);
}

.lh-mobile-nav__toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Sub-menu mobile — griglia con immagini */
.lh-mobile-nav__sub {
    margin: 0;
    padding: 12px 16px;
    background: var(--lh-white);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
    padding-top: 0;
    padding-bottom: 0;
}

.lh-mobile-nav__sub.is-open {
    max-height: 800px;
    opacity: 1;
    padding-top: 12px;
    padding-bottom: 12px;
}

.lh-mobile-nav__sub--grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.lh-mobile-nav__sub-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    gap: 6px;
    padding: 8px 4px;
    border-radius: 8px;
}

.lh-mobile-nav__sub-item:hover,
.lh-mobile-nav__sub-item:active {
    outline: 1px solid var(--lh-blue);
    border-radius: 8px;
}

.lh-mobile-nav__sub-img {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lh-mobile-nav__sub-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lh-mobile-nav__sub-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--lh-dark);
    line-height: 1.3;
}

/* Perché Lindhaus: card blu nel mobile */
.lh-mobile-nav__sub--cards .lh-mobile-nav__sub-item,
.lh-mobile-nav__sub-item--card {
    background: #8DC1DD;
    border-radius: 10px;
    padding: 16px 8px;
}

.lh-mobile-nav__sub--cards .lh-mobile-nav__sub-label,
.lh-mobile-nav__sub-item--card .lh-mobile-nav__sub-label {
    color: #fff;
    font-weight: 600;
}

.lh-mobile-nav__sub-item {
    color: var(--lh-dark);
}

/* Override tema/Elementor link colors nel mobile menu */
.lh-mobile-menu a,
.lh-mobile-menu a:visited,
.lh-mobile-nav__sub a,
.lh-mobile-nav__sub a:visited {
    color: var(--lh-dark);
    text-decoration: none;
}

.lh-mobile-menu a:hover,
.lh-mobile-nav__sub a:hover {
    color: var(--lh-blue);
}

/* --- Top bar links in mobile --- */
.lh-mobile-menu__topbar {
    padding: 20px;
    border-top: 1px solid var(--lh-gray-bg);
    margin-top: 10px;
}

.lh-mobile-menu__topbar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lh-mobile-menu__topbar-list a {
    color: var(--lh-text);
    text-decoration: none;
    font-size: 14px;
}

.lh-mobile-menu__topbar-list a:hover {
    color: var(--lh-blue);
}

/* --- Lang in mobile --- */
.lh-mobile-menu__lang {
    padding: 10px 20px;
}

.lh-mobile-menu__lang .lh-lang__dropdown {
    position: static;
    box-shadow: none;
    background: #f8f8f8;
    border-radius: 6px;
    margin-top: 8px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Desktop: hide hamburger */
@media (min-width: 1025px) {
    .lh-hamburger {
        display: none;
    }

    .lh-mobile-overlay {
        display: none;
    }

    .lh-topbar {
        display: flex;
    }
}

/* Tablet & mobile */
@media (max-width: 1024px) {
    .lh-topbar {
        display: none;
    }

    .lh-nav {
        display: none;
    }

    .lh-hamburger {
        display: flex;
        background: none;
        border: none;
    }

    .lh-hamburger__line {
        background: var(--lh-dark);
    }

    .lh-search-toggle {
        background: none;
        border: none;
        color: var(--lh-dark);
    }

    .lh-mainnav {
        height: 60px;
    }

    .lh-mainnav__inner {
        gap: 12px;
    }

    .lh-logo__img {
        height: 35px;
    }

    :root {
        --lh-header-height: 60px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .lh-mobile-menu {
        width: 100%;
        max-width: none;
    }
}