/* =========================================
   B2B HEADER & CART FULL STYLES (Final PC Optimization)
   ========================================= */

/* --- 1. ГЛОБАЛЬНІ ПРАВИЛА --- */
body { overflow-x: hidden !important; width: 100% !important; }
* { box-sizing: border-box !important; }

/* Кабінет (Dropdown) */
#top-links .dropdown-menu { display: none; }
#top-links .dropdown.open .dropdown-menu { display: block; }
#form-language { display: none !important; }

/* --- 2. ПК ВЕРСІЯ ШАПКИ --- */
@media (min-width: 768px) {
    .b2b-main-header { background: #fff; padding: 20px 0; border-bottom: 1px solid #eee; }
    .b2b-header-layout { display: flex; align-items: center; justify-content: space-between; }
    
    .b2b-logo-zone { flex: 0 0 250px; }
    .b2b-cart-zone { flex: 0 0 250px; display: flex; justify-content: flex-end; }
    
    .b2b-search-zone { 
        flex: 1; max-width: 600px; padding: 0 40px; 
        display: flex; flex-direction: column; align-items: center; 
    }
    .b2b-search-box { width: 100%; margin-bottom: 8px; }
    .b2b-search-wrap { display: flex; width: 100%; }
    .b2b-search-input { height: 42px; border: 2px solid #229ac8; border-radius: 4px 0 0 4px; flex: 1; padding: 0 15px; }
    .b2b-search-btn { height: 42px; width: 60px; background: #229ac8; border: none; border-radius: 0 4px 4px 0; color: #fff; }
}

/* --- 3. МОБІЛЬНА ВЕРСІЯ ШАПКИ --- */
@media (max-width: 767px) {
    .b2b-main-header { padding: 12px 0; border-bottom: 1px solid #eee; }
    .b2b-header-layout { display: flex; flex-wrap: wrap; width: 100%; }
    
    .b2b-logo-zone { flex: 0 0 50%; order: 1; padding-left: 15px; }
    .b2b-cart-zone { flex: 0 0 50%; order: 2; display: flex; justify-content: flex-end; padding-right: 15px; }
    
    .b2b-search-zone { order: 3; flex: 0 0 100%; width: 100%; padding: 0 15px !important; margin-top: 15px; }
    .b2b-search-wrap { display: flex !important; width: 100% !important; flex-wrap: nowrap !important; }
    .b2b-search-input { flex: 1 !important; min-width: 0 !important; height: 40px !important; border: 2px solid #229ac8 !important; border-radius: 4px 0 0 4px !important; padding-left: 10px; }
    .b2b-search-btn { flex: 0 0 50px !important; width: 50px !important; height: 40px !important; background: #229ac8 !important; border: none; border-radius: 0 4px 4px 0 !important; color: #fff; }

    .b2b-contacts-row { justify-content: center; margin-top: 15px; display: flex; width: 100%; }
    #logo img { max-height: 32px; }
    #cart > .btn { height: 38px; padding: 0 10px; font-size: 12px; }
}

/* --- 4. КОНТАКТИ --- */
.b2b-contacts-row { display: flex; align-items: center; }
.b2b-phone { font-weight: 700; font-size: 15px; color: #333; text-decoration: none !important; }
.b2b-sep { margin: 0 10px; color: #ccc; }
.b2b-socials { display: flex; gap: 8px; }
.b2b-ico { width: 26px; height: 26px; border-radius: 50%; color: #fff !important; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.viber { background: #7360f2; }
.telegram { background: #229ED9; }
.whatsapp { background: #25D366; }
@media (max-width: 767px) { .b2b-ico { width: 32px; height: 32px; font-size: 16px; } }

/* --- 5. ВІКНО КОШИКА (МОБІЛЬНА ФІКСАЦІЯ) --- */
@media (max-width: 767px) {
    .b2b-cart-zone { position: static !important; }
    #cart { position: relative !important; }
    #cart.open .dropdown-menu {
        display: block !important; position: fixed !important;
        top: 60px !important; left: 10px !important; right: 10px !important;
        width: calc(100vw - 20px) !important; max-height: 85vh !important;
        overflow-y: auto !important; -webkit-overflow-scrolling: touch !important;
        z-index: 9999 !important; box-shadow: 0 10px 40px rgba(0,0,0,0.4) !important;
        border-radius: 8px !important; background: #fff !important; padding: 10px !important;
    }
}

/* --- 6. ДИЗАЙН ЕЛЕМЕНТІВ ВСЕРЕДИНІ КОШИКА --- */

/* Кнопка Оформити замовлення */
.b2b-cart-header-btn { padding: 12px !important; background: #fdfdfd !important; border-bottom: 2px solid #eee !important; text-align: center !important; }
.b2b-checkout-btn-main {
    display: block !important; background: #229ac8 !important; color: #ffffff !important;
    padding: 15px 10px !important; border-radius: 6px !important; font-weight: 800 !important;
    font-size: 15px !important; text-decoration: none !important; text-transform: uppercase !important;
    box-shadow: 0 4px 0 #1a7ba1 !important; transition: all 0.2s ease !important;
}
.b2b-checkout-btn-main:hover { background: #1e87b0 !important; transform: translateY(1px) !important; box-shadow: 0 2px 0 #1a7ba1 !important; }

/* Блок підсумків (Разом) */
.b2b-totals-top { padding: 10px 12px !important; background: #fdfdfd !important; border-bottom: 1px solid #ddd !important; }
.b2b-table-totals { margin: 0 !important; border: 2px solid #229ac8 !important; width: 100% !important; }
.b2b-table-totals td { padding: 8px 10px !important; background: #fff !important; font-size: 14px !important; }
.b2b-total-text { color: #000 !important; font-size: 16px !important; }

/* Список товарів */
.b2b-cart-sku-text { font-weight: 800 !important; color: #000 !important; font-size: 13px !important; text-transform: uppercase; display: block; margin-bottom: 2px; word-break: break-all; line-height: 1.2; }
.b2b-item-qty { color: #333 !important; font-weight: 600 !important; font-size: 13px !important; white-space: nowrap; }
.b2b-item-price { color: #229ac8 !important; font-weight: 800 !important; font-size: 14px !important; white-space: nowrap; }

/* Приховування зайвого */
.b2b-cart-table-items small, 
.b2b-cart-table-items br, 
#cart .dropdown-menu p.text-right { 
    display: none !important; 
}

/* --- 7. ОПТИМІЗАЦІЯ ШИРИНИ КОШИКА ДЛЯ ПК (НОВЕ) --- */
@media (min-width: 768px) {
    /* Розширюємо випадаюче вікно на десктопах */
    #cart .dropdown-menu {
        width: 480px !important; 
        left: auto !important;
        right: 0 !important;
        padding: 15px !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
    }

    /* Налаштування колонок таблиці */
    .b2b-cart-table-items {
        table-layout: auto !important;
        width: 100% !important;
    }

    /* Фото товару */
    .b2b-cart-table-items td:nth-child(1) {
        width: 70px !important;
    }

    /* Артикул - даємо максимум простору */
    .b2b-cart-table-items td:nth-child(2) {
        width: auto !important;
        padding-right: 20px !important;
    }

    /* Кількість */
    .b2b-cart-table-items td:nth-child(3) {
        width: 65px !important;
        text-align: center !important;
    }

    /* Ціна */
    .b2b-cart-table-items td:nth-child(4) {
        width: 110px !important;
        text-align: right !important;
    }

    /* Кнопка Х */
    .b2b-cart-table-items td:nth-child(5) {
        width: 45px !important;
    }
}

#cart .dropdown-menu .text-center img { width: 50px !important; }