/* ANIL side cart — scoped to the theme cart drawer only. */
:root {
    --anil-cart-navy: #12367d;
    --anil-cart-navy-dark: #0b2b68;
    --anil-cart-orange: #ff8617;
    --anil-cart-green: #168f55;
    --anil-cart-text: #17263d;
    --anil-cart-muted: #748096;
    --anil-cart-line: #e4e9f1;
    --anil-cart-soft: #f5f8fc;
}

html.anil-cart-open,
body.anil-cart-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* Fail-safe: the drawer cannot become visible until the JS has confirmed
   that opening was authorized by an actual cart-trigger click. */
html:not(.anil-cart-open) .cart_sidebar.togglesidebar,
body:not(.anil-cart-open) .cart_sidebar.togglesidebar {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(105%) !important;
}

.cart_sidebar.togglesidebar {
    width: min(430px, 100vw) !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    direction: rtl;
    color: var(--anil-cart-text);
    background: #fff;
    box-shadow: -18px 0 55px rgba(8, 25, 53, .17);
}

.cart_sidebar .cart_sidebar_wrap {
    display: flex !important;
    flex-direction: column !important;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff;
}

.cart_sidebar .cart_sidebar_head {
    position: relative;
    z-index: 4;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 68px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--anil-cart-line);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 4px 16px rgba(17, 39, 70, .045);
}

.cart_sidebar .cart_sidebar_head strong {
    margin-left: auto;
    color: var(--anil-cart-navy-dark);
    font-size: 17px;
    font-weight: 800;
}

.cart_sidebar .cart_count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 28px;
    padding: 3px 9px;
    border-radius: 8px;
    color: #fff;
    background: var(--anil-cart-navy-dark);
    font-size: 10px;
    font-weight: 700;
}

.cart_sidebar .cart_count::after {
    content: ' کالا';
    font-weight: 500;
}

.cart_sidebar .cart_sidebar_close {
    display: grid;
    place-items: center;
    order: 3;
    width: 40px;
    height: 40px;
    margin: 0 !important;
    border: 1px solid #dbe2ec;
    border-radius: 10px;
    color: var(--anil-cart-navy-dark);
    background: #fff;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.cart_sidebar .cart_sidebar_close:hover {
    border-color: #b9c8dd;
    background: #f3f6fb;
    transform: rotate(3deg);
}

.cart_sidebar .cart_sidebar_close svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.cart_sidebar .widget_shopping_cart_content {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: column !important;
    min-width: 0;
    min-height: 0;
    overflow: hidden !important;
    background: var(--anil-cart-soft);
}

.cart_sidebar .elementor-menu-cart__products,
.cart_sidebar .woocommerce-mini-cart.cart_list {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 !important;
    padding: 10px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #c2cad7 transparent;
}

.cart_sidebar .elementor-menu-cart__products::-webkit-scrollbar,
.cart_sidebar .woocommerce-mini-cart.cart_list::-webkit-scrollbar {
    width: 5px;
}

.cart_sidebar .elementor-menu-cart__products::-webkit-scrollbar-thumb,
.cart_sidebar .woocommerce-mini-cart.cart_list::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #c2cad7;
}

.cart_sidebar .elementor-menu-cart__product {
    position: relative;
    display: grid !important;
    grid-template-columns: 88px minmax(0, 1fr) 34px !important;
    grid-template-areas:
        'image name remove'
        'image price remove' !important;
    align-items: start;
    gap: 8px 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 0 9px !important;
    padding: 10px !important;
    border: 1px solid var(--anil-cart-line) !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: 0 3px 13px rgba(17, 39, 70, .045);
}

.cart_sidebar .elementor-menu-cart__product:last-child { margin-bottom: 0 !important; }

.cart_sidebar .elementor-menu-cart__product-image {
    grid-area: image;
    width: 88px !important;
    height: 88px !important;
    margin: 0 !important;
    padding: 5px !important;
    overflow: hidden;
    border: 1px solid #edf0f5;
    border-radius: 10px;
    background: #fff;
}

.cart_sidebar .elementor-menu-cart__product-image a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.cart_sidebar .elementor-menu-cart__product-image img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 78px !important;
    max-height: 78px !important;
    margin: 0 !important;
    object-fit: contain !important;
}

.cart_sidebar .elementor-menu-cart__product-name {
    grid-area: name;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    color: var(--anil-cart-text);
}

.cart_sidebar .elementor-menu-cart__product-name > a {
    display: -webkit-box !important;
    overflow: hidden;
    color: var(--anil-cart-navy-dark) !important;
    font-size: 11.5px !important;
    font-weight: 750 !important;
    line-height: 1.75 !important;
    text-decoration: none !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.cart_sidebar .lead_time.el_lt_cart {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    float: none !important;
    width: auto !important;
    min-height: 24px;
    margin: 6px 0 3px !important;
    padding: 3px 7px !important;
    border-radius: 7px;
    color: var(--anil-cart-green) !important;
    background: #eaf8f0 !important;
    font-size: 8.5px !important;
    font-weight: 700;
}

.cart_sidebar .lead_time svg {
    width: 15px !important;
    height: 15px !important;
    fill: currentColor;
}

.cart_sidebar .elementor-menu-cart__product-name .clear { display: none !important; }

.cart_sidebar .elementor-menu-cart__product-name dl.variation {
    display: flex !important;
    flex-wrap: wrap;
    gap: 5px;
    width: 100%;
    margin: 3px 0 0 !important;
    padding: 0 !important;
}

.cart_sidebar dl.variation dt,
.cart_sidebar dl.variation dd {
    display: inline-flex !important;
    align-items: center;
    min-height: 24px;
    margin: 0 !important;
    padding: 3px 6px !important;
    border: 1px solid #e5eaf2;
    color: #637086;
    background: #f9fbfd;
    font-size: 8px !important;
    line-height: 1.45 !important;
}

.cart_sidebar dl.variation dt {
    margin-left: -5px !important;
    border-left: 0;
    border-radius: 6px 6px 0 0;
    font-weight: 500 !important;
}

.cart_sidebar dl.variation dd {
    margin-left: 3px !important;
    border-radius: 0 0 6px 6px;
    color: var(--anil-cart-text);
    font-weight: 700;
}

.cart_sidebar dl.variation p { margin: 0 !important; font: inherit !important; }

.cart_sidebar .elementor-menu-cart__product-price {
    grid-area: price;
    align-self: end;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}

.cart_sidebar .elementor-menu-cart__product-price .quantity {
    display: flex !important;
    align-items: center;
    gap: 5px;
    color: var(--anil-cart-muted);
    font-size: 9px !important;
}

.cart_sidebar .elementor-menu-cart__product-price .product-quantity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 26px;
    padding: 2px 6px;
    border: 1px solid #dce3ed;
    border-radius: 7px;
    color: var(--anil-cart-navy-dark);
    background: #fff;
    font-weight: 700;
}

.cart_sidebar .elementor-menu-cart__product-price .woocommerce-Price-amount {
    color: var(--anil-cart-navy-dark) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
}

.cart_sidebar .woocommerce-Price-currencySymbol {
    margin-right: 3px;
    font-size: .78em;
    font-weight: 500;
}

.cart_sidebar .elementor-menu-cart__product-remove {
    grid-area: remove;
    align-self: start;
    display: block !important;
    width: 32px !important;
    height: 32px !important;
    margin: 0 !important;
}

.cart_sidebar .elementor-menu-cart__product-remove a {
    position: relative !important;
    display: grid !important;
    place-items: center;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    margin: 0 !important;
    border: 1px solid #f0d5d8 !important;
    border-radius: 8px !important;
    color: #d63d4a !important;
    background: #fff7f7 !important;
    font-size: 0 !important;
    text-decoration: none !important;
}

.cart_sidebar .elementor-menu-cart__product-remove a::before {
    content: '';
    width: 15px;
    height: 17px;
    background: currentColor;
    clip-path: polygon(20% 18%, 80% 18%, 76% 100%, 24% 100%, 20% 18%, 35% 18%, 38% 5%, 62% 5%, 65% 18%, 90% 18%, 90% 28%, 10% 28%, 10% 18%);
}

.cart_sidebar .elementor-menu-cart__product-remove a:hover {
    border-color: #e7aab0 !important;
    background: #ffeded !important;
}

.cart_sidebar .elementor-menu-cart__product-remove a + a { display: none !important; }

/* Native mini-cart quantity controls, when the active template provides them. */
.cart_sidebar .quantity.anil-cart-qty-ready {
    display: inline-grid !important;
    grid-template-columns: 30px 40px 30px;
    align-items: center;
    overflow: hidden;
    border: 1px solid #dce3ed;
    border-radius: 8px;
    background: #fff;
}

.cart_sidebar .anil-cart-qty-button,
.cart_sidebar .quantity.anil-cart-qty-ready input.qty {
    width: 100% !important;
    height: 30px !important;
    min-height: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    text-align: center;
    background: #fff !important;
}

.cart_sidebar .anil-cart-qty-button {
    color: var(--anil-cart-navy-dark);
    cursor: pointer;
    font-size: 16px;
}

.cart_sidebar .anil-cart-qty-button:first-child { border-left: 1px solid #e5eaf2 !important; }
.cart_sidebar .anil-cart-qty-button:last-child { border-right: 1px solid #e5eaf2 !important; }

.cart_sidebar .elementor-menu-cart__subtotal,
.cart_sidebar .mini_cart_bottom {
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 10px 13px 6px !important;
    border-top: 1px solid var(--anil-cart-line) !important;
    background: #fff !important;
    box-shadow: 0 -6px 20px rgba(17, 39, 70, .07);
}

.cart_sidebar .elementor-menu-cart__subtotal {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--anil-cart-text);
}

.cart_sidebar .elementor-menu-cart__subtotal strong {
    font-size: 10.5px;
    font-weight: 600;
}

.cart_sidebar .elementor-menu-cart__subtotal strong::after {
    content: ' (قابل پرداخت)';
    color: var(--anil-cart-muted);
    font-size: 8px;
    font-weight: 400;
}

.cart_sidebar .elementor-menu-cart__subtotal .woocommerce-Price-amount {
    color: var(--anil-cart-navy-dark);
    font-size: 15px !important;
    font-weight: 900 !important;
}

.cart_sidebar .elementor-menu-cart__footer-buttons {
    flex: 0 0 auto;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
    margin: 0 !important;
    padding: 5px 13px calc(12px + env(safe-area-inset-bottom)) !important;
    background: #fff !important;
}

.cart_sidebar .elementor-menu-cart__footer-buttons .elementor-button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 8px 13px !important;
    border-radius: 10px !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    text-decoration: none !important;
}

.cart_sidebar .elementor-button--checkout {
    order: 1;
    border: 1px solid var(--anil-cart-orange) !important;
    color: #fff !important;
    background: linear-gradient(135deg, #ff961f, #ff7e17) !important;
    box-shadow: 0 6px 15px rgba(255, 126, 23, .2);
}

.cart_sidebar .elementor-button--checkout .elementor-button-text { font-size: 0; }
.cart_sidebar .elementor-button--checkout .elementor-button-text::after { content: 'ادامه فرایند خرید'; font-size: 11.5px; }

.cart_sidebar .elementor-button--view-cart {
    order: 2;
    border: 1px solid var(--anil-cart-navy) !important;
    color: var(--anil-cart-navy) !important;
    background: #fff !important;
}

.cart_sidebar .woocommerce-mini-cart__empty-message {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 !important;
    padding: 35px 20px !important;
    color: var(--anil-cart-muted);
    text-align: center;
    font-size: 12px;
}

.cart_sidebar .woocommerce-mini-cart__empty-message svg {
    width: 65px;
    height: 65px;
    color: #a8b5c8;
}

@media (max-width: 480px) {
    .cart_sidebar.togglesidebar { width: 100vw !important; }
    .cart_sidebar .cart_sidebar_head { min-height: 61px; padding: 9px 10px; }
    .cart_sidebar .cart_sidebar_head strong { font-size: 15px; }
    .cart_sidebar .cart_sidebar_close { width: 38px; height: 38px; }
    .cart_sidebar .elementor-menu-cart__products,
    .cart_sidebar .woocommerce-mini-cart.cart_list { padding: 7px !important; }
    .cart_sidebar .elementor-menu-cart__product {
        grid-template-columns: 78px minmax(0, 1fr) 31px !important;
        gap: 7px 8px !important;
        padding: 8px !important;
    }
    .cart_sidebar .elementor-menu-cart__product-image { width: 78px !important; height: 78px !important; }
    .cart_sidebar .elementor-menu-cart__product-image img { max-width: 68px !important; max-height: 68px !important; }
    .cart_sidebar .elementor-menu-cart__product-name > a { font-size: 10.5px !important; }
    .cart_sidebar dl.variation dt,
    .cart_sidebar dl.variation dd { font-size: 7.5px !important; }
    .cart_sidebar .elementor-menu-cart__product-price .woocommerce-Price-amount { font-size: 10.5px !important; }
    .cart_sidebar .elementor-menu-cart__subtotal,
    .cart_sidebar .elementor-menu-cart__footer-buttons { padding-inline: 10px !important; }
}

@media (max-width: 360px) {
    .cart_sidebar .elementor-menu-cart__product {
        grid-template-columns: 70px minmax(0, 1fr) 29px !important;
    }
    .cart_sidebar .elementor-menu-cart__product-image { width: 70px !important; height: 70px !important; }
    .cart_sidebar .elementor-menu-cart__product-image img { max-width: 61px !important; max-height: 61px !important; }
    .cart_sidebar dl.variation dt,
    .cart_sidebar dl.variation dd { padding-inline: 4px !important; }
}
