/* ==========================================================================
   اصلاح ساختار چیدمان و تراز سبد خرید - CitraBiotech
   ========================================================================== */

:root {
    --primary-color: #043e59;
    --primary-hover: #032b3f;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background-color: #f1f5f9;
}

.cart-container {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    width: 100%;
}

/* ساختار گرید وقتی سبد خرید پر است */
.cart-layout {
    display: grid;
    grid-template-columns: 2.3fr 1fr;
    gap: 30px;
    align-items: start;
    width: 100%;
}

/* کارت اصلی سبد خرید */
.cart-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
}

.cart-title {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-top: 0;
    margin-bottom: 25px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 15px;
}

.cart-title i {
    color: var(--primary-color);
}

/* استایل لیست آیتم‌ها */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cart-item {
    display: grid;
    grid-template-columns: 90px 2.5fr 1.2fr 1.5fr;
    gap: 20px;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--bg-light);
}

.cart-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* تصویر محصول */
.cart-item-img img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* اطلاعات محصول */
.product-title-link a {
    text-decoration: none;
    color: var(--text-dark);
    font-size: 1.05rem;
    font-weight: 700;
    transition: color 0.2s;
}

.product-title-link a:hover {
    color: var(--primary-color);
}

.cart-item-variant {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(4, 62, 89, 0.06);
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
}

.cart-item-variant-none {
    display: inline-block;
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-top: 8px;
}

/* کنترلر شیک تعداد (کاملا هماهنگ با صفحه محصول) */
.quantity-selector {
    display: flex;
    align-items: center;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
    height: 38px;
    width: 110px;
    direction: ltr;
}

.qty-btn {
    background: none;
    border: none;
    width: 35px;
    height: 100%;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.qty-btn:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

.cart-qty-input {
    width: 40px;
    height: 100%;
    text-align: center;
    border: none;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
    outline: none;
    background: transparent;
    -moz-appearance: textfield;
}

.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* بخش قیمت و دکمه حذف */
.cart-item-price-section {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
}

.price-wrapper {
    text-align: left;
}

.price-amount {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-dark);
}

.price-currency {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 2px;
}

/* دکمه حذف زباله */
.delete-cart-item {
    background: rgba(231, 76, 60, 0.08);
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.delete-cart-item:hover {
    background: #e74c3c;
    color: #ffffff;
}

/* فاکتور نهایی (سمت چپ) */
.summary-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 30px;
}

.summary-title {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-dark);
    font-weight: 800;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.summary-value {
    color: var(--text-dark);
    font-weight: 700;
}

.summary-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 15px 0;
}

.summary-row.total {
    color: var(--text-dark);
    margin-bottom: 25px;
}

.summary-row.total span:first-child {
    font-weight: bold;
}

.total-price-amount {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-color);
}

.total-price-currency {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* دکمه تسویه حساب */
.checkout-btn {
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(4, 62, 89, 0.15);
    transition: all 0.3s ease;
}

.checkout-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(4, 62, 89, 0.25);
}

/* حالت خالی بودن سبد */
.empty-cart-view {
    text-align: center;
    padding: 50px 0;
}

.empty-icon {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 20px;
    display: block;
}

.empty-text {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.return-store-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 10px 30px;
    border-radius: 8px;
    font-weight: 700;
    transition: all 0.2s;
}

.return-store-btn:hover {
    background-color: var(--primary-hover);
}

/* واکنش‌گرایی برای موبایل */
@media (max-width: 992px) {
    .cart-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .cart-item {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
        padding: 25px 0;
    }

    .cart-item-img img {
        margin: 0 auto;
    }

    .quantity-selector {
        margin: 0 auto;
    }

    .cart-item-price-section {
        justify-content: center;
    }
}

.cart-item-qty-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-family: 'Vazirmatn', sans-serif;
}

.qty-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.qty-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
}

.qty-unit {
    font-size: 0.8rem;
    color: var(--text-muted);
}
