/* --- General & Theme --- */
body, html {
    margin: 0;
    padding: 0;
    font-family: 'Tahoma', 'IranSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; /* Improved font stack */
    direction: rtl;
    /* background-color: #f7f9fc; */ /* Replaced with gradient */
    background: linear-gradient(to bottom, #ffffff, #f7f9fc); /* Subtle white to soft blue-grey */
    color: #495057; /* Default text color */
    font-size: 14px;
    line-height: 1.7;
    min-height: 100vh; /* Ensure gradient covers full viewport height */
    -webkit-font-smoothing: antialiased; /* Smoother fonts */
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --primary-color: #dc3545; /* Red theme */
    --primary-color-darker: #c82333;
    --secondary-color: #6c757d; 
    --light-grey: #f8f9fa;
    --medium-grey: #dee2e6;
    --dark-grey: #343a40; /* Slightly darker for headings/contrast */
    --border-color: #e9ecef; 
    --success-color: #28a745;
    --info-color: #17a2b8;
    --body-bg: #f7f9fc;
    --card-bg: #ffffff;
    --text-muted: #6c757d;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    --box-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.08);
    --border-radius: 8px; /* Slightly larger radius */
    --transition-base: all 0.25s ease-in-out;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition-base);
}
a:hover {
    color: var(--primary-color-darker);
    text-decoration: none; 
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    transition: var(--transition-base);
}

img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

h2, h3, h4 {
    color: var(--dark-grey);
    margin-top: 0;
    font-weight: 600; 
    margin-bottom: 0.75em; /* Consistent bottom margin */
}
h4 { font-size: 1.1em; }

/* Card Style */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px 30px; /* Adjusted padding */
    margin-bottom: 25px;
    box-shadow: var(--box-shadow);
    transition: var(--transition-base);
}
.card:hover {
     box-shadow: var(--box-shadow-hover);
}

/* SVG Icon Base Style */
.icon {
  width: 1.1em; /* Slightly larger */
  height: 1.1em;
  vertical-align: -0.2em; /* Fine-tune vertical alignment */
  fill: currentColor;
  margin-left: 0.3em; /* Add space after icon (RTL) */
}

/* --- Header --- */
.checkout-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0; /* Adjusted padding */
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.checkout-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo container */
.logo-container svg {
    height: 38px;
    width: auto;
    vertical-align: middle;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 30px; /* Increased gap */
}

.header-actions a,
.header-actions span {
    color: var(--dark-grey);
    font-size: 14px; 
    display: flex;
    align-items: center;
    gap: 8px; /* Increased gap */
}
.header-actions a .icon {
    color: var(--secondary-color);
    width: 1.2em; /* Slightly larger icons */
    height: 1.2em;
}

.user-credit {
   background-color: rgb(32 31 31 / 10%);/* Lighter red background */
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 600;
     border: 1px solid rgb(105 89 91 / 20%);
}
.user-credit .icon {
    color: var(--primary-color);
}
.user-credit .credit-amount {
     font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 25px;
}

.header-right a,
.header-right button {
    color: var(--secondary-color);
    position: relative;
    background: none;
    padding: 0;
}
.header-right a .icon,
.header-right button .icon {
     width: 24px; /* Fixed size */
     height: 24px;
}

.header-right a:hover,
.header-right button:hover {
    color: var(--primary-color);
}

.cart-icon .cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-weight: 600;
    border: 2px solid var(--card-bg); /* Make it pop */
}

.menu-toggle {
    display: none;
}

/* --- User Info Banner --- */
.user-info-banner {
    background-color: #eef2f7;
    border: 1px solid #d6dde7;
    border-radius: var(--border-radius);
    padding: 15px 25px;
    margin: 25px 0; /* Added top margin */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.user-info-banner div {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--dark-grey);
}

.user-info-banner .icon {
    font-size: 20px;
    color: var(--primary-color);
    width: 1.3em;

}

.user-info-banner strong {
    font-weight: 600;
    color: #333;
}

/* --- Main Content --- */
main {
    padding: 30px 0;
}

.checkout-title h2 {
    font-size: 24px; /* Larger title */
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--dark-grey);
    font-weight: 700;
}
.checkout-title h2 .icon {
    color: var(--success-color);
    width: 1.2em;
    height: 1.2em;
}

.checkout-content {
    display: grid;
    grid-template-columns: 1.8fr 1fr; /* Give more space to main column */
    gap: 30px;
    align-items: flex-start;
}

.checkout-main-column {
    /* Container for items table and sms options */
}

/* --- Order Summary Table --- */
.order-summary {
    /* Uses .card styles */
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
}

.summary-table th,
.summary-table td {
    padding: 16px 12px; /* Increased padding */
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px; 
    vertical-align: middle;
}

.summary-table thead th {
    background-color: transparent; /* Remove header bg */
    font-weight: 600; 
    color: var(--text-muted); /* Muted color */
    border-bottom: 2px solid var(--border-color); /* Stronger header border */
    white-space: nowrap;
    font-size: 13px;
    text-transform: uppercase; 
    padding-bottom: 10px; /* Add space below header text */
}

.summary-table tbody tr:last-child td {
    border-bottom: none;
}

.summary-table tbody tr:hover {
    background-color: #fcfdff; /* Subtle hover */
}

.col-item {
    width: 50%;
    color: var(--dark-grey);
    font-weight: 500;
}
.col-unit-price,
.col-quantity,
.col-price {
    width: 15%;
    text-align: center;
    white-space: nowrap;
    color: var(--dark-grey);
}
.col-price {
     font-weight: 600;
}
.col-action {
    width: 5%;
    text-align: center;
}

.remove-item {
    color: var(--primary-color);
    font-size: 18px; 
    opacity: 0.6;
    padding: 5px; /* Easier to click */
    line-height: 1;
}
.remove-item:hover {
    opacity: 1;
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 50%;
}

.add-item-btn {
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    display: inline-flex; 
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    background-color: #fff;
}
.add-item-btn:hover {
     background-color: var(--primary-color);
     color: #fff;
}
.add-item-btn .icon {
    width: 1em;
    height: 1em;
    margin-left: 0.1em;
}



.messaging-options h3 {
    font-size: 17px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark-grey);
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.messaging-options h3 .icon {
    color: var(--info-color);
    width: 1.2em;
    height: 1.2em;
}



.cost-breakdown h4 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.cost-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px; /* Increased spacing */
    font-size: 14px;
    color: var(--dark-grey);
}

.cost-row .cost-label {
    color: var(--text-muted);
}
.cost-row .cost-value {
    font-weight: 600;
}

.cost-breakdown hr {
    border: none;
    border-top: 1px dashed var(--medium-grey);
    margin: 25px 0;
}

.total-cost-row {
    font-weight: 700;
    font-size: 18px; /* Larger total */
    color: var(--dark-grey);
    padding-top: 10px;
}

.total-cost-row .cost-value {
    color: var(--primary-color);
}

.payment-options h3 {
    font-size: 17px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark-grey);
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.payment-options h3 .icon {
    color: var(--secondary-color);
    width: 1.2em;
    height: 1.2em;
}

/* Custom Checkbox */
.checkbox-container {
    display: inline-flex; 
    align-items: center; 
    position: relative;
    padding-right: 30px;
    margin-bottom: 10px; /* Spacing */
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    color: var(--dark-grey);
    line-height: 1.5;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 3px; /* Align better */
    right: 0;
    height: 18px;
    width: 18px;
    background-color: #fff;
    border: 2px solid var(--medium-grey);
    border-radius: 4px;
    transition: var(--transition-base);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--secondary-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

/* Payment Options */
.payment-gateways {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2x2 grid */
    gap: 15px;
}

.gateway-btn {
    border: 1px solid var(--border-color); /* Thinner border */
    border-radius: var(--border-radius);
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: var(--card-bg);
    transition: var(--transition-base);
    min-height: 100px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.gateway-btn img {
    height: 35px;
    max-width: 70px;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: var(--transition-base);
}

.gateway-btn span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition-base);
}

.gateway-btn:hover {
    border-color: var(--medium-grey);
    transform: translateY(-3px);
    box-shadow: var(--box-shadow);
}
.gateway-btn:hover img {
    filter: grayscale(50%);
    opacity: 0.8;
}

.gateway-btn.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
    transform: translateY(0);
    background-color: #fff7f8; /* Very light red bg */
}

.gateway-btn.active img {
    filter: grayscale(0%);
    opacity: 1;
}

.gateway-btn.active span {
    color: var(--primary-color);
    font-weight: 600;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(52, 58, 64, 0.7); /* Darker overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s; /* Delay visibility change */
}

.modal-overlay[style*="display: flex"] {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 0;
    width: 90%;
    max-width: 550px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-20px) scale(0.98);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-overlay[style*="display: flex"] .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px; /* Adjusted padding */
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-grey);
}

.modal-close-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--secondary-color);
    opacity: 0.6;
}
.modal-close-btn svg {
    width: 20px;
    height: 20px;
}
.modal-close-btn:hover {
    opacity: 1;
    color: var(--primary-color);
}

.modal-body {
    padding: 25px 30px;
    overflow-y: auto;
    flex-grow: 1;
    font-size: 14px;
    line-height: 1.8;
    color: #555;
}

/* REMOVED Modal Loader Styles */
/* .modal-loader { ... } */
/* .spinner { ... } */
/* @keyframes spin { ... } */

.modal-backend-guide {
    font-size: 12px;
    color: #aaa;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed var(--medium-grey);
}

.modal-body p {
    margin-bottom: 15px;
}
.modal-body ul, .modal-body ol {
    margin-bottom: 15px;
    padding-right: 20px;
}
.modal-body li {
    margin-bottom: 8px;
}
.modal-body strong {
    font-weight: 600;
    color: var(--dark-grey);
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    text-align: left; 
    background-color: #f8f9fa; /* Light footer bg */
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.modal-footer button {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    margin-right: 10px; /* RTL spacing */
}

.modal-confirm-btn {
    background-color: var(--primary-color);
    color: #fff;
}
.modal-confirm-btn:hover {
    background-color: var(--primary-color-darker);
}
.modal-cancel-btn {
    background-color: var(--secondary-color);
    color: #fff;
    opacity: 0.8;
}
.modal-cancel-btn:hover {
    opacity: 1;
}

/* --- Footer Styles --- */
.checkout-footer {
    background-color: var(--primary-color);
    color: #fff;
    padding: 20px 0;
    margin-top: 40px; /* Space above footer */
    text-align: center;
    font-size: 13px;
}

.checkout-footer p {
    margin: 0;
    opacity: 0.9; /* Slightly transparent text */
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .checkout-content {
        grid-template-columns: 1fr;
    }
    .checkout-details {
        position: static;
    }
}

@media (max-width: 768px) {
    .checkout-header .container {
        flex-wrap: wrap;
    }
    .header-actions {
        order: 3;
        width: 100%;
        margin-top: 15px;
        justify-content: space-between; /* Adjust spacing */
        gap: 10px;
    }
    .user-credit {
        padding: 5px 8px;
        font-size: 12px;
    }
    .header-actions a {
        font-size: 13px;
    }
    .menu-toggle {
        display: block;
    }
    .user-info-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px;
    }
    .summary-table thead {
        display: none;
    }
    .summary-table tbody tr {
        display: block;
        margin-bottom: 15px;
        /* Uses .card styling already for mobile */
        padding: 15px;
    }
    .summary-table tbody td {
        display: flex; 
        justify-content: space-between;
        text-align: left; 
        border-bottom: 1px dashed var(--border-color);
        padding: 10px 0; /* Adjust padding */
        position: static; 
        padding-right: 0;
    }
    .summary-table tbody td:last-child {
         border-bottom: none;
         padding-bottom: 0;
    }
     .summary-table tbody td:first-child {
         padding-top: 0;
    }
    .summary-table tbody td::before {
        content: attr(data-label); 
        font-weight: 600;
        color: var(--text-muted);
        text-align: right;
        width: auto; 
        position: static;
        padding-left: 15px; /* More space */
    }

    .col-action {
        justify-content: flex-end; 
        padding: 10px 0 0 0; /* Adjust padding */
    }
    .col-action::before {
        display: none;
    }
    .col-unit-price,
    .col-quantity,
    .col-price {
        text-align: left;
        padding-left: 0;
    }

     .payment-gateways {
        grid-template-columns: 1fr; /* Stack gateways */
        gap: 10px;
    }
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    .modal-footer {
        text-align: center;
    }
     .modal-footer button {
         width: calc(50% - 5px); /* Two buttons side-by-side */
         margin: 0;
     }
     .modal-footer button:first-of-type {
         margin-left: 10px; /* Space between buttons (RTL) */
     }
} 