/* KARPART-style site header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1040;
    width: 100%;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.site-header-container {
    --bs-gutter-x: 2rem;
    max-width: 100%;
    padding-left: max(1rem, calc((100% - var(--site-max-width, 1400px)) / 2));
    padding-right: max(1rem, calc((100% - var(--site-max-width, 1400px)) / 2));
}

.site-header a {
    text-decoration: none;
}

/* Top utility bar */
.site-header-top {
    width: 100%;
    background: #0379c3;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8rem;
    color: #fff;
}

.site-header-top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 38px;
}

.site-header-links {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-header-links li + li {
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    margin-left: 1rem;
    padding-left: 1rem;
}

.site-header-links a {
    color: #fff;
    transition: opacity 0.2s;
}

.site-header-links a:hover {
    color: #fff;
    opacity: 0.85;
}

.site-header-email-link,
.site-header-phone-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.site-header-email-link i,
.site-header-phone-link i {
    font-size: 0.78rem;
    opacity: 0.92;
}

.site-header-social {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.site-header-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    color: #fff;
    font-size: 0.82rem;
    transition: background 0.2s, opacity 0.2s;
}

.site-header-social a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    opacity: 1;
}

/* Main header row */
.site-header-main {
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #ececec;
    position: relative;
}

.site-header-main-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 78px;
}

.site-header-nav-wrap {
    position: static;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    justify-content: center;
}

.site-header-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    background: #ffffff;
    border-radius: 4px;
}

.site-header-logo-img {
    display: block;
    width: auto;
    height: 46px;
    max-width: min(220px, 42vw);
    object-fit: contain;
}

.site-header-toggle {
    border: 1px solid #ddd;
    background: #fff;
    width: 42px;
    height: 42px;
    border-radius: 4px;
    font-size: 1.4rem;
    color: #333;
    margin-left: auto;
}

.site-header-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem 1.35rem;
}

.site-header-nav > a,
.site-header-nav-dropdown > a {
    color: #222;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0;
    white-space: nowrap;
}

.site-header-nav > a.active,
.site-header-nav-dropdown > a.active,
.site-header-nav > a:hover,
.site-header-nav-dropdown > a:hover {
    color: var(--brand-primary, #0379c3);
}

.site-header-nav > a i,
.site-header-nav-dropdown > a i {
    font-size: 0.6rem;
    opacity: 0.75;
}

.site-header-nav-dropdown {
    position: relative;
}

.site-header-nav-dropdown--mega:hover::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 0.65rem;
}

.site-header-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid #ececec;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: 0.2s ease;
    z-index: 20;
}

.site-header-nav-dropdown--mega > a {
    gap: 0.35rem;
}

.site-header-nav-dropdown--mega > a .bi-chevron-down {
    transition: transform 0.2s ease;
}

.site-header-nav-dropdown--mega.open > a .bi-chevron-down {
    transform: rotate(180deg);
}

.site-header-mega-menu {
    top: calc(100% + 0.35rem);
    min-width: 0;
    padding: 0;
    border-radius: 6px;
    overflow: hidden;
    z-index: 30;
}

.site-header-mega-menu-inner {
    padding: 1.25rem 1.35rem 1.4rem;
    max-height: min(72vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.site-header-mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.2rem 1.35rem;
    align-items: start;
}

.site-header-mega-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0;
    color: #444;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.4;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.site-header-mega-thumb {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 4px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f3f6f9;
    border: 1px solid #e3e9ef;
}

.site-header-mega-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-header-mega-thumb i {
    color: var(--brand-primary, #0379c3);
    font-size: 0.95rem;
    line-height: 1;
}

.site-header-mega-label {
    min-width: 0;
}

.site-header-mega-link--all {
    color: var(--brand-primary, #0379c3);
    font-weight: 700;
}

.site-header-mega-link:hover {
    color: var(--brand-primary, #0379c3);
    border-bottom-color: rgba(3, 121, 195, 0.15);
}

.site-header-mega-menu .site-header-mega-link {
    display: flex;
    padding: 0.55rem 0;
}

.site-header-mega-menu .site-header-mega-link:hover {
    background: transparent;
}

.site-header-nav-dropdown:hover .site-header-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (min-width: 1200px) {
    .site-header-main-inner {
        position: static;
    }

    .site-header-nav-dropdown.site-header-nav-dropdown--mega {
        position: static;
    }

    .site-header-dropdown-menu.site-header-mega-menu {
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
        min-width: 0;
        top: 100%;
        transform: translateY(8px);
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.1);
    }

    .site-header-mega-menu-inner {
        padding-top: 1.35rem;
        padding-bottom: 1.5rem;
        padding-left: max(1rem, calc((100% - var(--site-max-width, 1400px)) / 2));
        padding-right: max(1rem, calc((100% - var(--site-max-width, 1400px)) / 2));
        max-height: min(70vh, 500px);
    }

    .site-header-mega-menu-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.35rem 1.75rem;
    }

    .site-header-mega-link {
        padding: 0.6rem 0;
    }

    .site-header-mega-thumb {
        width: 2.15rem;
        height: 2.15rem;
    }

    .site-header-nav-dropdown--mega:hover .site-header-mega-menu,
    .site-header-nav-dropdown--mega.open .site-header-mega-menu {
        transform: translateY(0);
    }
}

@media (min-width: 1400px) {
    .site-header-mega-menu-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.site-header-dropdown-menu a {
    display: block;
    padding: 0.55rem 1rem;
    color: #444;
    font-size: 0.85rem;
    font-weight: 500;
}

.site-header-dropdown-menu a:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--brand-primary, #0379c3);
}

.site-header-support {
    align-items: center;
    gap: 0.85rem;
    flex-shrink: 0;
}

.site-header-support-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    background: #e9eef5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7b8c;
    font-size: 1.4rem;
}

.site-header-support-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.site-header-support-text span {
    font-size: 0.72rem;
    color: #666;
}

.site-header-support-text a {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand-primary, #0379c3);
}

.site-header-reviews {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding-left: 0.85rem;
    border-left: 1px solid #e5e5e5;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.site-header-reviews:hover,
.site-header-reviews:focus-visible {
    opacity: 0.85;
    text-decoration: none;
    color: inherit;
}

.site-header-reviews-score {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--brand-primary, #0379c3);
    color: var(--brand-primary, #0379c3);
    font-weight: 800;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.site-header-reviews-stars {
    color: var(--brand-primary, #0379c3);
    font-size: 0.72rem;
    letter-spacing: -0.05em;
}

.site-header-reviews small {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.03em;
}

/* Full-width toolbar */
.site-header-toolbar {
    width: 100%;
    background: transparent;
    color: #fff;
}

.site-header-toolbar-inner {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: stretch;
    width: 100%;
    min-height: 58px;
    position: relative;
}

.site-header-toolbar-categories {
    background: var(--brand-black, #111111);
}

.site-header-toolbar-vehicle {
    background: var(--brand-primary, #0077c8);
    display: flex;
    align-items: stretch;
}

.site-header-toolbar-search {
    background: #fff;
    min-width: 0;
}

.site-header-toolbar-actions {
    background: var(--brand-black, #111111);
    padding: 0 1.25rem;
}

.site-header-categories {
    position: relative;
    flex-shrink: 0;
}

.site-header-categories-btn {
    height: 100%;
    min-height: 58px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0 1.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    white-space: nowrap;
}

.site-header-categories-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.site-header-category-panel {
    position: absolute;
    top: 100%;
    left: 0;
    width: min(320px, 90vw);
    background: #fff;
    border: 1px solid #e8e8e8;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    z-index: 30;
}

.site-header-category-grid {
    display: grid;
    gap: 0;
    padding: 0.5rem 0;
}

.site-header-category-grid a {
    display: block;
    padding: 0.6rem 1rem;
    color: #333;
    font-size: 0.88rem;
}

.site-header-category-grid a:hover,
.site-header-category-grid a.view-all {
    color: var(--brand-primary, #0379c3);
    background: rgba(0, 0, 0, 0.03);
}

.site-header-search {
    flex: 1;
    display: flex;
    align-items: stretch;
    min-width: 0;
    width: 100%;
}

.site-header-vehicle-btn {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0 1.15rem;
    height: 100%;
    min-height: 58px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.site-header-vehicle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.site-header-search-field {
    flex: 1;
    display: flex;
    align-items: stretch;
    background: #fff;
    min-width: 0;
    width: 100%;
}

.site-header-search-field input {
    flex: 1;
    border: 0;
    padding: 0 1rem;
    font-size: 0.9rem;
    min-width: 0;
}

.site-header-search-field input:focus {
    outline: none;
}

.site-header-search-field button {
    border: 0;
    background: transparent;
    width: 48px;
    color: #666;
    font-size: 1.1rem;
}

.site-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    height: 100%;
    min-height: 58px;
}

.site-header-action {
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.site-header-action:hover {
    color: var(--brand-primary-light, #3399d6);
}

.site-header-icon-btn {
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
}

.site-header-icon-btn:hover {
    color: var(--brand-primary-light, #3399d6);
}

.site-header-cart {
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 1.15rem;
}

.site-header-cart span {
    color: var(--brand-primary, #0379c3);
    font-size: 0.95rem;
    font-weight: 700;
}

.site-header-cart:hover {
    color: var(--brand-primary-light, #3399d6);
}

/* Tablet and smaller laptops use the hamburger menu */
@media (max-width: 1199.98px) {
    .site-header-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .site-header-main-inner {
        flex-wrap: wrap;
        min-height: auto;
        padding: 0.85rem 0;
    }

    .site-header-nav-wrap {
        flex: 1 1 100%;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 0 0.25rem;
    }

    .site-header-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .site-header-nav > a,
    .site-header-nav-dropdown > a {
        min-height: 44px;
        padding: 0.75rem 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .site-header-nav-dropdown--mega > a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .site-header-nav-dropdown:hover .site-header-dropdown-menu,
    .site-header-nav-dropdown:hover .site-header-mega-menu {
        transform: none;
    }

    .site-header-dropdown-menu,
    .site-header-mega-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 0;
        padding: 0;
        display: none;
        width: 100%;
        max-height: none;
    }

    .site-header-mega-menu-inner {
        padding: 0.35rem 0 0.65rem 0.5rem;
        max-height: min(55vh, 360px);
        overflow-y: auto;
    }

    .site-header-mega-menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.15rem 0.85rem;
    }

    .site-header-mega-link {
        padding: 0.45rem 0;
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .site-header-mega-thumb {
        width: 1.75rem;
        height: 1.75rem;
        border-radius: 3px;
    }

    .site-header-nav-dropdown.open .site-header-dropdown-menu,
    .site-header-nav-dropdown.open .site-header-mega-menu {
        display: block;
    }

    .site-header-toolbar-inner {
        grid-template-columns: 1fr;
    }

    .site-header-toolbar-categories,
    .site-header-toolbar-vehicle,
    .site-header-toolbar-search,
    .site-header-toolbar-actions {
        width: 100%;
    }

    .site-header-toolbar-actions {
        justify-content: space-between;
        padding: 0.75rem 1rem;
    }

    .site-header-categories-btn,
    .site-header-vehicle-btn {
        width: 100%;
        justify-content: center;
    }

    .site-header-search-field {
        min-height: 48px;
    }
}

@media (max-width: 575.98px) {
    .site-header-logo-img {
        height: 38px;
        max-width: min(190px, 58vw);
    }

    .site-header-action span {
        display: none;
    }

    .site-header-mega-menu-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .site-header-mega-menu-inner {
        max-height: min(50vh, 320px);
    }
}
