/* IQ-Biz Header Redesign v3.3 */

/* 1. Global: Hide Wishlist, Compare and Account dropdown */
.top-menu__wishlist,
.top-menu__compare,
#top .top-menu__account,
.header-block__item-wishlist,
.header-block__item-compare,
.header-block__item-account,
.header-block__item-caption {
    display: none !important;
}

/* 2. Desktop Top Bar (min-width: 992px) */
@media (min-width: 992px) {
    /* Hide mobile top bar on desktop */
    .top-menu-mobile {
        display: none !important;
    }

    #top .container {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    #top .top-menu__links {
        display: flex !important;
        align-items: center !important;
        flex: 0 1 auto !important;
    }
    #top .top-links {
        width: auto !important;
    }
    #top .top-links .top-menu__btn {
        display: none !important;
    }
    #top .top-links__ul {
        display: flex !important;
        position: static !important;
        float: none !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
        align-items: center !important;
        gap: 24px !important;
    }
    #top .top-links__li {
        display: inline-block !important;
        margin: 0 !important;
    }
    #top .top-links__a {
        padding: 0 !important;
        font-size: 0.9em !important;
        color: #666 !important;
        transition: color 0.2s !important;
    }
    #top .top-links__a:hover {
        color: #455c48 !important;
    }

    /* Top menu buttons (Right links) */
    #top .top-menu__buttons {
        display: flex !important;
        align-items: center !important;
        margin-left: auto !important;
    }
    .top-menu__right-links {
        display: flex !important;
        align-items: center !important;
    }
    .top-right-links__ul {
        display: flex !important;
        align-items: center !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 20px !important;
    }
    .top-right-links__li {
        display: inline-block !important;
        margin: 0 !important;
    }
    .top-right-links__a {
        padding: 0 !important;
        font-size: 0.9em !important;
        color: #666 !important;
        transition: color 0.2s !important;
    }
    .top-right-links__a:hover {
        color: #455c48 !important;
    }

    /* Desktop Header Row: Order & Spacing between Logo -> Search -> Phone -> Messengers -> Cart */
    .header-block__item-logo {
        order: 0 !important;
    }
    .header-block__item-search {
        order: 1 !important;
        padding-right: 0 !important;
    }
    .header-block__item-telephone {
        order: 2 !important;
        padding: 0 !important;
        margin-left: 28px !important;
        margin-right: 0 !important;
    }
    .header-phones {
        padding: 0 !important;
        margin: 0 !important;
    }
    .header-phones__main {
        font-size: 1.25em !important;
        font-weight: 700 !important;
        line-height: 1.2 !important;
        color: #222 !important;
        text-decoration: none !important;
        white-space: nowrap !important;
    }
    .header-phones__main:hover {
        color: #455c48 !important;
    }
    .header-phones__callback-link {
        display: inline-block !important;
        margin-top: 3px !important;
        font-size: 0.88em !important;
        color: #455c48 !important;
        text-decoration: underline !important;
        cursor: pointer !important;
        line-height: 1.2 !important;
        transition: color 0.2s !important;
    }
    .header-phones__callback-link:hover {
        color: #2b3a2d !important;
    }

    .header-block__item-messengers {
        order: 3 !important;
        display: flex !important;
        align-items: center !important;
        margin-left: 28px !important;
        margin-right: 28px !important;
        padding: 0 !important;
    }
    .header-messengers {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .header-messenger-link {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 34px !important;
        height: 34px !important;
        border-radius: 50% !important;
        transition: transform 0.2s, opacity 0.2s !important;
    }
    .header-messenger-link:hover {
        transform: translateY(-2px) !important;
        opacity: 0.9 !important;
    }
    .header-messenger-link img {
        width: 34px !important;
        height: 34px !important;
        display: block !important;
        object-fit: contain !important;
    }

    .header-block__item-cart {
        order: 4 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
    }
}

/* 3. Base Phone Styles */
.header-phones {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    position: relative;
}
.header-phones .header-phones__show-phone,
.header-phones .header-phones__ul,
.header-phones .header-phones__additionals {
    display: none !important;
}

/* 4. Mobile Top Bar & Header (max-width: 991px) */
@media (max-width: 991px) {
    /* Hide bottom sticky uni nav */
    .fly-menu,
    #fly-menu,
    .uni-nav-mobile {
        display: none !important;
    }

        /* Non-sticky main header on mobile */
    header {
        position: static !important;
        box-shadow: none !important;
    }

    /* Sticky Catalog & Search bar on mobile */
    #sticky-search-placeholder {
        width: 100%;
    }
    header > .container:last-of-type {
        transition: box-shadow 0.2s ease;
    }
    header > .container:last-of-type.is-sticky {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        z-index: 1050 !important;
        background: #ffffff !important;
        padding-top: 6px !important;
        padding-bottom: 6px !important;
        box-shadow: 0 3px 10px rgba(0,0,0,0.12) !important;
    }
    header > .container:last-of-type.is-sticky .row {
        display: flex !important;
        align-items: center !important;
        margin: 0 !important;
    }
    header > .container:last-of-type.is-sticky .menu-open {
        margin: 0 10px 0 0 !important;
    }
    header > .container:last-of-type.is-sticky #search2 {
        padding: 0 !important;
        flex: 1 1 auto !important;
    }

    /* Hide desktop elements completely inside #top on mobile */
    #top .top-menu__links,
    #top .top-menu__buttons {
        display: none !important;
    }

    #top {
        display: block !important;
        background: #fdfdfd;
        border-bottom: 1px solid #f0f0f0;
        padding: 6px 0 !important;
    }
    #top .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Dedicated Mobile Top Bar */
    .top-menu-mobile {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }
    .top-mobile__links {
        display: flex !important;
        align-items: center !important;
        flex: 0 1 auto !important;
    }
    .top-mobile-links__ul {
        display: flex !important;
        align-items: center !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 16px !important;
    }
    .top-mobile-links__li {
        display: inline-block !important;
        margin: 0 !important;
    }
    .top-mobile-links__a {
        padding: 0 !important;
        font-size: 0.9em !important;
        font-weight: 500 !important;
        color: #444444 !important;
        white-space: nowrap !important;
        text-decoration: none !important;
    }
    .top-mobile-links__a:hover {
        color: #455c48 !important;
    }

    .top-mobile__messengers {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        margin-left: auto !important;
    }
    .top-messenger-link {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 26px !important;
        height: 26px !important;
        border-radius: 50% !important;
        transition: transform 0.15s ease !important;
    }
    .top-messenger-link:active {
        transform: scale(0.9) !important;
    }
    .top-messenger-link img {
        width: 24px !important;
        height: 24px !important;
        display: block !important;
        object-fit: contain !important;
    }

    /* Hide middle-row messengers on mobile */
    .header-block__item-messengers {
        display: none !important;
    }

    /* Middle row: Flexbox with Absolute Centering for Phone */
    .header-block {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 0 18px !important;
        margin-bottom: 4px !important;
        position: relative !important;
        min-height: 52px !important;
        width: 100% !important;
    }

    .header-block__item-logo {
        order: 1 !important;
        flex: 0 0 auto !important;
        max-width: 110px !important;
        display: flex !important;
        align-items: center !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 1 !important;
    }
    .header-block__item-logo img {
        max-width: 105px !important;
        height: auto !important;
        display: block !important;
    }

    .header-block__item-telephone {
        order: 2 !important;
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 0 !important;
        margin: 0 !important;
        white-space: nowrap !important;
        z-index: 2 !important;
    }
    .header-phones {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .header-phones__main {
        font-size: 0.95em !important;
        font-weight: 700 !important;
        color: #222222 !important;
        line-height: 1.25 !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 0 !important;
        white-space: nowrap !important;
    }
    .header-phones__callback-link {
        font-size: 0.82em !important;
        color: #455c48 !important;
        text-decoration: underline !important;
        margin-top: 3px !important;
        line-height: 1.2 !important;
        text-align: center !important;
        display: inline-block !important;
        white-space: nowrap !important;
    }

    .header-block__item-cart {
        order: 3 !important;
        flex: 0 0 auto !important;
        margin-left: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        padding: 0 !important;
        z-index: 1 !important;
    }
    .header-cart {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .header-cart__btn {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .header-cart__icon {
        font-size: 2.1em !important;
        line-height: 1 !important;
        color: #455c48 !important;
        display: flex !important;
        align-items: center !important;
    }
}

@media (max-width: 360px) {
    .header-block__item-logo {
        max-width: 95px !important;
    }
    .header-block__item-logo img {
        max-width: 90px !important;
    }
    .header-phones__main {
        font-size: 0.88em !important;
    }
    .header-phones__callback-link {
        font-size: 0.78em !important;
    }
}

/* 5. Marquiz button close cross */
.marquiz-btn-wrap {
    position: relative;
}
.marquiz-btn-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    background: #333333;
    color: #ffffff !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    z-index: 100000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: transform 0.2s, background 0.2s;
    user-select: none;
}
.marquiz-btn-close:hover {
    background: #e74c3c;
    transform: scale(1.1);
}

/* Floating Contact Widget Messengers Rotating Styles */
/* Native UniShop2 Fly contacts: MAX icon and mobile positioning (like bravo.iq-biz.ru) */
.fly-block__contacts-icon.icon-max,
.fly-block__contacts-item.icon-max {
    background: #7928CA !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.fly-block__contacts-icon.icon-max::before,
.fly-block__contacts-item.icon-max::before {
    content: '' !important;
    display: block !important;
    width: 22px !important;
    height: 22px !important;
    background: url('/image/catalog/MAX-64x64.png') no-repeat center / contain !important;
    border-radius: 50% !important;
}

.fly-block__contacts-icon.fa-phone {
    background: #455c48 !important;
    color: #fff !important;
}

.fly-block {
    z-index: 1080 !important;
}

@media (max-width: 767px) {
    .fly-block {
        bottom: 85px !important;
        right: 15px !important;
    }
}
