/* Header */
.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 1440px;
    z-index: 1000;
    transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, box-shadow 0.4s ease;
    padding: 10px 40px;
    box-sizing: border-box;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 12px;
}

.header.scrolled {
    background: rgba(28, 26, 41, 0.65);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header__logo,
.header.scrolled .header__logo {
    width: 87px;
    height: 80px;
    display: flex;
    align-items: center;
    z-index: 1001;
}

.header__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header__nav ul {
    display: flex;
    list-style: none;
    gap: 40px;
    align-items: center;
}

.header__nav a {
    color: #FFF8EA;
    text-decoration: none;
    font-size: 16px;
    font-family: var(--font-main);
    font-weight: 400;
    line-height: 26px;
    transition: color 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header__nav a:hover {
    color: var(--accent-gold);
}

.header__nav > ul > li.active > a {
    color: #FFF8EA;
}

.header__nav > ul > li.active > a::after {
    content: "";
    display: block;
    width: 88px;
    height: 0px;
    outline: 1px var(--accent-gold) solid;
    outline-offset: -0.5px;
    margin-top: 4px;
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header__social {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
}
.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(253, 198, 103, 0.4);
    background: rgba(255, 248, 234, 0.06);
    color: #FFF8EA;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.social-icon:hover {
    background: rgba(253, 198, 103, 0.15);
    border-color: #FDC667;
    color: #FDC667;
}

.social-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Header wishlist/cart buttons */
.header-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(253, 198, 103, 0.4);
    background: rgba(255, 248, 234, 0.06);
    color: #FFF8EA;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    position: relative;
}

.header-action-icon:hover,
.header-action-icon.active {
    background: rgba(253, 198, 103, 0.15);
    border-color: #FDC667;
    color: #FDC667;
}

.header-action-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Badge for cart and wishlist in header */
.header-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #E84D4D;
    color: #FFF;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #1c1a29;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Burger Menu */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001;
}

.burger-menu span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--text-light);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.burger-menu.open span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.burger-menu.open span:nth-child(2) {
    opacity: 0;
}

.burger-menu.open span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Responsive */
@media screen and (max-width: 1440px) {
    .header,
    .header.scrolled {
        max-width: 100%;
        padding: 10px 40px;
        top: 20px;
    }
}

@media screen and (max-width: 1200px) {
    .header__nav ul {
        gap: 20px;
    }
    .header__nav a {
        font-size: 16px;
    }
}

@media screen and (max-width: 1240px) {
    .burger-menu {
        display: flex;
    }

    .header__nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: var(--bg-dark);
        padding: 100px 40px 40px;
        transition: right 0.4s ease;
        box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    }

    .header__nav.open {
        right: 0;
    }

    .header__nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 30px;
    }
    
    .header__social {
        display: none;
    }
    
    .header__actions {
        margin-right: 20px; /* Space from burger menu */
    }
}

/* ---- "Послуги" hover dropdown: existing service pages ---- */
.header__nav li.has-services-menu {
    position: relative;
}

.services-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    min-width: 240px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px 0;
    background: #1C1A29;
    border: 1px solid var(--accent-gold);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1002;
}

/* invisible bridge so the menu doesn't close in the gap */
.header__nav li.has-services-menu::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 16px;
}

.header__nav li.has-services-menu:hover .services-menu,
.header__nav li.has-services-menu:focus-within .services-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(4px);
}

.services-menu__link {
    display: block;
    padding: 10px 22px;
    color: #FFF8EA;
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease;
}

.services-menu__link:hover,
.services-menu__link.is-current {
    color: var(--accent-gold);
    background: rgba(253, 198, 103, 0.08);
}

.services-menu__empty {
    padding: 12px 22px;
    color: rgba(255, 248, 234, 0.5);
    font-family: var(--font-main);
    font-size: 14px;
    white-space: nowrap;
}

.all-services-link, .all-shop-link, .menu-chevron {
    display: none;
}

/* ---- "Косметика" hover dropdown ---- */
.header__nav li.has-shop-menu {
    position: relative;
}

.shop-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    min-width: 240px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px 0;
    background: #1C1A29;
    border: 1px solid var(--accent-gold);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1002;
}

.header__nav li.has-shop-menu::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 16px;
}

.header__nav li.has-shop-menu:hover .shop-menu,
.header__nav li.has-shop-menu:focus-within .shop-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(4px);
}

.shop-menu__link {
    display: block;
    padding: 10px 22px;
    color: #FFF8EA;
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease;
}

.shop-menu__link:hover,
.shop-menu__link.is-current {
    color: var(--accent-gold);
    background: rgba(253, 198, 103, 0.08);
}


@media screen and (max-width: 1240px) {
    /* Prevent focus outline box on mobile navigation links */
    .header__nav a {
        outline: none !important;
    }

    /* In the off-canvas mobile menu, accordion style (collapsed by default) */
    .services-menu {
        position: static !important;
        transform: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        min-width: 0 !important;
        max-height: 0 !important;
        overflow-y: auto !important;
        margin-top: 0 !important;
        background: #13111C !important; /* solid dark background for readability */
        border: none !important;
        border-radius: 8px !important;
        box-shadow: none !important;
        padding: 0 !important;
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                    opacity 0.3s ease, 
                    padding 0.3s ease, 
                    margin 0.3s ease,
                    border 0.3s ease;
    }
    .services-menu::-webkit-scrollbar {
        width: 4px;
    }
    .services-menu::-webkit-scrollbar-track {
        background: transparent;
    }
    .services-menu::-webkit-scrollbar-thumb {
        background: rgba(253, 198, 103, 0.3);
        border-radius: 2px;
    }
    .services-menu.is-open {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        max-height: 250px !important;
        padding: 8px 0 !important;
        margin-top: 10px !important;
        border: 1px solid rgba(253, 198, 103, 0.2) !important;
    }
    .header__nav li.has-services-menu::after { content: none; }
    .services-menu__link { padding: 8px 16px; font-size: 15px; white-space: normal; }
    
    .all-services-link {
        display: block !important;
        font-weight: 600;
        border-bottom: 1px solid rgba(253, 198, 103, 0.15) !important;
        margin-bottom: 5px;
        padding-bottom: 8px !important;
    }

    /* Shop menu mobile overrides */
    .shop-menu {
        position: static !important;
        transform: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        min-width: 0 !important;
        max-height: 0 !important;
        overflow-y: auto !important;
        margin-top: 0 !important;
        background: #13111C !important;
        border: none !important;
        border-radius: 8px !important;
        box-shadow: none !important;
        padding: 0 !important;
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                    opacity 0.3s ease, 
                    padding 0.3s ease, 
                    margin 0.3s ease,
                    border 0.3s ease;
    }
    .shop-menu::-webkit-scrollbar {
        width: 4px;
    }
    .shop-menu::-webkit-scrollbar-track {
        background: transparent;
    }
    .shop-menu::-webkit-scrollbar-thumb {
        background: rgba(253, 198, 103, 0.3);
        border-radius: 2px;
    }
    .shop-menu.is-open {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        max-height: 250px !important;
        padding: 8px 0 !important;
        margin-top: 10px !important;
        border: 1px solid rgba(253, 198, 103, 0.2) !important;
    }
    .header__nav li.has-shop-menu::after { content: none; }
    .shop-menu__link { padding: 8px 16px; font-size: 15px; white-space: normal; }
    
    .all-shop-link {
        display: block !important;
        font-weight: 600;
        border-bottom: 1px solid rgba(253, 198, 103, 0.15) !important;
        margin-bottom: 5px;
        padding-bottom: 8px !important;
    }

    /* Chevron indicators for toggle */
    .header__nav li.has-services-menu > a,
    .header__nav li.has-shop-menu > a {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    .menu-chevron {
        display: inline-block !important;
        width: 8px !important;
        height: 8px !important;
        border-right: 2px solid #FFF8EA !important;
        border-bottom: 2px solid #FFF8EA !important;
        transform: rotate(45deg) !important;
        margin-left: 10px !important;
        transition: transform 0.3s ease, border-color 0.3s ease !important;
        flex-shrink: 0 !important;
    }
    .submenu-open .menu-chevron {
        transform: rotate(-135deg) !important;
        border-color: var(--accent-gold) !important;
    }
}


