/**
 * Site header — logo, search, wishlist/compare actions.
 */

.vgl-header {
    background: var(--vgl-color-surface);
}

.vgl-header__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo search actions";
    align-items: center;
    gap: var(--vgl-space-3);
    padding-block: var(--vgl-space-3);
}

.vgl-header__logo {
    grid-area: logo;
    justify-self: start;
    flex-shrink: 0;
    line-height: 0;
}

.vgl-header__logo a {
    display: inline-block;
}

.vgl-header__logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(280px, 32vw);
    max-height: none;
}

/* Search — centered in the gap between logo and actions */
.vgl-header__search {
    grid-area: search;
    justify-self: center;
    width: min(660px, 100%);
    min-width: min(520px, 100%);
}

.vgl-header__search--desktop {
    position: relative;
    padding-bottom: 18px;
}

.vgl-header__search--desktop .after-search-text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin-top: 0;
}

.vgl-header__search .search-input-form {
    margin: 0;
    width: 100%;
}

.vgl-header__search .vgl-search-field,
.vgl-header__search .search-div {
    position: relative;
    width: 100%;
    margin: 0;
}

.vgl-header__search .vgl-search-field__label {
    display: block;
    margin: 0;
    width: 100%;
}

.vgl-header__search .after-search-text {
    display: block;
    width: 100%;
    margin-top: 4px;
    font-size: 11px;
    line-height: 14px;
    text-align: center;
    color: var(--vgl-color-text-muted);
    white-space: nowrap;
}

.vgl-header__search .search-input,
.vgl-header__search .fulltext_search_input,
.vgl-header__search .vgl-search-input {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 0 52px 0 var(--vgl-space-4);
    border: 2px solid var(--vgl-color-border);
    border-radius: var(--vgl-radius-lg);
    font-size: var(--vgl-font-size-lg);
    font-family: var(--vgl-font-family);
    background: var(--vgl-color-bg);
    box-shadow: var(--vgl-shadow-sm);
    outline: none;
    transition: border-color var(--vgl-transition), box-shadow var(--vgl-transition);
}

.vgl-header__search .search-input:focus,
.vgl-header__search .fulltext_search_input:focus,
.vgl-header__search .vgl-search-input:focus,
.vgl-header__search .vgl-search-field:focus-within .search-input,
.vgl-header__search .vgl-search-field:focus-within .fulltext_search_input,
.vgl-header__search .vgl-search-field:focus-within .vgl-search-input {
    border-color: var(--vgl-color-primary);
    box-shadow: 0 0 0 3px var(--vgl-color-primary-soft);
}

.vgl-header__search .vgl-search-field__icon,
.vgl-header__search .search-input-button {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 !important;
    padding: 0;
    background: transparent;
    color: var(--vgl-color-text-muted);
    border: none;
    border-radius: var(--vgl-radius);
    cursor: pointer;
    transition: color var(--vgl-transition), background var(--vgl-transition);
}

.vgl-header__search .vgl-search-field__icon:hover,
.vgl-header__search .search-input-button:hover,
.vgl-header__search .vgl-search-field:focus-within .vgl-search-field__icon,
.vgl-header__search .vgl-search-field:focus-within .search-input-button {
    color: var(--vgl-color-primary);
    background: var(--vgl-color-primary-soft);
}

.vgl-header__search .vgl-search-field__icon > i,
.vgl-header__search .search-input-button > i {
    font-size: 20px;
    line-height: 1;
}

.vgl-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--vgl-space-2);
    justify-self: end;
}

.vgl-header__actions .wishlist_icon,
.vgl-header__actions .compare_icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vgl-header__actions .wishlist_icon img {
    width: 40px;
    height: 40px;
    display: block;
}

.vgl-header__actions .wishlist_icon .total_saved,
.vgl-header__actions .compare_icon .total_saved {
    position: absolute;
    top: -6px;
    right: -4px;
    left: auto;
}

.vgl-header__actions .compare_icon.add-to-compare-btn {
    width: 40px;
    height: 40px;
    margin: 0;
    border: 2px solid #c9d3da;
    border-radius: 50%;
    background-position-x: -1px;
}

.vgl-header__actions .compare_icon.add-to-compare-btn:hover {
    border-color: var(--vgl-color-accent);
    background-position: -38px 0;
}

.vgl-header__toolbar {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
}

.vgl-header__user {
    position: relative;
}

.vgl-header__user-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.vgl-header__user-toggle img {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.vgl-header__user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1100;
    min-width: 250px;
    max-width: 320px;
    padding: var(--vgl-space-4);
    background: var(--vgl-color-surface);
    border: 1px solid var(--vgl-color-border);
    border-radius: var(--vgl-radius);
    box-shadow: var(--vgl-shadow-lg);
}

.vgl-header__user-menu[hidden] {
    display: none !important;
}

/* Desktop / mobile search variants */
.vgl-header__search--mobile {
    display: none;
}

.vgl-header__search--mobile .after-search-text {
    display: none;
}

/* Barcode scanner (mobile search) */
.vgl-search-field__scanner {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--vgl-radius);
    background: var(--vgl-color-primary);
    color: #fff;
    cursor: pointer;
    transition: background var(--vgl-transition), transform var(--vgl-transition);
}

.vgl-search-field__scanner:hover,
.vgl-search-field__scanner:focus-visible {
    background: #005a9e;
    outline: none;
}

.vgl-search-field--mobile {
    margin-top: 0;
}

.vgl-search-field__scanner-icon {
    display: block;
}

/* Mobile menu toggle */
.vgl-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--vgl-radius);
    background: transparent;
    cursor: pointer;
}

.vgl-nav-toggle__bars,
.vgl-nav-toggle__bars::before,
.vgl-nav-toggle__bars::after {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: var(--vgl-color-primary);
    transition: transform var(--vgl-transition), opacity var(--vgl-transition);
}

.vgl-nav-toggle__bars {
    position: relative;
}

.vgl-nav-toggle__bars::before,
.vgl-nav-toggle__bars::after {
    content: '';
    position: absolute;
    left: 0;
}

.vgl-nav-toggle__bars::before {
    top: -7px;
}

.vgl-nav-toggle__bars::after {
    top: 7px;
}

/* Entypo search icon (legacy markup) */
@font-face {
    font-family: 'entypo';
    src: url(../../../resources/fonts/icons/entypo.woff) format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.vgl-header__search i.icon-search::before {
    font-family: 'entypo', sans-serif;
    font-style: normal;
    font-weight: normal;
    content: "\e804";
    speak: never;
}

.hide-mobile {
    display: block;
}

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }

    .vgl-header__inner {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo toolbar"
            "search search";
        gap: var(--vgl-space-2) var(--vgl-space-3);
        padding-block: var(--vgl-space-2) var(--vgl-space-3);
    }

    .vgl-header__logo {
        grid-area: logo;
        align-self: center;
    }

    .vgl-header__logo img {
        max-width: min(200px, 52vw);
        max-height: 42px;
        width: auto;
        height: auto;
        object-fit: contain;
    }

    .vgl-header__toolbar {
        display: block;
        grid-area: toolbar;
        align-self: center;
    }

    .vgl-header__search--desktop {
        display: none;
    }

    .vgl-header__search--mobile {
        display: block;
        grid-area: search;
        justify-self: stretch;
        width: 100%;
        min-width: 0;
    }

    .vgl-header__search--mobile .vgl-search-field--mobile {
        margin-top: 10px;
    }

    .vgl-header__search--mobile .search-input,
    .vgl-header__search--mobile .mobile_fulltext_search_input {
        font-size: var(--vgl-font-size-base);
        min-height: 44px;
        padding-right: 92px;
    }

    .vgl-header__search--mobile .vgl-search-field__scanner {
        right: 48px;
    }

    .vgl-header__search--mobile .vgl-search-field__icon,
    .vgl-header__search--mobile .search-input-button {
        right: 8px;
    }

    .vgl-header__actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 4px;
    }

    .vgl-header__actions .vgl-header__compare {
        display: none;
    }

    .vgl-header__actions .wishlist_icon img {
        width: 32px;
        height: 32px;
    }

    .vgl-nav-toggle {
        display: inline-flex;
    }
}

@media (min-width: 768px) {
    .vgl-header__search--mobile {
        display: none !important;
        grid-area: unset;
        position: absolute;
        width: 0;
        height: 0;
        overflow: hidden;
        visibility: hidden;
        pointer-events: none;
    }

    .vgl-nav-toggle {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 1060px) {
    .vgl-header__logo img {
        max-width: 200px;
    }

    .vgl-header__search {
        width: clamp(420px, 50vw, 580px);
    }
}
