/* ============================================================================
   BulletBro Custom Mini-Cart — Slide-in Drawer (светлая тема)
   Согласован с bb-wishlist.css и Porto-стилями сайта.
   ============================================================================ */

/* ── 1. PORTO MINI-CART: скрываем полностью, заменяем шорткодом [bb_cart_trigger] ── */
/*
 * Вставьте [bb_cart_trigger] в Porto Header Builder вместо стандартной корзины.
 * Наша кнопка открывает bb-cart-drawer, счётчик и сумма обновляются через WC fragments.
 */

/*#mini-cart {
    display: none !important;
}*/

/* ── 2. HEADER TRIGGER (наша кнопка корзины — шорткод [bb_cart_trigger]) ─── */

#bb-cart-trigger,
.bb-cart-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

#bb-cart-trigger svg,
.bb-cart-trigger svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    pointer-events: none;
}

.bb-cart-header-wrap {
    display: inline-flex;
    align-items: center;
}

.bb-cart-trigger-label {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: inherit;
}

@media (max-width: 767px) {
    .bb-cart-trigger-label,
    .bb-cart-total {
        display: none;
    }
}

/* Счётчик рядом с иконкой */
.bb-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #e53935;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    line-height: 1;
    vertical-align: middle;
    transition: opacity 0.2s;
}

.bb-cart-count.is-empty {
    opacity: 0;
    pointer-events: none;
}

/* ── 3. DRAWER WRAPPER (full-screen, pointer-events нет пока закрыт) ─────── */

.bb-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.bb-cart-drawer.is-open {
    pointer-events: auto;
}

/* Overlay — полупрозрачный фон */
.bb-cart-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bb-cart-drawer.is-open .bb-cart-drawer-overlay {
    opacity: 1;
}

/* ── 4. DRAWER PANEL (slide from right) — светлая тема ───────────────────── */

.bb-cart-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 100vw;
    background: #ffffff;
    color: #111;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.bb-cart-drawer.is-open .bb-cart-drawer-panel {
    transform: translateX(0);
}

/* ── 5. DRAWER HEAD ──────────────────────────────────────────────────────── */

.bb-cart-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e8e8;
    background: #f4f4f4;
    flex-shrink: 0;
}

.bb-cart-drawer-title {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #111;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bb-cart-drawer-title .bb-cart-count {
    background: #e53935;
    color: #fff;
}

.bb-cart-drawer-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    transition: color 0.18s;
}

.bb-cart-drawer-close:hover {
    color: #111;
}

.bb-cart-drawer-close svg {
    width: 20px;
    height: 20px;
}

/* ── 6. DRAWER BODY (прокрутка) ──────────────────────────────────────────── */

.bb-cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

.bb-cart-drawer-body::-webkit-scrollbar {
    width: 4px;
}
.bb-cart-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}
.bb-cart-drawer-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.14);
    border-radius: 2px;
}

/* Пустая корзина */
.bb-cart-empty-msg {
    padding: 48px 20px;
    text-align: center;
    color: #999;
    font-size: 13px;
    margin: 0;
}

/* ── 7. CART ITEMS ───────────────────────────────────────────────────────── */

.bb-cart-items-wrap {
    display: flex;
    flex-direction: column;
}

.bb-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    transition: background 0.18s;
}

.bb-cart-item:last-child {
    border-bottom: none;
}

.bb-cart-item:hover {
    background: #fafafa;
}

/* Изображение */
.bb-cart-item-img {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 4px;
    overflow: hidden;
    display: block;
    background: #f0f0f0;
}

.bb-cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Информация о товаре */
.bb-cart-item-info {
    flex: 1;
    min-width: 0;
    padding-right: 24px;
}

.bb-cart-item-name {
    display: block;
    font-size: 12px;
    color: #111;
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}

.bb-cart-item-name:hover {
    color: #444;
}

/* EPO-опции */
.bb-cart-epo-list {
    list-style: none;
    margin: 2px 0 6px;
    padding: 0;
}

.bb-cart-epo-list li {
    font-size: 10px;
    color: #888;
    line-height: 1.4;
}

.bb-cart-epo-lbl {
    color: #aaa;
}

/* Стандартный WC item meta (fallback) */
.bb-cart-item-meta {
    font-size: 10px;
    color: #888;
    margin: 2px 0 6px;
}

.bb-cart-item-meta dl {
    margin: 0;
    padding: 0;
}

.bb-cart-item-meta dt,
.bb-cart-item-meta dd {
    display: inline;
    margin: 0;
    font-size: 10px;
}

.bb-cart-item-meta dt::after {
    content: ': ';
}

.bb-cart-item-meta dd::after {
    content: '\a';
    white-space: pre;
}

/* Нижняя строка: кол-во × цена */
.bb-cart-item-bottom {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.bb-cart-item-qty {
    font-size: 11px;
    color: #aaa;
}

.bb-cart-item-price {
    font-size: 12px;
    color: #111;
    letter-spacing: 0.02em;
}

/* Кнопка удаления */
.bb-cart-item-remove {
    position: absolute;
    top: 14px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #bbb;
    text-decoration: none;
    transition: color 0.18s;
    flex-shrink: 0;
}

.bb-cart-item-remove:hover {
    color: #e53935;
}

.bb-cart-item-remove svg {
    width: 14px;
    height: 14px;
    pointer-events: none;
}

.bb-cart-item-remove.bb-loading {
    opacity: 0.4;
    pointer-events: none;
}

/* ── 8. DRAWER FOOT ──────────────────────────────────────────────────────── */

.bb-cart-drawer-foot {
    padding: 16px 20px;
    border-top: 1px solid #e8e8e8;
    background: #f4f4f4;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bb-cart-foot-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    letter-spacing: 0.1em;
    color: #888;
    margin-bottom: 2px;
}

.bb-cart-total {
    font-size: 14px;
    color: #111;
    letter-spacing: 0.04em;
}

/* Кнопки */
.bb-cart-foot-btn {
    display: block;
    width: 100%;
    padding: 11px 16px;
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-decoration: none;
    border-radius: 2px;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    line-height: 1.3;
    cursor: pointer;
}

/* «Просмотр корзины» — outline */
.bb-cart-foot-btn--secondary {
    background: transparent;
    border: 1px solid #ccc;
    color: #555;
}

.bb-cart-foot-btn--secondary:hover {
    border-color: #555;
    color: #111;
}

/* «Оформить заказ» — filled black */
.bb-cart-foot-btn--primary {
    background: #111;
    border: 1px solid #111;
    color: #fff;
}

.bb-cart-foot-btn--primary:hover {
    background: #333;
    border-color: #333;
    color: #fff;
}

/* ── 9. BODY LOCK при открытой корзине ───────────────────────────────────── */

body.bb-cart-open {
    overflow: hidden;
}

/* ── 10. MOBILE ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .bb-cart-drawer-panel {
        width: 100vw;
    }
}

/* ── 11. SPINNER при загрузке ────────────────────────────────────────────── */

.bb-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}
