﻿/* =========================
   B2B Cart UI Component CSS
   ========================= */

/* wrapper */
.b2b-cart-ui {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* add button (در چند جا استفاده شده) */
.b2b-btn-add {
    height: 40px !important;
    border-radius: 12px !important;
    padding: 0 12px !important;
    white-space: nowrap;
}

/* qty control container */
.b2b-qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

/* qty buttons */
.b2b-qty-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: #f5f5f5;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* qty input */
.b2b-qty-input {
    width: 44px;
    height: 34px;
    border: none;
    text-align: center;
    font-weight: 600;
    outline: none;
    direction: ltr;
}

/* small variant */
.b2b-cart-ui.small .b2b-qty-btn,
.b2b-qty-control.small .b2b-qty-btn {
    width: 30px;
    height: 30px;
}

.b2b-cart-ui.small .b2b-qty-input,
.b2b-qty-control.small .b2b-qty-input {
    width: 40px;
    height: 30px;
}

/* اگر داخل دکمه آیکون ti داری */
.b2b-qty-btn .ti {
    font-size: 16px;
}

/* نمایش/عدم نمایش بر اساس data-mode */
.b2b-cart-ui[data-mode="add"] .b2b-qty-control {
    display: none !important;
}

.b2b-cart-ui[data-mode="add"] .b2b-btn-add {
    display: inline-flex !important;
}

.b2b-cart-ui[data-mode="qty"] .b2b-qty-control {
    display: flex !important;
}

.b2b-cart-ui[data-mode="qty"] .b2b-btn-add {
    display: none !important;
}

/* ترتیب دکمه‌ها (طبق CSS شما) */
.b2b-qty-btn.plus {
    order: 1;
}

.b2b-qty-input {
    order: 2;
}

.b2b-qty-btn.minus {
    order: 3;
}

/* حالت ماکس/غیرفعال */
.b2b-qty-btn.plus.is-max,
.b2b-qty-btn.plus:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Admin order selector */
.order-product-card {
    border: 1px solid #e8edf5;
    border-radius: 16px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.order-product-card:hover { border-color: #b9cbee; box-shadow: 0 8px 24px rgba(33, 73, 132, .08); }
.order-product-card.order-product-added { border-color: #9ee2c1; background: linear-gradient(110deg, #f2fcf6, #fff 55%); }
.order-qty-control { height: 38px; margin: 0 auto 7px; border-color: #d6e0ee; border-radius: 11px; box-shadow: 0 2px 7px rgba(30, 60, 100, .07); }
.order-qty-control .b2b-qty-btn { width: 34px; height: 38px; color: #315c9e; background: #f0f5fc; }
.order-qty-control .b2b-qty-btn:hover { background: #dfeaff; }
.order-qty-control .b2b-qty-input { width: 48px; height: 38px; font-weight: 800; color: #233a5d; }
.order-qty-control .b2b-qty-input::-webkit-inner-spin-button,
.order-qty-control .b2b-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.order-qty-control .b2b-qty-input { appearance: textfield; }
.order-selected-badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; margin: 0 0 7px; padding: 5px 10px; border-radius: 999px; background: #dcf8e9; color: #137448; font-size: 12px; font-weight: 700; }
.order-selected-badge.d-none { display: none; }

.admin-order-list-heading,
.admin-order-row {
    display: grid;
    grid-template-columns: minmax(250px, 1fr) minmax(140px, 170px) 150px 92px;
    align-items: center;
    gap: 18px;
    direction: rtl;
}
.admin-order-list-heading { padding: 10px 16px; color: #7c8799; border-bottom: 1px solid #e0e6ee; font-size: 11px; font-weight: 800; }
.admin-order-list { padding: 0; overflow: visible; border: 1px solid #e4eaf1; border-radius: 15px; background: #fff; }
.admin-order-list .admin-order-row { margin: 0; padding: 15px 16px; border: 0; border-bottom: 1px solid #edf1f5; background: #fff; transition: background .15s ease; }
.admin-order-list .admin-order-row:last-child { border-bottom: 0; }
.admin-order-list .admin-order-row:hover { background: #f7faff; }
.admin-order-list .admin-order-row.order-product-added { background: #f4fbf7; }
.admin-order-product { min-width: 0; }
.admin-order-product > strong { display: block; color: #1e293b; font-size: 14px; font-weight: 800; line-height: 1.65; }
.admin-order-subline { display: flex; flex-wrap: wrap; gap: 4px 9px; margin-top: 3px; color: #8792a3; font-size: 11px; }
.admin-order-sku { direction: ltr; font-weight: 700; color: #52677f; }
.admin-order-details { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.admin-order-detail { display: inline-flex; align-items: center; gap: 4px; min-height: 23px; padding: 3px 7px; border: 1px solid #e6ebf1; border-radius: 6px; background: #f8fafc; color: #66758a; font-size: 10px; line-height: 1.2; white-space: nowrap; }
.admin-order-detail b { color: #334155; font-size: 11px; }
.admin-order-detail.is-stocked { background: #effaf4; border-color: #d7efdf; color: #16764d; }
.admin-order-detail.is-stocked b { color: #16764d; }
.admin-order-detail.is-empty { background: #fff5f4; border-color: #f4dbd8; color: #b44944; }
.admin-order-detail.is-empty b { color: #b44944; }
.admin-order-product .order-selected-badge { margin: 7px 0 0; }
.admin-order-fact small,
.admin-order-quantity label { display: block; margin-bottom: 5px; color: #718096; font-size: 11px; font-weight: 700; }
.admin-order-fact strong { display: block; color: #273c5b; font-size: 15px; }
.admin-order-fact.is-stocked strong { color: #148354; }
.admin-order-fact.is-empty strong { color: #c24d53; }
.admin-order-fact > span { display: block; margin-top: 4px; color: #8591a3; font-size: 10px; }
.admin-order-price { min-width: 0; }
.admin-order-price .b2b-price-desktop { font-size: 12px; }
.admin-order-price .b2b-price-line { margin: 0; }
.admin-order-price .b2b-price-value { font-size: 15px; font-weight: 900; }
.admin-order-quantity { min-width: 0; }
.admin-order-quantity .order-qty-control { display: flex; align-items: center; gap: 7px; width: fit-content; height: auto; margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.admin-order-quantity .order-qty-control.d-none { display: none; }
.admin-order-quantity .order-qty-control .b2b-qty-btn { width: 30px; height: 34px; border: 1px solid #d9e3ee; border-radius: 8px; background: #f1f5fa; color: #365b84; }
.admin-order-quantity .order-qty-control .b2b-qty-input { width: 43px; height: 34px; border: 1px solid #cedbe9; border-radius: 8px; background: #fff; }
.admin-order-total { display: block; margin-top: 6px; color: #2563a3; font-size: 11px; font-weight: 800; white-space: nowrap; }
.admin-order-action { display: flex; justify-content: flex-start; }
.admin-order-action .order-add-button { min-width: 88px; height: 36px; margin: 0; border-radius: 8px; font-size: 12px; font-weight: 800; }
@media (max-width: 740px) {
    .admin-order-list-heading { display: none; }
    .admin-order-row { grid-template-columns: minmax(0, 1fr) 145px 92px; gap: 11px; }
    .admin-order-product { grid-column: 1 / -1; }
    .admin-order-price { grid-column: 1; }
    .admin-order-action { align-self: center; }
}
@media (max-width: 500px) {
    .admin-order-row { grid-template-columns: minmax(0, 1fr) 96px; }
    .admin-order-price { grid-column: 1 / -1; }
    .admin-order-quantity { grid-column: 1; }
    .admin-order-action { grid-column: 2; align-self: end; }
}


