.header__top {
    border-bottom: 1px solid var(--Gray-2, #F2F2F2);
    background-color: #ffffff;
    position: relative;
    z-index: 10;

    .header__top-wrap {
        min-height: 44px;
        display: flex;
        align-items: center;
        column-gap: 20px;
    }
}

.header__nav {
    .nav__items {
        display: flex;
        align-items: center;
        column-gap: 20px;

        .nav__link {
            color: var(--Gray-7, #7A7A85);
            font-size: 14px;
            font-style: normal;
            font-weight: 400;
            line-height: 150%;
            letter-spacing: 0.14px;
            display: inline-block;
            padding: 8px 0;
            transition: color .3s ease;

            &:hover {
                color: var(--Base-Dark, #171717);
            }
        }
    }
}


.header__contacts {
    position: relative;
    display: flex;
    margin-left: auto;

    .header__contacts-trigger {
        display: inline-flex;
        align-items: center;
        column-gap: 8px;
        cursor: pointer;

        .header__contacts-trigger__value {
            color: var(--Base-Dark, #171717);
            font-size: 14px;
            font-style: normal;
            font-weight: 400;
            line-height: 150%;
            letter-spacing: 0.14px;
            transition: color .3s ease;
        }

        .finespirits-icon--arrow-down {
            stroke: var(--Base-Dark, #171717);
            fill: var(--Base-Dark, #171717);
            transition: transform .3s ease, stroke .3s ease, fill .3s ease;
        }

        .finespirits-icon--phone {
            stroke: var(--Base-Dark, #171717);
            fill: none;
        }

        &.active {
            .finespirits-icon--phone {
                stroke: var(--Dark-wine-2, #770E16);
            }

            .finespirits-icon--arrow-down {
                stroke: var(--Dark-wine-2, #770E16);
                fill: var(--Dark-wine-2, #770E16);
                transform: rotateX(180deg);
            }

            .header__contacts-trigger__value {
                color: var(--Dark-wine-2, #770E16);
            }
        }
    }

    .header__contacts-popup {
        border-radius: 12px;
        background-color: var(--Base-White, #FFF);
        box-shadow: 0px 4px 4px 0px rgba(23, 23, 23, 0.12);
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        padding: 16px 16px;
        min-width: 300px;
        transition: all .3s ease;
        transform: translateY(-10px);
        visibility: hidden;
        opacity: 0;
        display: none;
        z-index: 2;

        &.open {
            transform: translateY(0);
            visibility: visible;
            opacity: 1;
        }

        .header__contacts-popup__title {
            color: var(--Base-Dark, #171717);
            font-size: 20px;
            font-style: normal;
            font-weight: 400;
            line-height: 150%;
            letter-spacing: 0.2px;
            margin-bottom: 8px;
        }

        .header__contacts-popup__item {
            padding: 16px 0;

            .header__contacts-popup__item__name {
                color: var(--Gray-6, #9A9AA2);
                font-size: 12px;
                font-style: normal;
                font-weight: 400;
                line-height: 150%;
                letter-spacing: 0.12px;
                margin-bottom: 2px;
            }

            .header__contacts-popup__item__value a,
            .header__contacts-popup__item-address .header__contacts-popup__item__value {
                color: var(--Base-Dark, #171717);
                font-size: 16px;
                font-style: normal;
                font-weight: 400;
                line-height: 140%;
                letter-spacing: 0.16px;
            }

            .header__contacts-popup__item__value a {
                transition: color .3s ease;
                
                &:hover {
                    color: var(--Dark-wine-2, #770E16);
                }
            }

            &:not(:first-child) {
                border-top: solid 1px var(--Gray-2, #F2F2F2);
            }

            .header__contacts-popup__item-opening_hours {
                ul.header__contacts-popup__item__value li {
                    display: flex;
                    column-gap: 10px;
                    justify-content: space-between;

                    &:not(:first-child) {
                        margin-top: 2px;
                    }
                }
            }
        }
    }
}

.header__checkout {
    background-color: var(--Dark-wine-Main, #45080D);

    .header__checkout-wrap {
        display: flex;
        align-items: center;
        column-gap: 20px;
        min-height: 96px;
        padding: 24px 0;
    }


    .header__contacts {

        .header__contacts-trigger {

            .header__contacts-trigger__value {
                color: #ffffff;
            }

            .finespirits-icon--arrow-down {
                stroke: #ffffff;
                fill: #ffffff;
            }

            .finespirits-icon--phone {
                stroke: #ffffff;
            }

            &.active {
                .finespirits-icon--phone {
                    stroke: #ffffff;
                }

                .finespirits-icon--arrow-down {
                    stroke: #ffffff;
                    fill: #ffffff;
                }

                .header__contacts-trigger__value {
                    color: #ffffff;
                }
            }
        }
    }
}

.header__megamenu-trigger {
    border-radius: 8px;
    background-color: var(--Dark-wine-Main, #45080D);
    color: #ffffff;
    fill: #ffffff;
    display: inline-flex;
    align-items: center;
    column-gap: 8px;
    min-height: 48px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all .3s ease;
}

.header__megamenu-trigger__value {
    color: inherit;
    font-size: 12px;
    font-style: normal;
    font-weight: 500;
    line-height: 100%;
    letter-spacing: 0.24px;
    text-transform: uppercase;
}

.header__middle-wrap {
    display: flex;
    align-items: center;
    column-gap: 24px;
}

.header__megamenu-trigger:hover {
    background-color: var(--Base-Dark, #171717);
}

.header__search {
    flex: 1;
    min-width: 0;
    position: relative;

    form {
        width: 100%;
        position: relative;

        input[name="s"] {
            width: 100%;
            min-height: 48px;
            padding: 8px calc(16px + 54px) 8px 16px;
            border: 1px solid var(--Gray-3, #E5E5E6);
            border-radius: 12px;
            background-color: var(--Gray-1, #FAFAFA);
        }

        .button__search {
            position: absolute;
            top: 0;
            right: 0;
            height: 100%;
            width: 54px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            background-color: var(--Dark-wine-Main, #45080D);
            fill: #ffffff;
            transition: all .3s ease;
            overflow: hidden;
            
            &:hover {
                background-color: var(--Base-Dark, #171717);
            }

            &.is-loading {
                pointer-events: none;

                i {
                    opacity: 0; 
                }

                &:before {
                    content: "";
                    position: absolute;
                    width: 18px;
                    height: 18px;
                    border: 2px solid rgba(255, 255, 255, 0.6);
                    border-top-color: #ffffff;
                    border-radius: 50%;
                    animation: fs-spin 0.8s linear infinite;
                }
            }
        }
    }

    .header__search-results {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border: 1px solid rgba(0, 0, 0, .08);
        border-radius: 10px;
        margin-top: 8px;
        padding: 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
        z-index: 1000;
        max-height: 70vh;
        overflow: auto;
    }

    .fs-search__section {
        padding: 8px 8px 4px;
    }

    .fs-search__section + .fs-search__section {
        border-top: 1px solid rgba(0, 0, 0, .06);
    }

    .fs-search__section-title {
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .06em;
        opacity: .7;
        margin: 4px 8px 8px;
    }

    .fs-search__item {
        display: grid;
        grid-template-columns: 44px 1fr;
        gap: 10px;
        align-items: center;
        padding: 8px;
        border-radius: 8px;
        text-decoration: none;
        color: inherit;
    }

    .fs-search__item:hover,
    .fs-search__item.is-active {
        background: rgba(0, 0, 0, .04);
    }

    .fs-search__thumb img {
        width: 44px;
        height: 44px;
        object-fit: cover;
        border-radius: 6px;
        display: block;
    }

    .fs-search__title {
        font-size: 14px;
        line-height: 1.2;
    }

    .fs-search__price,
    .fs-search__count {
        font-size: 12px;
        opacity: .7;
        margin-top: 2px;
    }

    .fs-search__empty {
        padding: 16px;
        color: #666;
    }

    .fs-search__loader {
        display: grid;
        gap: 8px;
    }

    .fs-search__loader-row {
        display: grid;
        grid-template-columns: 44px 1fr;
        gap: 10px;
        align-items: center;
        padding: 8px;
    }

    .fs-search__loader-thumb {
        width: 44px;
        height: 44px;
        border-radius: 6px;
        background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 37%, rgba(0, 0, 0, 0.06) 63%);
        background-size: 400% 100%;
        animation: fs-shimmer 1.2s ease-in-out infinite;
    }

    .fs-search__loader-lines {
        display: grid;
        gap: 6px;
    }

    .fs-search__loader-line {
        height: 12px;
        border-radius: 6px;
        background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.1) 37%, rgba(0, 0, 0, 0.06) 63%);
        background-size: 400% 100%;
        animation: fs-shimmer 1.2s ease-in-out infinite;
    }

    .fs-search__loader-line--short {
        width: 40%;
    }

    @keyframes fs-shimmer {
        0%   { background-position: 100% 0; }
        100% { background-position: 0 0; }
    }
}


.header__logo,
.header__megamenu,
.header__actions {
    flex: 0 0 auto;
}

.header__middle {
    padding: 24px 0;
    background-color: #ffffff;
    position: relative;
    z-index: 9;
}

.header__actions {
    display: flex;
    column-gap: 20px;
    padding-left: 10px;
}

.header__action {
    position: relative;
    min-width: 60px;
}

.header__action-name {
    color: inherit;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 150%;
    letter-spacing: 0.14px;
    transition: color .3s ease;
}

.header__action-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-height: 48px;
    width: 100%;
    color: var(--Base-Dark, #171717);
    fill: var(--Base-Dark, #171717);
}

.header__action-link:hover {
    color: var(--Dark-wine-2, #770E16);
    fill: var(--Dark-wine-2, #770E16);
}

.header__action .finespirits-icon {
    width: 25px;
    height: 25px;
}

.header__action-count {
    color: #ffffff;
    text-align: center;
    font-size: 10px;
    font-style: normal;
    font-weight: 500;
    line-height: 100%;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    border-radius: 16px;
    background-color: var(--Dark-wine-2, #770E16);
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    right: 8px;
}

.header__bottom {
    margin-top: 10px;
}

.header__categories {
  .nav__items {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;

    .nav__item {
      flex: 1 0 auto;

      .nav__link {
        color: var(--Base-Dark, #171717);
        font-size: 16px;
        font-style: normal;
        font-weight: 400;
        line-height: 140%;
        letter-spacing: 0.16px;
        display: inline-block;
        padding: 2px 12px;
        white-space: nowrap;
        transition: color .3s ease;

        &:hover {
          color: var(--Dark-wine-2, #770E16);
        }
      }

      &:first-child {
        .nav__link {
          color: var(--Light-Red, #B71522);
          font-family: Lato;
          font-size: 16px;
          font-style: normal;
          font-weight: 400;
          line-height: 140%; /* 22.4px */
          letter-spacing: 0.16px;
        }
      }
    }
  }
}



.header__top-mobile {
    position:relative;
    z-index:99;

    .header__top-wrap {
        padding:0;
        min-height:0;

        .header__contacts {
            .header__contacts-popup {
                display:block;
                opacity:1;
                visibility: visible;
                z-index:99;
                min-width: 0;
                width:100%;
                height:100vh;
                overflow-y:auto;
                position:fixed;
                top:0;
                left:-100%;
                transform: none;
                padding-top:94px;
                border-radius:0;
                transition: all 0.5s;

                &.active {
                     left:0;
                    .header__contacts-header-mobile {
                        left:0%;
                    }
                }

                .header__contacts-header-mobile {
                    background:#45080D;
                    padding:16px;
                    display:flex;
                    align-items:center;
                    justify-content:space-between;
                    position:fixed;
                    top: 0;
                    left:-100%;
                    z-index:99;
                    width:100%;
                    transition: all 0.5s;

                    .header__contacts-logo {
                        img {
                            max-height:31px;
                        }
                    }
                }

                &.active {
                     left:0;
                    .header__contacts-header-mobile {
                        left:0%;
                    }
                }
            }
        }
    }
}

.header__languages {
    .languages {
        display: flex;

        .language {
            display: flex;
            
            a, span {
                font-size: 14px;
                font-style: normal;
                font-weight: 400;
                line-height: 100%;
                letter-spacing: 0.14px;
            }
            a {
                color: #333333;
            }
            span {
                color: var(--Gray-5, #BDBDC2);
            }

            &:not(:last-child) {
                border-right: solid 1px #BEBEBE;
                padding-right: 6px;
                margin-right: 6px;
            }
        }
    }
}


@media (max-width: 1100px) {
    .header__bottom .nav__items {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap:nowrap;

        ::-webkit-scrollbar {
            display: none;
        }
    }
}

@media (max-width: 992px) {
    .header__top-mobile-active {
        z-index:999;
    }
    .header-mobile {
        position:fixed;
        top:0;
        left:0;
        z-index:9;
        width:100%;
        box-sizing:border-box;

        .header__bottom {
            margin-top:0;
            padding-top:8px;
            padding-bottom:8px;
            background:#FFFFFF;
        }
    }

    .main {
        padding-top:108px;
    }
    .main.home__page {
        padding-top:0;
    }

    .header__middle {
        padding: 10px 0;
        background:#FBFBFB;
        border-bottom:1px solid #F2F2F2;
        position:relative;
        width:100%;
        z-index:99;

        &.active-contacts {
             z-index:9;
         }

        .header__middle-wrap {
            justify-content: space-between;
            align-items:center;

        }
    }

    .header__actions-mobile {
        column-gap: 3px;

        .header__action {
            min-width:auto;
            height:40px;

            .header__action-link {
                min-height:0;

                .finespirits-icon {
                    width:40px;
                    height:40px;

                    svg {
                        width: 20px;
                        height: 20px;
                    }
                }

                .finespirits-icon.finespirits-icon--burger svg {
                    width:40px;
                    height:40px;
                }
            }
        }
    }

    .header__logo img {
        width:90px;
    }

    .header__categories .nav__items {
        column-gap:0;

        .nav__item:first-child .nav__link {
            padding-left:0;
        }

        .nav__link {
            color: var(--Base-Dark, #171717);;
            font-size: 14px;
            font-weight: 400;
            line-height: 140%;
            letter-spacing: 0.14px;
            padding: 10px 8px;
        }
    }
}