/* ============================================
   TOP MENU BAR STYLES
   ============================================ */

.top-menu-bar {
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    margin: 0 auto 10px auto;
    max-width: 1408px;
    border-bottom: none;
    border-top: none;
    margin-top: 0;
}

.top-menu-bar .maxwidth-theme {
    max-width: 1408px;
    margin: 0 auto;
    padding: 16px 46px;
    box-sizing: border-box;
    border-top: none;
    background-color: transparent;
}

.top-menu-bar .container_inner {
    width: 100%;
    background-color: transparent;
}

/* ============================================
   TOP MENU CONTENT - GRID LAYOUT
   ============================================ */

.top-menu-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "catalog search actions";
    align-items: center;
    gap: 20px;
    width: 100%;
    min-height: 59px;
    background-color: transparent;
    position: relative;
    z-index: 999;
}

/* Catalog Button */
.top-menu-catalog {
    grid-area: catalog;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px;
    padding: 12px 24px !important;
    background-color: #ee2722 !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    white-space: nowrap;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: fit-content;
    align-self: center !important;
}

.top-menu-catalog svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.top-menu-catalog:hover {
    background-color: #d11e1a !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Search Form */
.top-menu-search {
    grid-area: search;
    width: 100% !important;
    min-width: 400px !important;
    max-width: 100% !important;
    justify-self: stretch;
    flex: 1 1 auto;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-input {
    width: 100% !important;
    min-width: 400px !important;
    padding: 12px 45px 12px 16px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-family: 'Montserrat', sans-serif !important;
    outline: none !important;
    background-color: #F6F6F6 !important;
    border: 1px solid #E5E5E5 !important;
    color: #231F20 !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: #666666;
}

.search-input:focus {
    border-color: #ee2722;
    box-shadow: 0 0 0 2px rgba(238, 39, 34, 0.1);
}

.search-button {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666666;
    transition: color 0.2s ease;
}

.search-button:hover {
    color: #ee2722;
}

.search-button svg {
    width: 20px;
    height: 20px;
}

/* Actions (Callback + Cart) */
.top-menu-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    justify-self: end;
}

.top-menu-callback {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 24px !important;
    background-color: #ee2722 !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    white-space: nowrap;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.top-menu-callback:hover {
    background-color: #d11e1a !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.top-menu-wishlist {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    text-decoration: none;
    color: #231F20;
    transition: color 0.3s ease;
    margin-right: 8px;
}

.top-menu-wishlist .wishlist-icon-img {
    width: 24px;
    height: 24px;
    filter: brightness(0) saturate(100%) invert(18%) sepia(95%) saturate(7151%) hue-rotate(352deg) brightness(95%) contrast(93%);
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.top-menu-wishlist:hover .wishlist-icon-img {
    filter: brightness(0) saturate(100%) invert(18%) sepia(95%) saturate(7151%) hue-rotate(352deg) brightness(95%) contrast(93%);
}

.top-menu-wishlist.active .wishlist-icon-img {
    filter: brightness(0) saturate(100%) invert(18%) sepia(95%) saturate(7151%) hue-rotate(352deg) brightness(95%) contrast(93%);
}

.top-menu-wishlist .wishlist-count {
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    background-color: #ee2722 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 18px !important;
    height: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    font-family: 'Montserrat', sans-serif !important;
    line-height: 1 !important;
    z-index: 10;
}

.top-menu-wishlist .wishlist-count:empty {
    display: none !important;
}

.top-menu-cart-wrapper {
    position: relative;
    z-index: 99999;
}

.top-menu-cart {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    text-decoration: none;
    color: #231F20;
    transition: color 0.3s ease;
}

.top-menu-cart svg {
    width: 24px;
    height: 24px;
}

.top-menu-cart:hover {
    color: #ee2722;
}

.top-menu-cart .cart-count {
    position: absolute !important;
    top: 2px !important;
    right: 2px !important;
    background-color: #ee2722 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 18px !important;
    height: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    font-family: 'Montserrat', sans-serif !important;
    line-height: 1 !important;
    z-index: 10;
}

/* Mini Cart Dropdown */
.mini-cart-dropdown {
    position: fixed !important;
    width: 380px;
    max-height: 500px;
    background: #FFFFFF !important;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
    z-index: 2147483647 !important;
    /* Maximum z-index value */
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #E5E5E5;
    pointer-events: auto !important;
    isolation: isolate !important;
}

.mini-cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E5E5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8F8F8;
}

.mini-cart-title {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: 18px;
    line-height: 1.2;
    color: #231F20;
}

.mini-cart-items-count {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.2;
    color: #666666;
    background: #EE2722;
    color: #FFFFFF;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.mini-cart-items {
    max-height: 320px;
    overflow-y: auto;
    padding: 0;
}

.mini-cart-items::-webkit-scrollbar {
    width: 6px;
}

.mini-cart-items::-webkit-scrollbar-track {
    background: #F5F5F5;
}

.mini-cart-items::-webkit-scrollbar-thumb {
    background: #CCCCCC;
    border-radius: 3px;
}

.mini-cart-items::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

.mini-cart-empty {
    padding: 40px 20px;
    text-align: center;
}

.mini-cart-empty p {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.5;
    color: #666666;
    margin: 0;
}

.mini-cart-item {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #F0F0F0;
    transition: background-color 0.2s ease;
}

.mini-cart-item:hover {
    background: #F8F8F8;
}

.mini-cart-item:last-child {
    border-bottom: none;
}

.mini-cart-item-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #F5F5F5;
}

.mini-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-cart-item-info {
    flex: 1;
    min-width: 0;
}

.mini-cart-item-name {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    color: #231F20;
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mini-cart-item-variant {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 12px;
    line-height: 1.4;
    color: #999999;
    margin: 0 0 6px 0;
}

.mini-cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mini-cart-item-quantity {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.4;
    color: #666666;
}

.mini-cart-item-price {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    color: #231F20;
}

.mini-cart-footer {
    padding: 16px 20px;
    border-top: 1px solid #E5E5E5;
    background: #F8F8F8;
}

.mini-cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.mini-cart-total-label {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.4;
    color: #231F20;
}

.mini-cart-total-price {
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.4;
    color: #EE2722;
}

.mini-cart-button {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: #EE2722;
    color: #FFFFFF;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.mini-cart-button:hover {
    background: #D01E1A;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(238, 39, 34, 0.3);
    text-decoration: none;
    color: #FFFFFF;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

/* Hide mini cart on mobile */
@media (max-width: 768px) {
    .mini-cart-dropdown {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .top-menu-bar {
        padding: 12px 0;
    }

    .top-menu-bar .maxwidth-theme {
        padding: 0 15px;
    }

    .top-menu-content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "search"
            "catalog"
            "actions";
        gap: 12px;
        width: 100%;
    }

    /* Search - полная ширина, сверху */
    .top-menu-search {
        grid-area: search;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        order: 1;
    }

    .search-input-wrapper {
        width: 100%;
    }

    .search-input {
        width: 100% !important;
        min-width: 100% !important;
        padding: 14px 50px 14px 16px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }

    .search-button {
        right: 10px;
        padding: 10px;
    }

    .search-button svg {
        width: 20px;
        height: 20px;
    }

    /* Catalog Button - полная ширина, по центру */
    .top-menu-catalog {
        grid-area: catalog;
        width: 100% !important;
        justify-content: center !important;
        padding: 14px 20px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
        order: 2;
        box-shadow: 0 2px 6px rgba(238, 39, 34, 0.3) !important;
    }

    .top-menu-catalog svg {
        width: 18px !important;
        height: 18px !important;
    }

    /* Actions - только кнопка заказать звонок на мобиле */
    .top-menu-actions {
        grid-area: actions;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0 !important;
        order: 3;
    }

    .top-menu-callback {
        width: 100% !important;
        padding: 14px 16px !important;
        font-size: 14px !important;
        text-align: center !important;
        border-radius: 10px !important;
        box-shadow: 0 2px 6px rgba(238, 39, 34, 0.3) !important;
    }

    /* Скрываем корзину на мобиле - она есть в хедере */
    .top-menu-cart {
        display: none !important;
    }

    /* Скрываем избранное на мобиле - оно есть в бургер меню */
    .top-menu-wishlist {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .top-menu-bar {
        padding: 10px 0;
    }

    .top-menu-bar .maxwidth-theme {
        padding: 0 12px;
    }

    .top-menu-content {
        gap: 10px;
    }

    .search-input {
        padding: 12px 45px 12px 14px !important;
        font-size: 14px !important;
    }

    .top-menu-catalog {
        padding: 12px 16px !important;
        font-size: 13px !important;
    }

    .top-menu-catalog svg {
        width: 16px !important;
        height: 16px !important;
    }

    .top-menu-callback {
        padding: 12px 14px !important;
        font-size: 13px !important;
    }
}

@media (max-width: 375px) {
    .top-menu-bar .maxwidth-theme {
        padding: 0 10px;
    }

    .top-menu-content {
        gap: 8px;
    }

    .top-menu-catalog,
    .top-menu-callback {
        padding: 11px 12px !important;
        font-size: 12px !important;
    }

    .top-menu-cart {
        width: 44px !important;
        height: 44px !important;
    }
}

/* ============================================
   HIDE OLD ELEMENTS
   ============================================ */

.btn-catalog,
.btn-callback,
.search-form-top,
.callback-cart-wrapper,
.cart-icon-top-menu {
    display: none !important;
}