:root {
    --primary-dark: #002223;   /* Deepest Teal (Backgrounds) */
    --secondary-dark: #003738; /* Lighter Teal (Buttons/Accents) */
    --cream-bg: #FFFAF0; 
    --white: #ffffff;
    --text-main: #2c3e50;
    --border-soft: #ececec;
    --radius: 12px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--cream-bg);
    color: var(--secondary-dark);
    font-family: 'Vazirmatn', sans-serif; /* Recommend using a Persian font like Vazir */
    margin: 0;
}

/* Container for the progress bar */
.checkout-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 30px auto 50px;
    max-width: 800px;
    direction: rtl; /* Ensures correct Persian flow */
    padding: 0 15px;
}

/* Individual Step Styling */
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.step-number, .step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f0f0f0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 10px;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

.step-text {
    font-size: 0.85rem;
    color: #888;
    white-space: nowrap;
}

/* --- ACTIVE STATE (Current Step) --- */
.step.active .step-number {
    background-color: #002223; /* Your Primary Dark Color */
    color: white;
    border-color: #002223;
    box-shadow: 0 0 10px rgba(0, 34, 35, 0.2);
}

.step.active .step-text {
    color: #002223;
    font-weight: bold;
}

/* --- COMPLETED STATE (Previous Steps) --- */
.step.completed .step-icon {
    background-color: #2e7d32; /* Trust-building Green */
    color: white;
    border-color: #2e7d32;
}

.step.completed .step-text {
    color: #2e7d32;
}

/* Connecting Lines */
.step-line {
    flex: 1;
    height: 2px;
    background-color: #ddd;
    margin: 0 10px;
    transform: translateY(-15px); /* Centers the line with the circles */
}

.step-line.active {
    background-color: #2e7d32; /* Turns green when moving past a completed step */
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .step-number, .step-icon {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    .step-text {
        font-size: 0.7rem;
    }
}

.cart-page-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}


.page-title {
    color: var(--primary-dark);
    font-size: 2rem;
    margin-bottom: 30px;
}

/* Layout Grid */
.cart-layout {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 30px;
    align-items: start;
}

/* Table Styling */
.cart-items {
    background: var(--cream-bg);
    padding: 20px;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th {
    text-align: right;
    padding: 15px;
    border-top: 1px solid var(--secondary-dark);
    border-bottom: 1px solid var(--secondary-dark);
    color: var(--primary-dark);
}

.cart-table td {
    padding: 20px 15px;
    border-bottom: 1px solid var(--secondary-dark);
}

.product-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

/* Quantity Control Buttons */
.qty-box {
    background-color: white;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-soft);
    border-radius: 5px;
    width: fit-content;
}

.qty-btn {
    background: none;
    border: none;
    padding: 5px 12px;
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-teal);
}

.qty-val {
    padding: 0 10px;
}

/* Remove Button */
.remove-btn {
    text-decoration: none;
    color: var(--primary-dark);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Sidebar / Receipt */
.receipt {
    background: var(--primary-dark);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    margin-top: 10px;
}

.receipt h2 {
    font-size: 1.3rem;
    margin-top: 0;
    color: var(--cream-bg);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    font-weight: 500;
    color: var(--cream-bg);
}

.summary-item.total {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--cream-bg);
}

/* Dims the summary during update */
.summary-updating {
    opacity: 0.5;
    pointer-events: none; /* Prevents clicking the checkout button while updating */
    transition: opacity 0.2s ease;
}

/* Optional: Add a subtle pulse animation */
@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 0.3; }
    100% { opacity: 0.5; }
}

.summary-updating {
    animation: pulse 1s infinite;
}

.checkout-btn {
    display: block;          /* Allows the element to respect width and margins */
    text-align: center;      /* Centers the text inside the block */
    box-sizing: border-box;  /* Prevents padding from making the button wider than 100% */
    text-decoration: none;
    width: 100%;
    padding: 15px 20px;
    background-color: var(--secondary-dark);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    margin: 20px 0;          /* Changed to 30px top/bottom, 0 left/right */
}

.checkout-btn:hover {
    background-color: #015355;
    color: white;            /* Ensures text stays white on hover */
}



/* Mobile Responsiveness */
@media screen and (max-width: 768px)  {
    .cart-layout {
        grid-template-columns: 1fr;
        margin: 0 auto;
    }
    
    .cart-table thead {
        display: none; /* Hide table headers on mobile */
    }
    .receipt {
        position: static; /* در موبایل حالت Sticky معمولاً آزاردهنده است */
        margin: 0 auto;
        display: block;
    }
    .cart-summary {
        width: 100%; /* فاکتور تمام عرض در دسترس را بگیرد */
        max-width: 500px; /* برای اینکه در تبلت‌ها خیلی پهن نشود */
        margin: 0 auto; /* اطمینان از وسط‌چین بودن نسبت به والد */
    }
}
@media screen and (max-width: 480px) {
    .cart-table, 
    .cart-table tbody, 
    .cart-table tr, 
    .cart-table td {
        display: block; /* Break the table structure */
        width: 100%;
    }

    .cart-row {
        border: 1px solid #eee;
        border-radius: 12px;
        margin-bottom: 20px;
        padding: 15px;
        background: #fff;
        position: relative; /* For positioning the remove button */
    }

    .cart-table td {
        text-align: right; /* Match Persian RTL flow */
        padding: 8px 0;
        border: none;
        display: flex;
        justify-content: space-between; /* Puts label on one side, value on other */
        align-items: center;
    }

    /* Make the product info look like a header for each card */
    .product-info {
        border-bottom: 1px solid #f5f5f5 !important;
        margin-bottom: 10px;
        padding-bottom: 15px !important;
        flex-direction: row-reverse; /* Fixes image/text alignment */
    }

    .cart-img {
        width: 60px;
        height: 60px;
        margin-left: 10px; /* Space for RTL */
    }

    /* Force labels to appear before data since we hid <thead> */
    .unit-price-cell::before { content: "قیمت واحد:"; font-weight: bold; }
    .quantity-controls::before { content: "تعداد:"; font-weight: bold; }
    .subtotal::before { content: "جمع کل:"; font-weight: bold; }
    
    .remove-btn {
        justify-content: center;
        background: #fff0f0;
        padding: 10px;
        border-radius: 8px;
        color: #ff4d4d;
    }
}