/* ================================================================
   Mini Cart Drawer — پیشرو موبایل
   فایل: /wp-content/themes/blocksy-child/mini-cart.css
   ================================================================ */

:root {
    --pishro-orange:       #F5A623;
    --pishro-orange-dark:  #C67E0A;
    --pishro-orange-light: #FEF3E0;
    --pishro-drawer-width: 400px;
    --pishro-z:            99999;
}

/* ── Overlay ── */
.pishro-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: var(--pishro-z);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.pishro-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ── Notice (محدودیت موجودی و …) ──
   بنر همیشه‌دیده‌شدنی بین نوار «مشاهده سبد» و بدنه‌ی اسکرول‌شونده؛
   داخل بدنه نیست تا در سبدهای بلند از دید خارج نشود. */
.pishro-drawer__notice {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #FDECEA;
    color: #C0392B;
    border: 1px solid #F5C6C0;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    text-align: start;
    /* حالت جمع‌شده */
    max-height: 0;
    margin: 0 16px;
    padding: 0 14px;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.25s ease,
                padding 0.25s ease, margin 0.25s ease;
}
.pishro-drawer__notice::before {
    content: '\ea05'; /* ti-alert-circle */
    font-family: 'tabler-icons';
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
}
.pishro-drawer__notice.show {
    max-height: 140px;
    margin: 10px 16px 2px;
    padding: 10px 14px;
    opacity: 1;
}

/* ── Drawer ── */
.pishro-drawer {
    position: fixed;
    top: 0;
    left: -100%;
    right: auto;
    width: var(--pishro-drawer-width);
    max-width: 95vw;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: calc(var(--pishro-z) + 1);
    display: flex;
    flex-direction: column;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
}
.pishro-drawer.open {
    left: 0;
}

/* ── تبلت (481px – 768px): drawer fluid ── */
@media (min-width: 481px) and (max-width: 768px) {
    :root { --pishro-drawer-width: 75vw; }
}

/* ── Header ── */
.pishro-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    flex-shrink: 0;
}
.pishro-drawer__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: #222;
}
.pishro-drawer__title svg {
    color: var(--pishro-orange);
}
.pishro-drawer__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e5e5e5;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    transition: all 0.15s;
}
.pishro-drawer__close:hover {
    border-color: var(--pishro-orange);
    color: var(--pishro-orange);
}

/* ── View Cart Bar ── */
.pishro-drawer__view-cart-bar {
    padding: 10px 18px;
    border-bottom: 1px solid #f5e6cc;
    background: var(--pishro-orange-light);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}
.pishro-drawer__view-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--pishro-orange);
    text-decoration: none;
    padding: 6px 20px;
    border: 1.5px solid var(--pishro-orange);
    border-radius: 20px;
    transition: all 0.2s;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}
.pishro-drawer__view-cart-btn:hover {
    background: var(--pishro-orange);
    color: #fff;
}
.pishro-drawer__view-cart-btn svg {
    flex-shrink: 0;
}

/* ── Body ── */
.pishro-drawer__body {
    /* فقط به اندازه‌ی محتوا؛ در سبد پر، شرینک شده و خودش اسکرول می‌شود
       تا فوتر بلافاصله زیر آیتم‌ها بنشیند و دکمه ثبت سفارش بالا و در دسترس بماند */
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 0;
    scroll-behavior: smooth;
}
.pishro-drawer__body::-webkit-scrollbar { width: 4px; }
.pishro-drawer__body::-webkit-scrollbar-track { background: #f9f9f9; }
.pishro-drawer__body::-webkit-scrollbar-thumb { background: #e0e0e0; border-radius: 4px; }

/* ── Loading ── */
.pishro-drawer__loading {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}
.pishro-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top-color: var(--pishro-orange);
    border-radius: 50%;
    animation: pishro-spin 0.7s linear infinite;
}
@keyframes pishro-spin { to { transform: rotate(360deg); } }

/* ── Empty ── */
.pishro-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    gap: 12px;
    color: #bbb;
    font-size: 14px;
}

/* ── Cart Item ── */
.pishro-cart-item {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.15s;
}
.pishro-cart-item:last-child { border-bottom: none; }
.pishro-cart-item:hover { background: #fafafa; }

.pishro-cart-item__img-wrap {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 1px solid #eee;
    overflow: hidden;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pishro-cart-item__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s;
}
.pishro-cart-item__img-wrap:hover img { transform: scale(1.05); }

.pishro-cart-item__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.pishro-cart-item__name {
    font-size: 13px;
    color: #222;
    text-decoration: none;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
}
.pishro-cart-item__name:hover { color: var(--pishro-orange); }

/* تنوع‌ها */
.pishro-cart-item__variation {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
.pishro-var-item {
    font-size: 11px;
    background: #f3f3f3;
    color: #555;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #e5e5e5;
}

/* قیمت و تعداد */
.pishro-cart-item__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

/* کنترل تعداد */
.pishro-cart-item__qty {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pishro-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    background: #fff;
    font-size: 16px;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}
.pishro-qty-btn:hover {
    border-color: var(--pishro-orange);
    color: var(--pishro-orange);
}
.pishro-qty-del {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #ffd0d0;
    background: #fff8f8;
    color: #e53935;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.pishro-qty-del:hover { background: #ffecec; border-color: #e53935; }
.pishro-qty-num {
    font-size: 14px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
    color: #222;
}

/* قیمت‌ها */
.pishro-cart-item__prices {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}
.pishro-discount-badge {
    font-size: 11px;
    background: #fff0f0;
    color: #e53935;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}
.pishro-old-price {
    font-size: 11px;
    color: #bbb;
    text-decoration: line-through;
}
.pishro-old-price .woocommerce-Price-amount { color: #bbb !important; }
.pishro-new-price {
    font-size: 13px;
    color: var(--pishro-orange-dark);
    font-weight: 600;
}

/* ── Footer ── */
.pishro-drawer__footer {
    padding: 14px 18px;
    border-top: 1px solid #f0f0f0;
    background: #fff;
    flex-shrink: 0;
}
.pishro-drawer__total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.pishro-drawer__total-label {
    font-size: 13px;
    color: #888;
}
.pishro-drawer__total-price {
    font-size: 16px;
    font-weight: 600;
    color: #222;
}
.pishro-drawer__total-price .woocommerce-Price-amount { font-size: 16px; }
.pishro-drawer__checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 18px;
    background: var(--pishro-orange);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(245, 166, 35, 0.35);
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.pishro-drawer__checkout-btn::after {
    content: '\2190'; /* فلش به چپ (RTL: حرکت رو به جلو) */
    font-size: 18px;
    line-height: 1;
}
.pishro-drawer__checkout-btn:hover {
    background: var(--pishro-orange-dark);
    color: #fff;
    box-shadow: 0 8px 20px rgba(245, 166, 35, 0.45);
}
.pishro-drawer__checkout-btn:active { transform: translateY(1px); }
.pishro-drawer__checkout-price {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.95;
}

/* ── نوار اعتماد زیر دکمهٔ ثبت سفارش ── */
.pishro-drawer__trust {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}
.pishro-drawer__trust-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 9px;
    border-radius: 8px;
    background: #f7f8fa;
    min-height: 24px;
}
.pishro-drawer__trust-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    color: #fff;
    font-size: 13px;
}
.pishro-drawer__trust-label {
    font-size: 10.5px;
    font-weight: 600;
    color: #444;
    line-height: 1.4;
}
.pishro-drawer__trust-item--registry   .pishro-drawer__trust-icon { background: linear-gradient(135deg, #4a98e0, #3182ce); }
.pishro-drawer__trust-item--processing .pishro-drawer__trust-icon { background: linear-gradient(135deg, #f0759b, #e0568a); }
.pishro-drawer__trust-item--shipping   .pishro-drawer__trust-icon { background: linear-gradient(135deg, #ffb84d, #EF9F27); }
.pishro-drawer__trust-item--support    .pishro-drawer__trust-icon { background: linear-gradient(135deg, var(--pishro-orange), var(--pishro-orange-dark)); }
.pishro-drawer__trust-item--guarantee  .pishro-drawer__trust-icon { background: linear-gradient(135deg, #25b187, #1D9E75); }
.pishro-drawer__trust-item--return     .pishro-drawer__trust-icon { background: linear-gradient(135deg, #9a7dff, #7c5cff); }

/* ── آیکون سبد در هدر ── */
.pishro-header-cart-wrap {
    position: relative;
    cursor: pointer;
}
.pishro-header-count {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--pishro-orange);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    pointer-events: none;
}

/* ── موبایل ── */
@media (max-width: 480px) {
    :root { --pishro-drawer-width: 100vw; }

    .pishro-drawer {
        border-radius: 0;
        /* Safe area برای iPhone X+ */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .pishro-drawer__footer {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    /* دکمه‌های بزرگ‌تر برای لمس */
    .pishro-qty-btn,
    .pishro-qty-del {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
    .pishro-qty-num { font-size: 16px; min-width: 24px; }

    .pishro-drawer__close {
        width: 38px;
        height: 38px;
    }

    /* آیتم بزرگ‌تر */
    .pishro-cart-item__img-wrap {
        width: 72px;
        height: 72px;
    }
    .pishro-cart-item__name { font-size: 13px; }

    /* دکمه checkout بزرگ‌تر */
    .pishro-drawer__checkout-btn {
        padding: 17px 18px;
        font-size: 17px;
    }

    /* Swipe handle نشانگر */
    .pishro-drawer::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: #e0e0e0;
        border-radius: 2px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }
}

/* ================================================================
   مودالِ پیشنهاد اکسسوری (ماژول inc/cart-suggest.php)
   bottom-sheet روی موبایل، مودالِ وسط‌چین روی دسکتاپ
   ================================================================ */
.pishro-suggest-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--pishro-z) + 5);
    display: none;
    align-items: flex-end;
    justify-content: center;
    direction: rtl;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}
.pishro-suggest-modal.visible { display: flex; }

.pishro-suggest-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    transition: opacity 0.28s ease;
}
.pishro-suggest-modal.open .pishro-suggest-modal__overlay { opacity: 1; }

.pishro-suggest-modal__sheet {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    max-height: 86vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.pishro-suggest-modal.open .pishro-suggest-modal__sheet { transform: translateY(0); }

.pishro-suggest-modal__handle {
    width: 40px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin: 8px auto 2px;
    flex-shrink: 0;
}
.pishro-suggest-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 4px;
    flex-shrink: 0;
}
.pishro-suggest-modal__title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 600;
    color: #8a5a08;
}
.pishro-suggest-modal__title i { font-size: 19px; color: var(--pishro-orange); line-height: 1; }
.pishro-suggest-modal__close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e5e5e5;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #777;
    transition: all 0.15s;
}
.pishro-suggest-modal__close:hover { border-color: var(--pishro-orange); color: var(--pishro-orange); }
.pishro-suggest-modal__close i { font-size: 16px; }

.pishro-suggest-modal__body {
    overflow-y: auto;
    padding: 4px 14px 16px;
    min-height: 0;
}
.pishro-suggest__sub {
    font-size: 12px;
    color: #a0894f;
    margin: 2px 2px 12px;
}
.pishro-suggest-modal__loading {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}
.pishro-suggest__list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

/* دسکتاپ: مودالِ وسط‌چین به‌جای شیتِ پایینی */
@media (min-width: 601px) {
    .pishro-suggest-modal { align-items: center; }
    .pishro-suggest-modal__sheet {
        max-width: 440px;
        border-radius: 16px;
        max-height: 80vh;
        transform: translateY(24px);
        opacity: 0;
        transition: transform 0.24s ease, opacity 0.24s ease;
    }
    .pishro-suggest-modal.open .pishro-suggest-modal__sheet { transform: translateY(0); opacity: 1; }
    .pishro-suggest-modal__handle { display: none; }
    .pishro-suggest-modal__head { padding-top: 14px; }
}

.pishro-suggest__card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #f0e6d2;
    border-radius: 10px;
    padding: 8px;
}
.pishro-suggest__img {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    border: 1px solid #eee;
    overflow: hidden;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pishro-suggest__img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.pishro-suggest__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pishro-suggest__name {
    font-size: 12px;
    color: #222;
    text-decoration: none;
    line-height: 1.6;
    /* نامِ کامل — چند خطی، بدون کوتاه‌سازی */
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.pishro-suggest__name:hover { color: var(--pishro-orange); }
.pishro-suggest__price {
    font-size: 12px;
    font-weight: 600;
    color: var(--pishro-orange-dark);
}
.pishro-suggest__price .woocommerce-Price-amount { font-size: 12px; }
.pishro-suggest__price del {
    color: #bbb;
    font-weight: 400;
    font-size: 11px;
    margin-inline-end: 4px;
}
.pishro-suggest__add {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e53e3e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, opacity 0.15s;
}
.pishro-suggest__add i { font-size: 15px; line-height: 1; }
.pishro-suggest__add:hover { background: #cf3030; color: #fff; }
.pishro-suggest__add--link { background: var(--pishro-orange); }
.pishro-suggest__add--link:hover { background: var(--pishro-orange-dark); }
.pishro-suggest__add.is-loading { opacity: 0.55; pointer-events: none; }
.pishro-suggest__add.is-done { background: #1D9E75; pointer-events: none; }
.pishro-suggest__add.is-done:hover { background: #1D9E75; }

/* ── موبایل: هدف لمسیِ بزرگ‌تر ── */
@media (max-width: 480px) {
    .pishro-suggest__img { width: 50px; height: 50px; }
    .pishro-suggest__name { font-size: 13px; }
    .pishro-suggest__price,
    .pishro-suggest__price .woocommerce-Price-amount { font-size: 13px; }
    .pishro-suggest__add { padding: 10px 14px; font-size: 13px; }
    .pishro-suggest__add i { font-size: 16px; }
}

/* iOS scroll lock */
body.pishro-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    /* نگه‌داشتن scroll position */
    top: var(--pishro-scroll-top, 0);
}
