/* ==========================================================
 * COMTRANS / Autofurnitura service header
 * Isolated namespace: af-service-header*
 * Brandbook:
 *   COMTRANS Blue #14326e
 *   Graphite      #262523
 *   White         #fefefe
 *   Light Gray    #909091
 *   Light Blue    #96afd7
 *   Blue          #47639a
 *   Gray          #515151
 * ========================================================== */

.af-service-header,
.af-service-header * {
    box-sizing: border-box;
}

.af-service-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    width: 100%;
    min-height: 58px;
    background: #262523;
    color: #fefefe;
    font-family: 'Montserrat', Arial, sans-serif;
    box-shadow: 0 1px 0 rgba(254, 254, 254, .06);
}

.af-service-header__inner {
    width: 100%;
    max-width: 1920px;
    min-height: 58px;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: clamp(12px, 1.25vw, 26px);
    white-space: nowrap;
}

.af-service-header a,
.af-service-header button {
    color: #fefefe;
    font: inherit;
    text-decoration: none;
}

.af-service-header a:hover,
.af-service-header a:focus,
.af-service-header button:hover,
.af-service-header button:focus {
    color: #fefefe;
    text-decoration: none;
}

.af-service-header__item,
.af-service-header__action,
.af-service-header__account,
.af-service-header__reviews,
.af-service-header__cart,
.af-service-header__language-toggle {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.af-service-header__item,
.af-service-header__reviews,
.af-service-header__cart {
    color: #fefefe;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    transition: color .2s ease, opacity .2s ease;
}

.af-service-header__item:hover,
.af-service-header__reviews:hover,
.af-service-header__cart:hover {
    color: #96afd7;
}

.af-service-header__icon,
.af-service-header__action-icon,
.af-service-header__account-icon,
.af-service-header__reviews-icon {
    flex: 0 0 auto;
    color: #fefefe;
    line-height: 1;
}

.af-service-header__icon {
    font-size: 15px;
}

.af-service-header__action-icon,
.af-service-header__account-icon,
.af-service-header__reviews-icon {
    font-size: 18px;
}

.af-service-header__desktop-text,
.af-service-header__desktop-text a {
    color: inherit;
}

.af-service-header__separator {
    padding: 0 2px;
    color: #909091;
}

/* Language */
.af-service-header__language {
    position: relative;
    flex: 0 0 auto;
}

.af-service-header__language-toggle {
    min-height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}

.af-service-header__language-toggle:hover,
.af-service-header__language-toggle:focus,
.af-service-header__language.is-open .af-service-header__language-toggle {
    color: #96afd7;
    outline: none;
}

.af-service-header__language-chevron {
    font-size: 9px;
    transition: transform .2s ease;
}

.af-service-header__language.is-open .af-service-header__language-chevron {
    transform: rotate(180deg);
}

.af-service-header__language-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1200;
    display: none;
    min-width: 160px;
    padding: 7px;
    border: 1px solid rgba(20, 50, 110, .14);
    border-radius: 12px;
    background: #fefefe;
    box-shadow: 0 14px 34px rgba(38, 37, 35, .18);
}

.af-service-header__language.is-open .af-service-header__language-menu {
    display: block;
}

.af-service-header__language-link {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    color: #262523 !important;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.af-service-header__language-link span {
    color: #515151;
    font-size: 11px;
    font-weight: 500;
    text-transform: none;
}

.af-service-header__language-link:hover,
.af-service-header__language-link:focus,
.af-service-header__language-link.is-active {
    background: rgba(150, 175, 215, .18);
    color: #14326e !important;
}

/* Phones */
.af-service-header__phones {
    gap: 8px;
}

.af-service-header__icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fefefe;
}

.af-service-header__phones-text {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Favorite / account / reviews / cart */
.af-service-header__action {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: background-color .2s ease, transform .15s ease;
}

.af-service-header__action:hover,
.af-service-header__action:focus {
    background: rgba(150, 175, 215, .12);
    outline: none;
}

.af-service-header__action:active {
    transform: scale(.96);
}

.af-service-header__badge-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.af-service-header__badge {
    position: absolute;
    top: -9px;
    right: -11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 2px solid #262523;
    border-radius: 999px;
    background: #14326e;
    color: #fefefe;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.af-service-header__badge.is-updated {
    animation: afServiceHeaderBadgePulse .35s ease;
}

@keyframes afServiceHeaderBadgePulse {
    0% { transform: scale(1); }
    45% { transform: scale(1.22); }
    100% { transform: scale(1); }
}

.af-service-header__account {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(254, 254, 254, .72);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    color: #fefefe;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}

.af-service-header__account:hover,
.af-service-header__account:focus {
    border-color: #96afd7;
    background: rgba(150, 175, 215, .10);
    color: #fefefe;
    outline: none;
}

.af-service-header__account-icon {
    display: none;
}

.af-service-header__quick-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(12px, 1vw, 20px);
    flex: 0 0 auto;
}

.af-service-header__reviews {
    margin-left: 0;
}

.af-service-header__cart {
    flex: 0 0 auto;
    gap: 12px;
}

.af-service-header__cart-price {
    font-weight: 700;
}

/* Tablet / compact desktop */
@media (max-width: 1199px) and (min-width: 768px) {
    .af-service-header__quick-actions {
        display: contents;
    }
    .af-service-header {
        min-height: 52px;
    }

    .af-service-header__inner {
        min-height: 52px;
        max-width: 100%;
        padding: 0 18px;
        gap: clamp(14px, 2.2vw, 26px);
        justify-content: center;
    }

    /* На планшеті залишаємо коротку панель: UA + іконки. */
    .af-service-header__desktop-text,
    .af-service-header__reviews {
        display: none !important;
    }

    .af-service-header__item,
    .af-service-header__language-toggle,
    .af-service-header__action,
    .af-service-header__account,
    .af-service-header__cart {
        width: 38px;
        min-width: 38px;
        height: 40px;
        min-height: 40px;
        padding: 0;
        border: 0;
        border-radius: 9px;
        background: transparent;
    }

    .af-service-header__item,
    .af-service-header__cart {
        gap: 0;
    }

    .af-service-header__item:hover,
    .af-service-header__item:focus,
    .af-service-header__cart:hover,
    .af-service-header__cart:focus,
    .af-service-header__account:hover,
    .af-service-header__account:focus {
        background: rgba(150, 175, 215, .10);
    }

    .af-service-header__language-toggle {
        width: auto;
        min-width: 54px;
        gap: 5px;
    }

    .af-service-header__language-toggle > .af-service-header__icon {
        display: none;
    }

    .af-service-header__language-code {
        font-size: 14px;
        font-weight: 500;
    }

    .af-service-header__language-chevron {
        font-size: 8px;
    }

    .af-service-header__language-menu {
        top: calc(100% + 4px);
    }

    .af-service-header__icon,
    .af-service-header__action-icon,
    .af-service-header__account-icon {
        font-size: 18px;
    }

    .af-service-header__account-icon {
        display: inline-block;
    }

    .af-service-header__account-text {
        display: none;
    }

    .af-service-header__badge-wrap {
        width: 22px;
        height: 22px;
    }

    .af-service-header__badge {
        top: -8px;
        right: -10px;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        border-width: 2px;
        font-size: 9px;
    }

    .af-service-header__cart {
        margin-left: 0;
    }


    /* Tablet: усі швидкі дії формують одну компактну групу без розтягування. */
    .af-service-header__language,
    .af-service-header__mobile-contact,
    .af-service-header__favorite,
    .af-service-header__account,
    .af-service-header__cart {
        flex: 0 0 auto;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .af-service-header__quick-actions {
        display: contents;
    }
    .af-service-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1200;
        min-height: 50px;
    }

    .af-service-header__inner {
        min-height: 50px;
        padding: 0 14px;
        gap: 0;
        justify-content: space-between;
    }

    .af-service-header__desktop-text,
    .af-service-header__reviews {
        display: none !important;
    }

    .af-service-header__item,
    .af-service-header__language-toggle,
    .af-service-header__action,
    .af-service-header__account,
    .af-service-header__cart {
        width: 34px;
        min-width: 34px;
        height: 40px;
        min-height: 40px;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
    }

    .af-service-header__item,
    .af-service-header__cart {
        gap: 0;
    }

    .af-service-header__item:hover,
    .af-service-header__item:focus,
    .af-service-header__cart:hover,
    .af-service-header__cart:focus,
    .af-service-header__account:hover,
    .af-service-header__account:focus {
        background: rgba(150, 175, 215, .10);
    }

    .af-service-header__language-toggle {
        width: auto;
        min-width: 48px;
        gap: 4px;
    }

    .af-service-header__language-toggle > .af-service-header__icon {
        display: none;
    }

    .af-service-header__language-code {
        font-size: 14px;
        font-weight: 500;
    }

    .af-service-header__language-chevron {
        font-size: 8px;
    }

    .af-service-header__language-menu {
        top: calc(100% + 3px);
        min-width: 150px;
    }

    .af-service-header__icon,
    .af-service-header__action-icon,
    .af-service-header__account-icon {
        font-size: 18px;
    }

    .af-service-header__account-icon {
        display: inline-block;
    }

    .af-service-header__account-text {
        display: none;
    }

    .af-service-header__badge-wrap {
        width: 22px;
        height: 22px;
    }

    .af-service-header__badge {
        top: -8px;
        right: -10px;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        border-width: 2px;
        font-size: 9px;
    }
}

@media (max-width: 359px) {
    .af-service-header__inner {
        padding: 0 8px;
    }

    .af-service-header__item,
    .af-service-header__action,
    .af-service-header__account,
    .af-service-header__cart {
        width: 31px;
        min-width: 31px;
    }

    .af-service-header__language-toggle {
        min-width: 43px;
    }
}

/* ==========================================================
 * Mobile contact dropdowns
 * Address / phones / email
 * ========================================================== */
.af-service-header__mobile-contact {
    display: none;
}

@media (max-width: 1199px) {
    .af-service-header__desktop-contact {
        display: none !important;
    }

    .af-service-header__mobile-contact {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        min-width: 34px;
        height: 40px;
    }

    .af-service-header__mobile-contact-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        min-width: 34px;
        height: 40px;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #fefefe;
        cursor: pointer;
        transition: background-color .2s ease, color .2s ease, transform .15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .af-service-header__mobile-contact-toggle:hover,
    .af-service-header__mobile-contact-toggle:focus,
    .af-service-header__mobile-contact.is-open .af-service-header__mobile-contact-toggle {
        background: rgba(150, 175, 215, .10);
        color: #fefefe;
        outline: none;
    }

    .af-service-header__mobile-contact-toggle:active {
        transform: scale(.96);
    }

    .af-service-header__mobile-contact-menu {
        position: fixed;
        top: 56px;
        left: 18px;
        right: 18px;
        z-index: 1250;
        display: none;
        padding: 10px;
        border: 1px solid rgba(20, 50, 110, .14);
        border-radius: 14px;
        background: #fefefe;
        box-shadow: 0 14px 34px rgba(38, 37, 35, .20);
        color: #262523;
        white-space: normal;
    }

    .af-service-header__mobile-contact.is-open .af-service-header__mobile-contact-menu {
        display: block;
        animation: afServiceHeaderContactIn .18s ease-out;
    }

    .af-service-header__mobile-contact-title {
        padding: 4px 8px 8px;
        color: #14326e;
        font-size: 11px;
        font-weight: 700;
        line-height: 1.25;
        text-transform: uppercase;
        letter-spacing: .03em;
    }

    .af-service-header__mobile-contact-link {
        display: flex !important;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
        padding: 11px 10px;
        border-radius: 10px;
        color: #262523 !important;
        font-size: 13px;
        font-weight: 500;
        line-height: 1.45;
        text-decoration: none !important;
        transition: background-color .18s ease, color .18s ease;
    }

    .af-service-header__mobile-contact-link + .af-service-header__mobile-contact-link {
        margin-top: 2px;
    }

    .af-service-header__mobile-contact-link i {
        flex: 0 0 auto;
        width: 18px;
        margin-top: 2px;
        color: #14326e;
        text-align: center;
    }

    .af-service-header__mobile-contact-link span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .af-service-header__mobile-contact-link:hover,
    .af-service-header__mobile-contact-link:focus,
    .af-service-header__mobile-contact-link:active {
        background: rgba(150, 175, 215, .18);
        color: #14326e !important;
        outline: none;
    }

    @keyframes afServiceHeaderContactIn {
        from {
            opacity: 0;
            transform: translateY(-5px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}


@media (min-width: 768px) and (max-width: 1199px) {
    .af-service-header__mobile-contact {
        width: 38px;
        min-width: 38px;
        height: 40px;
    }

    .af-service-header__mobile-contact-toggle {
        width: 38px;
        min-width: 38px;
        height: 40px;
    }

    .af-service-header__mobile-contact-menu {
        left: 50%;
        right: auto;
        width: min(460px, calc(100vw - 36px));
        transform: translateX(-50%);
    }

    .af-service-header__mobile-contact.is-open .af-service-header__mobile-contact-menu {
        animation: afServiceHeaderTabletContactIn .18s ease-out;
    }

    @keyframes afServiceHeaderTabletContactIn {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(-5px);
        }
        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }
}

@media (max-width: 359px) {
    .af-service-header__mobile-contact {
        width: 31px;
        min-width: 31px;
    }

    .af-service-header__mobile-contact-toggle {
        width: 31px;
        min-width: 31px;
    }
}

/* Desktop: phone numbers and address in two rows */
@media (min-width: 1200px) {
    .af-service-header__location {
        align-items: center;
    }

    .af-service-header__location .af-service-header__icon {
        margin-top: 0;
        align-self: center;
    }

    .af-service-header__location .af-service-header__desktop-text {
        display: block;
        max-width: 320px;
        white-space: normal;
        line-height: 1.18;
    }

    .af-service-header__phones-text {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 1px;
        line-height: 1.2;
    }

    .af-service-header__phones-text .af-service-header__separator {
        display: none;
    }

    .af-service-header__phones-text a {
        white-space: nowrap;
    }
}

/* Laptop: tighter service header layout (1200–1599px) */
@media (min-width: 1200px) and (max-width: 1599px) {
    .af-service-header__inner {
        padding-left: 16px;
        padding-right: 16px;
        gap: 8px;
    }

    .af-service-header__location {
        gap: 7px;
        margin-right: 0;
    }

    .af-service-header__location .af-service-header__desktop-text {
        max-width: 235px;
    }

    .af-service-header__phones {
        gap: 7px;
        margin-left: 0;
    }
}
