/* =====================================================================
   کشوی سبد خرید (functions.php → swangold_render_cart_drawer + cart-drawer.js)
   از سمت چپ باز می‌شه (سایت راست‌چینه، پس سمتِ مقابلِ شروعِ خواندن).
   ===================================================================== */
html.sg-drawer-open,
html.sg-drawer-open body {
    overflow: hidden !important;
}
.sg-cart-drawer[hidden] {
    display: none !important;
}
.sg-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 1000001; /* بالای هدر (۹۹۹۹۹۹) */
}
.sg-cart-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 26, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.sg-cart-drawer__panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: min(400px, 88vw);
    background: #fff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    outline: none;
    direction: rtl;
}
.sg-cart-drawer.is-open .sg-cart-drawer__backdrop { opacity: 1; }
.sg-cart-drawer.is-open .sg-cart-drawer__panel { transform: none; }

.sg-cart-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--sg-champagne, #F2EEE9);
}
.sg-cart-drawer__title {
    margin: 0 !important;
    font-size: 1.05rem !important;
    font-weight: 500 !important;
    color: var(--sg-black, #1A1A1A) !important;
}
.sg-cart-drawer__close {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50%;
    background: #F5F4F1 !important;
    color: var(--sg-black, #1A1A1A) !important;
    font-size: 22px !important;
    line-height: 36px !important;
    cursor: pointer;
}
.sg-cart-drawer__note {
    margin: 12px 18px 0 !important;
    padding: 10px 12px;
    border-right: 3px solid var(--sg-gold, #C5A059);
    background: #F5F4F1;
    font-size: 0.82rem;
    line-height: 1.8;
    color: var(--sg-text-body, #333);
}

/* ---------- مینی‌کارتِ ووکامرس داخلِ کشو ---------- */
.sg-cart-drawer .widget_shopping_cart_content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 18px;
}
.sg-cart-drawer ul.woocommerce-mini-cart {
    flex: 1 1 auto;
    overflow-y: auto;
    margin: 0 !important;
    padding: 6px 0 !important;
    list-style: none !important;
}
/* هنگامِ باز بودنِ کشو، دکمه‌های شناور (چت/پشتیبانی) روی سبد نیفتن */
html.sg-drawer-open #swan-chat,
html.sg-drawer-open #sg-support-fab,
html.sg-drawer-open iframe[id^="goftino"] {
    visibility: hidden !important;
}
.sg-cart-drawer li.woocommerce-mini-cart-item {
    position: relative;
    display: block !important;
    padding: 12px 0 12px 32px !important;
    margin: 0 !important;
    border-bottom: 1px solid var(--sg-champagne, #F2EEE9);
    font-size: 0.85rem;
    line-height: 1.6;
}
/* عکس + نام در یک ردیف؛ قیمت زیرِ نام */
.sg-cart-drawer li.woocommerce-mini-cart-item > a:not(.remove) {
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    color: var(--sg-black, #1A1A1A) !important;
    font-weight: 400 !important;
    text-decoration: none !important;
}
.sg-cart-drawer li.woocommerce-mini-cart-item img {
    flex: none;
    width: 64px !important;
    height: 64px !important;
    margin: 0 !important;
    float: none !important;
    border-radius: 8px;
    object-fit: cover;
    background: #F6F4F0;
}
.sg-cart-drawer li.woocommerce-mini-cart-item .quantity {
    display: block;
    margin: -24px 76px 0 0; /* پایینِ نوارِ ۶۴پیکسلیِ عکس، زیرِ نام */
    color: var(--sg-text-muted, #767676);
    font-size: 0.8rem;
}
.sg-cart-drawer li.woocommerce-mini-cart-item .quantity .amount {
    color: var(--sg-black, #1A1A1A);
    font-weight: 500;
}
.sg-cart-drawer li.woocommerce-mini-cart-item dl.variation {
    margin: 0 76px 0 0 !important;
    font-size: 0.75rem;
    color: var(--sg-text-muted, #767676);
}
.sg-cart-drawer li.woocommerce-mini-cart-item a.remove {
    position: absolute !important;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px !important;
    height: 24px !important;
    line-height: 22px !important;
    border-radius: 50%;
    text-align: center;
    color: var(--sg-text-muted, #767676) !important;
    background: #F5F4F1 !important;
    font-size: 16px !important;
    text-decoration: none !important;
}
.sg-cart-drawer li.woocommerce-mini-cart-item a.remove:hover {
    color: var(--sg-price-old, #C84B31) !important;
}
.sg-cart-drawer .woocommerce-mini-cart__total {
    display: flex;
    justify-content: space-between;
    margin: 0 !important;
    padding: 14px 0 !important;
    border-top: 0 !important;
    font-size: 0.95rem;
}
.sg-cart-drawer .woocommerce-mini-cart__total .amount {
    font-weight: 500;
}
.sg-cart-drawer .woocommerce-mini-cart__buttons {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 !important;
    padding: 0 0 12px !important;
}
.sg-cart-drawer .woocommerce-mini-cart__buttons .button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 46px;
    margin: 0 !important;
    padding: 0 10px !important;
    border-radius: 10px !important;
    font-size: 0.9rem !important;
    border: 1px solid var(--sg-gold, #C5A059) !important;
    background: #fff !important;
    color: var(--sg-gold-dark, #9E7B3B) !important;
    box-shadow: none !important;
}
.sg-cart-drawer .woocommerce-mini-cart__buttons .button.checkout {
    background: var(--sg-black, #1A1A1A) !important;
    border-color: var(--sg-black, #1A1A1A) !important;
    color: #fff !important;
}
.sg-cart-drawer .woocommerce-mini-cart__empty-message {
    margin: 40px 0 !important;
    text-align: center;
    color: var(--sg-text-muted, #767676);
}
.sg-cart-drawer__continue {
    margin: 0 18px 16px;
    padding: 10px !important;
    border: 0 !important;
    background: none !important;
    color: var(--sg-text-body, #333) !important;
    font-size: 0.88rem !important;
    text-decoration: underline;
    text-underline-offset: 4px;
    cursor: pointer;
}
@media (prefers-reduced-motion: reduce) {
    .sg-cart-drawer__panel,
    .sg-cart-drawer__backdrop { transition: none; }
}
