/**
 * سبد خرید جذاب - استایل‌های کامل با انیمیشن‌های روان
 */


/* ========================
   پایه و ریست
======================== */

.jazeb-cart-widget {
    position: relative;
    display: inline-block;
    direction: rtl;
}

.jazeb-cart-widget * {
    box-sizing: border-box;
}


/* ========================
   دکمه سبد خرید
======================== */

.jazeb-cart-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: none;
    background: transparent;
    padding: 0;
}

.jazeb-cart-button:hover {
    transform: translateY(-2px);
}

.jazeb-cart-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.jazeb-cart-icon i,
.jazeb-cart-icon svg {
    transition: all 0.3s ease;
}

.jazeb-cart-button:hover .jazeb-cart-icon {
    transform: scale(1.1);
}


/* ========================
   شمارنده محصولات
======================== */

.jazeb-cart-count {
    position: absolute;
    top: -8px;
    left: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    transition: all 0.3s ease;
    z-index: 2;
}


/* انیمیشن تغییر تعداد */

.jazeb-cart-count.updated {
    animation: jazeb-bounce 0.6s ease;
}

@keyframes jazeb-bounce {
    0%,
    100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.4);
    }
    50% {
        transform: scale(0.9);
    }
    75% {
        transform: scale(1.2);
    }
}


/* ========================
   قیمت کل سبد
======================== */

.jazeb-cart-price {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s ease;
}


/* استایل پایه برای متن سبد خالی */

.jazeb-cart-total.empty {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
}

.jazeb-cart-total-value.jazeb-cart-total.empty {
    display: block;
}


/* ========================
   نمایش شناور
======================== */

.jazeb-cart-button.floating {
    position: fixed;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jazeb-cart-button.floating.position-top-left {
    top: 20px;
    left: 20px;
}

.jazeb-cart-button.floating.position-top-right {
    top: 20px;
    right: 20px;
}

.jazeb-cart-button.floating.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.jazeb-cart-button.floating.position-bottom-right {
    bottom: 20px;
    right: 20px;
}


/* موقعیت dropdown برای دکمه شناور - فقط برای حالت dropdown عادی */

.jazeb-cart-widget.floating-mode .jazeb-cart-dropdown:not(.cart-style-popup):not(.cart-style-slide-right):not(.cart-style-slide-left) {
    position: fixed;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 9998;
    max-height: 80vh;
    height: auto;
}


/* موقعیت dropdown بر اساس موقعیت دکمه - فقط برای حالت dropdown عادی */

.jazeb-cart-widget.floating-mode .jazeb-cart-button.position-top-left~.jazeb-cart-dropdown:not(.cart-style-popup):not(.cart-style-slide-right):not(.cart-style-slide-left) {
    top: 90px;
    left: 20px;
    max-height: calc(100vh - 110px);
}

.jazeb-cart-widget.floating-mode .jazeb-cart-button.position-top-right~.jazeb-cart-dropdown:not(.cart-style-popup):not(.cart-style-slide-right):not(.cart-style-slide-left) {
    top: 90px;
    right: 20px;
    max-height: calc(100vh - 110px);
}

.jazeb-cart-widget.floating-mode .jazeb-cart-button.position-bottom-left~.jazeb-cart-dropdown:not(.cart-style-popup):not(.cart-style-slide-right):not(.cart-style-slide-left) {
    bottom: 90px;
    left: 20px;
    max-height: calc(100vh - 110px);
}

.jazeb-cart-widget.floating-mode .jazeb-cart-button.position-bottom-right~.jazeb-cart-dropdown:not(.cart-style-popup):not(.cart-style-slide-right):not(.cart-style-slide-left) {
    bottom: 90px;
    right: 20px;
    max-height: calc(100vh - 110px);
}


/* مخفی کردن متن در حالت شناور و نمایش قیمت زیر آیکون */

.jazeb-cart-button.floating .jazeb-cart-text {
    display: none;
}

.jazeb-cart-button.floating .jazeb-cart-price {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
}


/* تنظیم لایه‌بندی عمودی برای آیکون و قیمت */

.jazeb-cart-button.floating {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 50px;
    min-height: 50px;
}


/* مجموع مبلغ زیر دکمه */

.jazeb-cart-total-below {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 5px;
    font-size: 14px;
    font-weight: 700;
}

.jazeb-cart-total-below .jazeb-cart-total-value {
    color: #333;
    font-weight: 700;
}


/* تنظیم شمارنده در حالت شناور */

.jazeb-cart-button.floating .jazeb-cart-count {
    top: -5px;
    left: -5px;
}


/* ========================
   محتوای سبد خرید
======================== */

.jazeb-cart-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    left: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.jazeb-cart-dropdown.active {
    visibility: visible;
}

.jazeb-cart-dropdown.show {
    opacity: 1;
    transform: translateY(0);
}


/* حالت Popup */

.jazeb-cart-dropdown.cart-style-popup {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.9);
    max-height: 90vh;
    height: auto;
}

.jazeb-cart-dropdown.cart-style-popup.show {
    transform: translate(-50%, -50%) scale(1);
}


/* حالت Popup در حالت شناور - اولویت بالاتر برای تنظیم ارتفاع */

.jazeb-cart-widget.floating-mode .jazeb-cart-dropdown.cart-style-popup {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    bottom: auto !important;
    max-height: 90vh;
    height: auto;
}


/* حالت Slide از راست */

.jazeb-cart-dropdown.cart-style-slide-right {
    position: fixed;
    top: 0 !important;
    left: auto !important;
    right: 0;
    bottom: 0;
    border-radius: 0;
    transform: translateX(100%);
    max-height: 100vh;
    height: 100vh;
}

.jazeb-cart-dropdown.cart-style-slide-right.show {
    transform: translateX(0);
}


/* حالت Slide از راست در حالت شناور - اولویت بالاتر */

.jazeb-cart-widget.floating-mode .jazeb-cart-dropdown.cart-style-slide-right {
    position: fixed;
    top: 0 !important;
    left: auto !important;
    right: 0;
    bottom: 0;
    max-height: 100vh;
    height: 100vh;
}


/* حالت Slide از چپ */

.jazeb-cart-dropdown.cart-style-slide-left {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: auto;
    bottom: 0;
    border-radius: 0;
    transform: translateX(-100%);
    max-height: 100vh;
    height: 100vh;
}

.jazeb-cart-dropdown.cart-style-slide-left.show {
    transform: translateX(0);
}


/* حالت Slide از چپ در حالت شناور - اولویت بالاتر */

.jazeb-cart-widget.floating-mode .jazeb-cart-dropdown.cart-style-slide-left {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: auto;
    bottom: 0;
    max-height: 100vh;
    height: 100vh;
}


/* ========================
   اورلی
======================== */

.jazeb-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9997;
}

.jazeb-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}


/* ========================
   هدر سبد
======================== */

.jazeb-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    background: #fff;
    position: relative;
    z-index: 2;
    gap: 15px;
}

.jazeb-cart-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ========================
   دکمه‌های هدر (بستن و بروزرسانی)
======================== */

.jazeb-cart-header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.jazeb-cart-close,
.jazeb-cart-refresh {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.jazeb-cart-close .button-text,
.jazeb-cart-refresh .button-text {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.jazeb-cart-close:hover {
    background: #f5f5f5;
    transform: rotate(90deg);
}

.jazeb-cart-refresh:hover {
    background: #f5f5f5;
    transform: rotate(180deg);
}

.jazeb-cart-refresh.refreshing {
    animation: jazeb-spin 1s linear infinite;
}


/* ========================
   آیتم‌های سبد
======================== */

.jazeb-cart-items {
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    flex: 1 1 auto;
    min-height: 150px;
}

.jazeb-cart-items::-webkit-scrollbar {
    width: 6px;
}

.jazeb-cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.jazeb-cart-items::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.jazeb-cart-items::-webkit-scrollbar-thumb:hover {
    background: #999;
}


/* سبد خالی */

.jazeb-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    flex: 1 1 auto;
    min-height: 200px;
    justify-content: center;
}

.jazeb-cart-empty i {
    font-size: 80px;
    color: #ddd;
    margin-bottom: 10px;
}

.jazeb-cart-empty-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.jazeb-cart-empty p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #666;
}


/* ========================
   آیتم محصول - ساختار 3 سطری
======================== */

.jazeb-cart-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

.jazeb-cart-item:last-child {
    border-bottom: none;
}

.jazeb-cart-item:hover {
    background: #fafafa;
}


/* انیمیشن حذف */

.jazeb-cart-item.removing {
    opacity: 0.5;
    transform: translateX(20px);
}


/* سطر اول: فقط عنوان محصول */

.cart-item-title-row {
    display: block;
    width: 100%;
}

.jazeb-cart-item-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
    margin: 0;
}

.jazeb-cart-item-title:hover {
    color: #0073aa;
}


/* سطر دوم: تصویر (راست) + متغیرها (وسط) + حذف (چپ) */

.cart-item-middle-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.jazeb-cart-item-image-wrapper {
    flex-shrink: 0;
}

.jazeb-cart-item-image {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
}

.jazeb-cart-item-variations-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.jazeb-cart-item-variations {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.jazeb-cart-item-variations .variation-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.jazeb-cart-item-variations dt {
    font-weight: 600;
    color: #666;
    margin: 0;
}

.jazeb-cart-item-variations dd {
    margin: 0;
    color: #333;
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
}

.jazeb-cart-item-remove-wrapper {
    flex-shrink: 0;
}

.jazeb-remove-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ff4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.jazeb-remove-item:hover {
    background: #cc0000;
    transform: scale(1.1);
}


/* سطر سوم: تعداد (راست) + قیمت (چپ) */

.cart-item-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}


/* ========================
   کنترل تعداد (+/-)
======================== */

.jazeb-cart-item-quantity {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border-radius: 6px;
    padding: 4px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    color: #333;
}

.quantity-btn:hover {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
    transform: scale(1.1);
}

.quantity-btn:active {
    transform: scale(0.95);
}

.quantity-input {
    width: 45px;
    height: 28px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.quantity-input::-webkit-inner-spin-button,
.quantity-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}


/* ========================
   قیمت محصول
======================== */

.jazeb-cart-item-price {
    font-size: 16px;
    font-weight: 700;
    color: #0073aa;
}


/* ========================
   فوتر سبد
======================== */

.jazeb-cart-footer {
    padding: 20px;
    border-top: 2px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.jazeb-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 16px;
}

.jazeb-cart-total-label {
    font-weight: 600;
}

.jazeb-cart-total-amount {
    font-size: 20px;
    font-weight: 700;
    color: #0073aa;
}

.jazeb-cart-buttons {
    display: flex;
    gap: 10px;
}

.jazeb-cart-button-view,
.jazeb-cart-button-checkout {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.jazeb-cart-button-view {
    background: #f5f5f5;
    color: #333;
}

.jazeb-cart-button-view:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.jazeb-cart-button-checkout {
    background: #0073aa;
    color: #fff;
}

.jazeb-cart-button-checkout:hover {
    background: #005177;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}


/* ========================
   لودینگ اورلی
======================== */

.jazeb-cart-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
    animation: jazeb-fadeIn 0.2s ease;
}

.jazeb-cart-loading {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: jazeb-spin 0.8s linear infinite;
}

@keyframes jazeb-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


/* ========================
   تولتیپ
======================== */

.jazeb-cart-tooltip {
    position: fixed;
    padding: 8px 12px;
    background: #333;
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99999;
    pointer-events: none;
}

.jazeb-cart-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.jazeb-cart-tooltip.jazeb-tooltip-success {
    background: #28a745;
}

.jazeb-cart-tooltip.jazeb-tooltip-error {
    background: #dc3545;
}

.jazeb-cart-tooltip.jazeb-tooltip-warning {
    background: #ffc107;
    color: #333;
}


/* ========================
   نوتیفیکیشن
======================== */

.jazeb-cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transform: translateX(50px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999;
    min-width: 250px;
    border-left: 4px solid #0073aa;
}

.jazeb-cart-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.jazeb-cart-notification.jazeb-notification-success {
    border-left-color: #28a745;
    color: #28a745;
}

.jazeb-cart-notification.jazeb-notification-error {
    border-left-color: #dc3545;
    color: #dc3545;
}

.jazeb-cart-notification.jazeb-notification-warning {
    border-left-color: #ffc107;
    color: #f57c00;
}


/* ========================
   ریسپانسیو
======================== */

@media (max-width: 768px) {
    .jazeb-cart-dropdown {
        min-width: 320px;
        max-width: calc(100vw - 40px);
    }
    .jazeb-cart-dropdown.cart-style-slide-right,
    .jazeb-cart-dropdown.cart-style-slide-left {
        min-width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
    }
    .jazeb-cart-dropdown.cart-style-popup {
        max-width: calc(100vw - 40px);
        max-height: 90vh;
        height: auto;
    }
    .jazeb-cart-button.floating {
        width: 50px;
        height: 50px;
    }
    /* تنظیم موقعیت dropdown در موبایل برای floating - فقط برای dropdown عادی */
    .jazeb-cart-widget.floating-mode .jazeb-cart-dropdown:not(.cart-style-popup):not(.cart-style-slide-right):not(.cart-style-slide-left) {
        left: 10px !important;
        right: 10px !important;
        top: auto !important;
        bottom: 80px !important;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 100px);
        min-width: auto;
        height: auto;
    }
    /* تنظیم popup در موبایل - حالت شناور */
    .jazeb-cart-widget.floating-mode .jazeb-cart-dropdown.cart-style-popup {
        max-width: calc(100vw - 20px);
        max-height: 90vh;
        height: auto;
    }
    .jazeb-cart-buttons {
        flex-direction: column;
    }
    /* تنظیم هدر سبد خرید در موبایل */
    .jazeb-cart-header {
        padding: 15px;
        gap: 10px;
    }
    .jazeb-cart-title {
        font-size: 16px;
    }
    .jazeb-cart-header-buttons {
        gap: 5px;
    }
    .jazeb-cart-close,
    .jazeb-cart-refresh {
        width: 32px;
        height: 32px;
    }
    .jazeb-cart-close .button-text,
    .jazeb-cart-refresh .button-text {
        display: none;
    }
}


/* ========================
   موبایل کوچک (زیر 480px)
======================== */

@media (max-width: 480px) {
    .jazeb-cart-header {
        padding: 12px;
        gap: 8px;
    }
    .jazeb-cart-title {
        font-size: 14px;
    }
    .jazeb-cart-header-buttons {
        gap: 5px;
    }
    .jazeb-cart-close,
    .jazeb-cart-refresh {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}


/* ========================
   انیمیشن‌های اضافی
======================== */

@keyframes jazeb-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jazeb-cart-item {
    animation: jazeb-fadeIn 0.3s ease;
}


/* پالس برای دکمه شناور */

@keyframes jazeb-pulse {
    0%,
    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
    }
}

.jazeb-cart-button.floating:hover {
    animation: jazeb-pulse 2s infinite;
}