/* ============================================================
   Hover Sabad (Basket) — Shortcode: [hoversabad]
   ============================================================ */

/* --- Trigger icon --- */
.hoversabad-wrapper {
    position: relative;
    display: inline-block;
    direction: rtl !important;
    font-family: 'Estedad-Regular', 'Vazir', 'Shabnam', sans-serif !important;
}
.hoversabad-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: background-color 0.2s;
    
}
.hoversabad-trigger:hover {
    background-color: rgba(207, 46, 46, 0.05);
}
.hoversabad-trigger svg {
    color: #191919;
    width: 22px;
    height: 22px;
    transition: color 0.2s;
}
.hoversabad-trigger:hover svg {
    color: #cf2e2e !important;
}

/* ============================================================
   No-Hover Sabad (Mobile Click-Toggle) — Shortcode: [nohoversabad]
   Mobile-optimized compact styling. Dropdown opens ONLY on
   .nohoversabad-wrapper.dropdown-open — NO hover display rules.
   ============================================================ */

/* --- Wrapper --- */
.nohoversabad-wrapper {
    position: relative;
    display: inline-block;
    direction: rtl !important;
    font-family: 'Estedad-Regular', 'Vazir', 'Shabnam', sans-serif !important;
}

/* --- Trigger icon --- */
.nohoversabad-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: background-color 0.2s;
}
.nohoversabad-trigger:hover {
    background-color: rgba(207, 46, 46, 0.05);
}
.nohoversabad-trigger svg {
    color: #191919;
    width: 22px;
    height: 22px;
    transition: color 0.2s;
}
.nohoversabad-trigger:hover svg {
    color: #cf2e2e !important;
}
.nohoversabad-trigger .cart-number {
    position: absolute;
    top: -2px;
    left: -5px;
    right: auto !important;
    background: #cf2e2e !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: bold !important;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-sizing: border-box;
    border: 2px solid #ffffff;
    z-index: 999;
}

/* --- Dropdown container — viewport-fixed positioning --- */
.nohoversabad-dropdown {
    display: none;
    position: fixed !important;
    z-index: 999999 !important;
    background: #ffffff !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12) !important;
    border-radius: 12px !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    direction: rtl !important;
    font-family: 'Estedad-Regular', 'Vazir', 'Shabnam', sans-serif !important;
}
/* ONLY .dropdown-open — NO hover triggers */
.nohoversabad-wrapper.dropdown-open .nohoversabad-dropdown {
    display: block !important;
    animation: animation_menu 300ms ease forwards;
}

/* --- Scrollbar fix --- */
.nohoversabad-dropdown ul.cart_list {
    margin-left: -16px !important;
    padding-left: 16px !important;
}

/* --- Mobile-Compact Sizes for inner elements --- */

/* Header title */
.nohoversabad-dropdown h3.theme-title {
    font-size: 14px !important;
}

/* Product image */
.nohoversabad-dropdown .woocommerce-mini-cart-item .thumbnail {
    width: 65px !important;
    height: 65px !important;
    border-radius: 8px !important;
}

/* Product name */
.nohoversabad-dropdown .product-name {
    font-size: 12.5px !important;
    line-height: 1.3 !important;
}

/* Unit price */
.nohoversabad-dropdown .price {
    font-size: 12px !important;
}

/* Subtotal price */
.nohoversabad-dropdown .subtotal {
    font-size: 13px !important;
}

/* Quantity controls — compact */
.nohoversabad-dropdown .number-button {
    height: 32px !important;
    width: 90px !important;
    border-radius: 6px !important;
}
.nohoversabad-dropdown .number-button input.qty {
    font-size: 12px !important;
    width: 28px !important;
}
.nohoversabad-dropdown .number-button input[type="button"] {
    width: 26px !important;
    font-size: 14px !important;
}

/* Footer buttons — compact */
.nohoversabad-dropdown .dropdown-footer a.button.view-cart,
.nohoversabad-dropdown .dropdown-footer a.button.checkout-button {
    padding: 10px 8px !important;
    font-size: 13px !important;
    border-radius: 25px !important;
}
.hoversabad-trigger .cart-number {
    position: absolute;
    top: -2px;
    left: -5px;
    right: auto !important;
    background: #cf2e2e !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: bold !important;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-sizing: border-box;
    border: 2px solid #ffffff;
    z-index: 999;
}

/* --- Dropdown (Double Targeted) --- */
.hoversabad-dropdown,
.cart-dropdown-form.dropdown-container.woocommerce {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    width: 420px !important;
    max-width: calc(100vw - 24px) !important;
    background: #ffffff !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08) !important;
    border-radius: 12px !important;
    padding: 24px !important;
    z-index: 99999;
    box-sizing: border-box !important;
    direction: rtl !important;
    transform-origin: top left;
    font-family: 'Estedad-Regular', 'Vazir', 'Shabnam', sans-serif !important;
}
.hoversabad-wrapper.dropdown-open .hoversabad-dropdown,
.hoversabad-wrapper:hover .hoversabad-dropdown,
.shopping-cart-wrapper:hover .cart-dropdown-form.dropdown-container.woocommerce {
    display: block !important;
    animation: animation_menu 300ms ease forwards;
}
@keyframes animation_menu {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* --- Title --- */
.hoversabad-dropdown h3.theme-title,
.nohoversabad-dropdown h3.theme-title,
.cart-dropdown-form.dropdown-container.woocommerce h3.theme-title {
    font-size: 15px !important;
    font-weight: bold !important;
    color: #191919 !important;
    margin: 0 0 20px 0 !important;
    text-align: right !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}
.hoversabad-dropdown h3.theme-title span,
.nohoversabad-dropdown h3.theme-title span,
.cart-dropdown-form.dropdown-container.woocommerce h3.theme-title span {
    background: #cf2e2e !important;
    color: #ffffff !important;
    font-size: 12px !important;
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    text-align: center !important;
    box-sizing: border-box !important;
    transform: translateY(-0.5px) !important;
}

/* --- Cart list --- */
.hoversabad-dropdown ul.cart_list,
.cart-dropdown-form.dropdown-container.woocommerce ul.cart_list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: 340px !important; /* Restored for Desktop */
    overflow-y: auto !important;
}
.nohoversabad-dropdown ul.cart_list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: 190px !important; /* Mobile ONLY - fits exactly 2 items */
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
.hoversabad-dropdown ul.cart_list::-webkit-scrollbar,
.nohoversabad-dropdown ul.cart_list::-webkit-scrollbar,
.cart-dropdown-form.dropdown-container.woocommerce ul.cart_list::-webkit-scrollbar { width: 4px; }
.hoversabad-dropdown ul.cart_list::-webkit-scrollbar-thumb,
.nohoversabad-dropdown ul.cart_list::-webkit-scrollbar-thumb,
.cart-dropdown-form.dropdown-container.woocommerce ul.cart_list::-webkit-scrollbar-thumb { background: #e5e5e5; border-radius: 4px; }

/* --- Each product row — STRETCH so image fills full height --- */
.hoversabad-dropdown .woocommerce-mini-cart-item,
.nohoversabad-dropdown .woocommerce-mini-cart-item,
.cart-dropdown-form.dropdown-container.woocommerce .woocommerce-mini-cart-item {
    display: flex !important;
    flex-direction: row !important;
    gap: 15px !important;
    padding: 0 0 16px 0 !important;
    margin: 0 0 16px 0 !important;
    border-bottom: 1px solid #f2f2f2 !important;
    position: relative !important;
    align-items: stretch !important;
    border-width: 0 0 1px 0 !important;
    border-style: solid !important;
    border-color: #f2f2f2 !important;
    width: 100% !important;
    background: transparent !important;
}
.hoversabad-dropdown .woocommerce-mini-cart-item:last-child,
.nohoversabad-dropdown .woocommerce-mini-cart-item:last-child,
.cart-dropdown-form.dropdown-container.woocommerce .woocommerce-mini-cart-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* --- Product image — SQUARE, auto-height, always matches row height --- */
.hoversabad-dropdown .woocommerce-mini-cart-item .thumbnail,
.nohoversabad-dropdown .woocommerce-mini-cart-item .thumbnail,
.cart-dropdown-form.dropdown-container.woocommerce .woocommerce-mini-cart-item .thumbnail {
    flex-shrink: 0 !important;
    width: 90px !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    display: flex !important;
    margin: 0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    align-self: stretch !important;
}
.hoversabad-dropdown .woocommerce-mini-cart-item .thumbnail img,
.nohoversabad-dropdown .woocommerce-mini-cart-item .thumbnail img,
.cart-dropdown-form.dropdown-container.woocommerce .woocommerce-mini-cart-item .thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 10px !important;
    display: block !important;
}

/* --- Cart item grid --- */
.hoversabad-dropdown .cart-item-wrapper,
.nohoversabad-dropdown .cart-item-wrapper,
.cart-dropdown-form.dropdown-container.woocommerce .cart-item-wrapper {
    flex-grow: 1 !important;
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas:
        "title remove"
        "price empty"
        "qty subtotal" !important;
    align-items: center !important;
    align-self: center !important;
    column-gap: 15px !important;
    row-gap: 8px !important;
    text-align: right !important;
    width: auto !important;
    padding: 0 !important;
}

/* --- Product name --- */
.hoversabad-dropdown .product-name,
.nohoversabad-dropdown .product-name,
.cart-dropdown-form.dropdown-container.woocommerce .product-name {
    grid-area: title !important;
    margin: 0 !important;
    font-size: 13.5px !important;
    font-weight: bold !important;
    line-height: 1.5 !important;
    justify-self: start !important;
}
.hoversabad-dropdown .product-name a,
.nohoversabad-dropdown .product-name a,
.cart-dropdown-form.dropdown-container.woocommerce .product-name a {
    color: #191919 !important;
    text-decoration: none !important;
}

/* --- Unit price --- */
.hoversabad-dropdown .price,
.nohoversabad-dropdown .price,
.cart-dropdown-form.dropdown-container.woocommerce .price {
    grid-area: price !important;
    font-size: 13px !important;
    color: #777777 !important;
    margin: 0 !important;
    justify-self: start !important;
}

/* --- Quantity controls --- */
.hoversabad-dropdown .quantity,
.nohoversabad-dropdown .quantity,
.cart-dropdown-form.dropdown-container.woocommerce .quantity {
    grid-area: qty !important;
    justify-self: start !important;
}
.hoversabad-dropdown .number-button,
.nohoversabad-dropdown .number-button,
.cart-dropdown-form.dropdown-container.woocommerce .number-button {
    display: flex !important;
    align-items: center !important;
    border: 1px solid #e2e2e2 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    height: 40px !important;
    background: #ffffff !important;
    width: fit-content !important;
    direction: ltr !important;
}
.hoversabad-dropdown .number-button input[type="button"],
.nohoversabad-dropdown .number-button input[type="button"],
.cart-dropdown-form.dropdown-container.woocommerce .number-button input[type="button"] {
    background: none !important;
    border: none !important;
    width: 34px !important;
    height: 100% !important;
    font-size: 18px !important;
    cursor: pointer !important;
    color: #555555 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    transition: background-color 0.15s, color 0.15s !important;
}
.hoversabad-dropdown .number-button input[type="button"]:hover,
.nohoversabad-dropdown .number-button input[type="button"]:hover,
.cart-dropdown-form.dropdown-container.woocommerce .number-button input[type="button"]:hover {
    background-color: #f5f5f5 !important;
    color: #cf2e2e !important;
}
.hoversabad-dropdown .number-button input.qty,
.nohoversabad-dropdown .number-button input.qty,
.cart-dropdown-form.dropdown-container.woocommerce .number-button input.qty {
    width: 36px !important;
    height: 100% !important;
    border: none !important;
    border-left: 1px solid #eeeeee !important;
    border-right: 1px solid #eeeeee !important;
    text-align: center !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    -moz-appearance: textfield !important;
    color: #191919 !important;
    line-height: 40px !important;
}
.hoversabad-dropdown .number-button input.qty::-webkit-outer-spin-button,
.hoversabad-dropdown .number-button input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* --- Subtotal --- */
.hoversabad-dropdown .subtotal,
.nohoversabad-dropdown .subtotal,
.cart-dropdown-form.dropdown-container.woocommerce .subtotal {
    grid-area: subtotal !important;
    justify-self: end !important;
    font-weight: bold !important;
    font-size: 14px !important;
    color: #191919 !important;
    margin-left: -5px !important;
}

/* --- Remove button --- */
.hoversabad-dropdown .remove,
.nohoversabad-dropdown .remove,
.cart-dropdown-form.dropdown-container.woocommerce .woocommerce-mini-cart-item .remove {
    grid-area: remove !important;
    position: static !important;
    justify-self: end !important;
    color: #aaaaaa !important;
    font-size: 20px !important;
    text-decoration: none !important;
    transition: color 0.2s, background-color 0.2s !important;
    line-height: 1 !important;
    margin: 0 !important;
    margin-left: -5px !important;
    cursor: pointer !important;
    background: none !important;
    border: none !important;
    padding: 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
}
.hoversabad-dropdown .remove:hover,
.nohoversabad-dropdown .remove:hover,
.cart-dropdown-form.dropdown-container.woocommerce .woocommerce-mini-cart-item .remove:hover {
    color: #ff3344 !important;
    background-color: rgba(255, 51, 68, 0.06) !important;
}

/* --- Footer --- */
.hoversabad-dropdown .dropdown-footer,
.nohoversabad-dropdown .dropdown-footer,
.cart-dropdown-form.dropdown-container.woocommerce .dropdown-footer {
    border-top: 1px solid #eeeeee !important;
    padding-top: 15px !important;
    margin-top: 15px !important;
}
.hoversabad-dropdown .dropdown-footer .total,
.nohoversabad-dropdown .dropdown-footer .total,
.cart-dropdown-form.dropdown-container.woocommerce .dropdown-footer .total {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 15px !important;
    font-weight: bold !important;
    margin-bottom: 20px !important;
    color: #191919 !important;
}
.hoversabad-dropdown .dropdown-footer .button,
.nohoversabad-dropdown .dropdown-footer .button,
.cart-dropdown-form.dropdown-container.woocommerce .dropdown-footer .button {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 13px 10px !important;
    border-radius: 30px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    margin-bottom: 12px !important;
    border: none !important;
    cursor: pointer !important;
    transition: opacity 0.2s ease, transform 0.1s ease !important;
}
.hoversabad-dropdown .dropdown-footer .button:active,
.nohoversabad-dropdown .dropdown-footer .button:active,
.cart-dropdown-form.dropdown-container.woocommerce .dropdown-footer .button:active {
    transform: scale(0.98) !important;
}
.hoversabad-dropdown .dropdown-footer .view-cart,
.nohoversabad-dropdown .dropdown-footer .view-cart,
.cart-dropdown-form.dropdown-container.woocommerce .dropdown-footer .view-cart {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
}
.hoversabad-dropdown .dropdown-footer .checkout-button,
.nohoversabad-dropdown .dropdown-footer .checkout-button,
.cart-dropdown-form.dropdown-container.woocommerce .dropdown-footer .checkout-button {
    background-color: #fd2a80 !important;
    color: #ffffff !important;
    margin-bottom: 0 !important;
}
.hoversabad-dropdown .dropdown-footer .view-cart:hover,
.nohoversabad-dropdown .dropdown-footer .view-cart:hover,
.cart-dropdown-form.dropdown-container.woocommerce .dropdown-footer .view-cart:hover,
.hoversabad-dropdown .dropdown-footer .checkout-button:hover,
.nohoversabad-dropdown .dropdown-footer .checkout-button:hover,
.cart-dropdown-form.dropdown-container.woocommerce .dropdown-footer .checkout-button:hover {
    background: rgba(25, 25, 25, 1) !important;
    border-color: rgba(25, 25, 25, 1) !important;
    color: rgba(255, 255, 255, 1) !important;
    opacity: 1 !important;
}

/* --- Empty state --- */
.hoversabad-empty {
    text-align: center;
    padding: 20px 0;
    color: #888888;
}
.hoversabad-empty svg {
    margin-bottom: 12px;
    color: #cccccc;
}
.hoversabad-empty-text {
    display: block;
    font-size: 14px;
}



/* --- اسکرول‌بار چسبیده به دیواره سمت چپ --- */
.hoversabad-dropdown ul.cart_list,
.nohoversabad-dropdown ul.cart_list,
.cart-dropdown-form.dropdown-container.woocommerce ul.cart_list {
    margin-left: -24px !important;
    padding-left: 24px !important;
}