/* ============================================================
   cart-page.css - صفحه سبد خرید مدرن
   ============================================================ */

/* ============================================================
   هدر صفحه
   ============================================================ */

.cart-page-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e8edf4;
}

.cart-page-title {
    font-size: 22px;
    font-weight: 800;
    color: #1a202c;
    margin: 0;
}

.cart-page-weight {
    font-size: 14px;
    color: #a0aec0;
    font-weight: 500;
}

/* ============================================================
   جدول سبد خرید
   ============================================================ */

.cart-table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid #e8edf4;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    margin-bottom: 16px;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
    font-family: OpenCartFarsi, Tahoma;
}

.cart-table thead {
    background: linear-gradient(135deg, #f8fafc, #f1f4f9);
}

.cart-table thead th {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #4a5568;
    text-align: center;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.cart-th-image { width: 80px; }
.cart-th-name { text-align: right !important; }
.cart-th-model { width: 100px; }
.cart-th-qty { width: 180px; }
.cart-th-price { width: 120px; }
.cart-th-total { width: 120px; }

/* ============================================================
   ردیف‌های جدول
   ============================================================ */

.cart-item-row {
    transition: all 0.3s ease;
}

.cart-item-row:hover {
    background: #f8fafc;
}

.cart-item-row td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid #edf2f7;
    text-align: center;
}

/* ============================================================
   تصویر محصول
   ============================================================ */

.cart-td-image {
    text-align: center !important;
}

.cart-item-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #edf2f7;
    transition: all 0.3s ease;
}

.cart-item-img:hover {
    border-color: #667eea;
    transform: scale(1.04);
}

/* ============================================================
   نام محصول
   ============================================================ */

.cart-td-name {
    text-align: right !important;
}

.cart-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cart-item-name:hover {
    color: #667eea;
}

.cart-item-option {
    font-size: 12px;
    color: #a0aec0;
}

.cart-item-reward {
    font-size: 12px;
    color: #48bb78;
}

/* ============================================================
   مدل
   ============================================================ */

.cart-td-model {
    font-size: 13px;
    color: #4a5568;
}

/* ============================================================
   تعداد
   ============================================================ */

.cart-td-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cart-qty-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.cart-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #f8fafc;
    border: none;
    color: #4a5568;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cart-qty-btn:hover {
    background: #667eea;
    color: #ffffff;
}

.cart-qty-btn:active {
    transform: scale(0.95);
}

.cart-qty-input {
    width: 40px;
    height: 30px;
    border: none;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
    background: transparent;
    outline: none;
    padding: 0 4px;
    transition: all 0.3s ease;
}

.cart-qty-input:focus {
    background: #f7fafc;
}

/* ============================================================
   دکمه حذف
   ============================================================ */

.cart-item-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    color: #a0aec0;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    border-radius: 8px;
}

.cart-item-remove-btn:hover {
    color: #e53e3e;
    background: #fff5f5;
    transform: scale(1.1);
}

/* ============================================================
   تغییرات زنده (Live Changes)
   ============================================================ */

/* ===== تغییر تعداد ===== */
.quantity-input.has-change {
    background: #fef3c7 !important;
    border: 2px solid #f59e0b !important;
    border-radius: 6px !important;
    transition: all 0.3s ease;
}

/* ===== ردیف علامت‌گذاری شده برای حذف ===== */
.cart-item-row.marked-for-remove {
    background: #fef2f2 !important;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.cart-item-row.marked-for-remove .cart-item-name {
    text-decoration: line-through;
    color: #a0aec0;
}

.cart-item-row.marked-for-remove .cart-item-img {
    opacity: 0.5;
    border-color: #fca5a5;
}

/* ===== دکمه حذف فعال (قرمز) ===== */
.cart-item-remove-btn.active-remove {
    color: #e53e3e !important;
    background: #fee2e2 !important;
    transform: scale(1.15);
}

.cart-item-remove-btn.active-remove .fa {
    color: #e53e3e !important;
}

/* ============================================================
   قیمت و مجموع
   ============================================================ */

.cart-td-price {
    font-weight: 600;
    font-size: 14px;
    color: #4a5568;
}

.cart-td-total {
    font-weight: 700;
    font-size: 15px;
    color: #2d3748;
}

/* ============================================================
   دکمه بروزرسانی
   ============================================================ */

.cart-update-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.cart-update-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #edf2f7;
    color: #4a5568;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cart-update-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
    transform: translateY(-2px);
}

/* ===== دکمه بروزرسانی با تغییرات ===== */
.cart-update-btn.has-changes {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4) !important;
    animation: pulse-update 1.5s ease infinite;
}

@keyframes pulse-update {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.cart-update-btn.has-changes:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

/* ============================================================
   ماژول‌های اضافی
   ============================================================ */

.cart-modules-wrapper {
    margin: 20px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e8edf4;
}

.cart-modules-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 8px 0;
}

.cart-modules-desc {
    font-size: 14px;
    color: #718096;
    margin: 0 0 16px 0;
}

/* ============================================================
   جمع کل
   ============================================================ */

.cart-totals-wrapper {
    display: flex;
    justify-content: flex-end;
    margin: 20px 0 30px;
}

.cart-totals-box {
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid #e8edf4;
    padding: 20px 28px;
    min-width: 260px;
}

.cart-totals-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-totals-table tr {
    border-bottom: 1px solid #edf2f7;
}

.cart-totals-table tr:last-child {
    border-bottom: none;
}

.cart-totals-table td {
    padding: 8px 0;
    font-size: 14px;
    color: #4a5568;
}

.cart-totals-label {
    text-align: right;
    font-weight: 600;
}

.cart-totals-value {
    text-align: left;
    font-weight: 700;
    color: #2d3748;
}

.cart-totals-table tr:last-child td {
    font-size: 16px;
    padding-top: 10px;
    border-top: 2px solid #e2e8f0;
}

.cart-totals-table tr:last-child .cart-totals-value {
    color: #667eea;
}

/* ============================================================
   دکمه‌های پایین
   ============================================================ */

.cart-actions-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.cart-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #edf2f7;
    color: #4a5568;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.cart-btn-secondary:hover {
    background: #e2e8f0;
    color: #2d3748;
    transform: translateY(-2px);
    text-decoration: none;
}

.cart-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.35);
}

.cart-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.45);
    color: #ffffff;
    text-decoration: none;
}

/* ============================================================
   ریسپانسیو - تبلت
   ============================================================ */

@media (max-width: 768px) {
    .cart-page-header {
        padding: 12px 16px;
        border-radius: 10px;
        flex-wrap: wrap;
    }

    .cart-page-title {
        font-size: 18px;
    }

    .cart-table thead th {
        padding: 10px 12px;
        font-size: 12px;
    }

    .cart-item-row td {
        padding: 12px;
    }

    .cart-item-img {
        width: 48px;
        height: 48px;
    }

    .cart-td-model {
        display: none;
    }

    .cart-th-model {
        display: none;
    }

    .cart-td-qty {
        flex-wrap: wrap;
        gap: 4px;
    }

    .cart-qty-btn {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }

    .cart-qty-input {
        width: 32px;
        height: 26px;
        font-size: 12px;
    }

    .cart-totals-wrapper {
        justify-content: center;
    }

    .cart-totals-box {
        min-width: 200px;
        width: 100%;
        padding: 16px 20px;
    }

    .cart-actions-bottom {
        flex-direction: column;
        gap: 12px;
    }

    .cart-btn-secondary,
    .cart-btn-primary {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   ریسپانسیو - موبایل
   ============================================================ */

@media (max-width: 480px) {
    .cart-page-header {
        padding: 10px 12px;
        border-radius: 8px;
    }

    .cart-page-title {
        font-size: 16px;
    }

    .cart-page-weight {
        font-size: 12px;
    }

    .cart-table-wrapper {
        border-radius: 10px;
    }

    .cart-table thead th {
        padding: 8px 8px;
        font-size: 10px;
    }

    .cart-item-row td {
        padding: 8px;
    }

    .cart-item-img {
        width: 40px;
        height: 40px;
        border-radius: 8px;
    }

    .cart-item-name {
        font-size: 13px;
    }

    .cart-td-price {
        font-size: 12px;
    }

    .cart-td-total {
        font-size: 13px;
    }

    .cart-qty-btn {
        width: 22px;
        height: 22px;
        font-size: 9px;
    }

    .cart-qty-input {
        width: 28px;
        height: 22px;
        font-size: 11px;
    }

    .cart-item-remove-btn {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }

    .cart-totals-box {
        padding: 12px 16px;
        border-radius: 10px;
    }

    .cart-totals-table td {
        font-size: 13px;
        padding: 6px 0;
    }

    .cart-totals-table tr:last-child td {
        font-size: 14px;
    }

    .cart-update-btn {
        padding: 8px 16px;
        font-size: 12px;
    }

    .cart-update-btn.has-changes {
        font-size: 12px;
        padding: 8px 16px;
    }

    .cart-modules-wrapper {
        padding: 14px;
        border-radius: 10px;
    }

    .cart-modules-title {
        font-size: 16px;
    }

    .cart-btn-secondary,
    .cart-btn-primary {
        padding: 10px 16px;
        font-size: 13px;
        border-radius: 10px;
    }

    .quantity-input.has-change {
        background: #fef3c7 !important;
        border: 2px solid #f59e0b !important;
    }

    .cart-item-row.marked-for-remove {
        background: #fef2f2 !important;
        opacity: 0.6;
    }
}