﻿/* =====================================================
   BD CART DRAWER
   ===================================================== */

/* Overlay */
.bd-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
    backdrop-filter: blur(2px);
}
.bd-cart-overlay.open { opacity: 1; visibility: visible; }

/* Drawer panel */
.bd-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0,0,0,.12);
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.bd-cart-drawer.open { transform: translateX(0); }

/* Header */
.bd-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #f0f0f4;
    flex-shrink: 0;
}
.bd-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
}
.bd-drawer-title i { color: #ff4da6; font-size: 18px; }
.bd-drawer-count {
    background: linear-gradient(90deg, #ff4da6, #2563eb);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}
.bd-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    background: #fff;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .2s, color .2s, background .2s;
}
.bd-drawer-close:hover { border-color: #ff4da6; color: #ff4da6; }

/* Body */
.bd-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}
.bd-drawer-body::-webkit-scrollbar { width: 4px; }
.bd-drawer-body::-webkit-scrollbar-track { background: transparent; }
.bd-drawer-body::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* Mini cart item list */
.bd-mini-cart-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Each item */
.bd-mci {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: #f9fafb;
    border-radius: 14px;
    border: 1px solid #f0f0f4;
    transition: border-color .2s;
}
.bd-mci:hover { border-color: #fce7f3; }

/* Image */
.bd-mci-img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
}
.bd-mci-img img,
.bd-mci-img a img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}

/* Item body */
.bd-mci-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.bd-mci-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bd-mci-name a { color: inherit; text-decoration: none; }
.bd-mci-name a:hover { color: #ff4da6; }

.bd-mci-price {
    font-size: 14px;
    font-weight: 800;
    color: #ff4da6;
}
.bd-mci-price .woocommerce-Price-amount { color: #ff4da6; }

/* Bottom row: qty + remove */
.bd-mci-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

/* Qty controls */
.bd-mci-qty {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    overflow: hidden;
}
.bd-mci-btn {
    width: 30px;
    height: 28px;
    border: none;
    background: #fff;
    color: #374151;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.bd-mci-btn:hover { background: #fdf2f8; color: #ff4da6; }
.bd-mci-btn.loading { opacity: .5; pointer-events: none; }
.bd-mci-qty-num {
    min-width: 28px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    line-height: 28px;
}

/* Remove button */
.bd-mci-remove {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #fee2e2;
    background: #fef2f2;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.bd-mci-remove:hover { background: #ef4444; color: #fff; }
.bd-mci-remove.loading { opacity: .5; pointer-events: none; }

/* Mini cart footer */
.bd-mini-cart-footer {
    padding: 18px 22px;
    border-top: 1px solid #f0f0f4;
    background: #fff;
    flex-shrink: 0;
}
.bd-mini-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 14px;
}
.bd-mini-subtotal strong { font-size: 20px; font-weight: 900; color: #0f172a; }
.bd-mini-actions { display: flex; flex-direction: column; gap: 10px; }

/* Checkout button */
.bd-mini-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(90deg, #ff4da6, #8b5cf6, #2563eb);
    background-size: 200% auto;
    color: #fff !important;
    border-radius: 50px;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none !important;
    transition: background-position .4s, transform .2s;
    box-shadow: 0 4px 18px rgba(255,77,166,.3);
}
.bd-mini-checkout:hover { background-position: right center; transform: translateY(-1px); }

/* View cart button */
.bd-mini-viewcart {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    color: #374151 !important;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none !important;
    transition: border-color .2s, color .2s;
}
.bd-mini-viewcart:hover { border-color: #ff4da6; color: #ff4da6 !important; }

/* Empty state */
.bd-mini-empty {
    text-align: center;
    padding: 50px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.bd-mini-empty-icon {
    width: 70px;
    height: 70px;
    background: #fdf2f8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bd-mini-empty-icon i { font-size: 28px; color: #ff4da6; }
.bd-mini-empty p { color: #6b7280; font-size: 15px; margin: 0; }
.bd-mini-shop-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 22px;
    background: linear-gradient(90deg, #ff4da6, #2563eb);
    color: #fff !important;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none !important;
    transition: opacity .2s;
}
.bd-mini-shop-btn:hover { opacity: .88; }

/* Loading spinner overlay */
.bd-drawer-body.bd-loading { position: relative; }
.bd-drawer-body.bd-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Dark mode */
body.dark-mode .bd-cart-drawer { background: #1e293b; }
body.dark-mode .bd-drawer-header { border-bottom-color: rgba(255,255,255,.07); }
body.dark-mode .bd-drawer-title { color: #f1f5f9; }
body.dark-mode .bd-drawer-close { background: #0f172a; border-color: rgba(255,255,255,.1); color: #94a3b8; }
body.dark-mode .bd-mci { background: #0f172a; border-color: rgba(255,255,255,.06); }
body.dark-mode .bd-mci-img { background: #1e293b; border-color: rgba(255,255,255,.08); }
body.dark-mode .bd-mci-name { color: #f1f5f9; }
body.dark-mode .bd-mci-qty { border-color: rgba(255,255,255,.1); }
body.dark-mode .bd-mci-btn { background: #1e293b; color: #94a3b8; }
body.dark-mode .bd-mci-qty-num { color: #f1f5f9; border-color: rgba(255,255,255,.1); }
body.dark-mode .bd-mini-cart-footer { background: #1e293b; border-top-color: rgba(255,255,255,.07); }
body.dark-mode .bd-mini-subtotal { color: #94a3b8; }
body.dark-mode .bd-mini-subtotal strong { color: #f1f5f9; }
body.dark-mode .bd-mini-viewcart { border-color: rgba(255,255,255,.12); color: #cbd5e1 !important; }

/* Responsive */
@media (max-width: 480px) {
    .bd-cart-drawer { width: 100vw; }
}
