/**
 * ویجت تسویهٔ حساب مرحله‌ای - استایل‌های CSS
 * 
 * این فایل تمام استایل‌های ظاهری ویجت را شامل می‌شود
 */


/* ============ متغیرهای CSS ============ */

:root {
    --stepwise-primary-color: #007bff;
    --stepwise-success-color: #28a745;
    --stepwise-danger-color: #dc3545;
    --stepwise-warning-color: #ffc107;
    --stepwise-info-color: #17a2b8;
    --stepwise-light-color: #f8f9fa;
    --stepwise-dark-color: #343a40;
    --stepwise-border-color: #dee2e6;
    --stepwise-border-radius: 8px;
    --stepwise-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --stepwise-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --stepwise-transition: all 0.3s ease;
}


/* ============ محتوی اصلی ============ */

.stepwise-checkout-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    border-radius: var(--stepwise-border-radius);
    box-shadow: var(--stepwise-shadow);
    overflow: hidden;
    max-width: 1000px;
    margin: 20px auto;
}

.stepwise-checkout-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.stepwise-checkout-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
}


/* خالی بودن سبد */

.stepwise-checkout-empty {
    padding: 60px 30px;
    text-align: center;
    background: var(--stepwise-light-color);
}

.stepwise-checkout-empty p {
    font-size: 16px;
    color: var(--stepwise-dark-color);
    margin: 0;
}


/* ============ نوار پیشرفت ============ */

.stepwise-progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--stepwise-border-color);
}

.stepwise-progress-bar.progress-style-line {
    position: relative;
    gap: 20px;
}

.stepwise-progress-bar.progress-style-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--stepwise-border-color);
    z-index: 0;
}

.progress-step {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    opacity: 0.5;
    transition: var(--stepwise-transition);
}

.progress-step::before {
    content: '';
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--stepwise-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--stepwise-dark-color);
    transition: var(--stepwise-transition);
}

.progress-step.active {
    opacity: 1;
}

.progress-step.active::before {
    background: var(--stepwise-primary-color);
    border-color: var(--stepwise-primary-color);
    color: white;
}

.progress-step.completed::before {
    background: var(--stepwise-success-color);
    border-color: var(--stepwise-success-color);
}

.progress-step.completed::before {
    content: '✓';
}

.progress-step:hover {
    opacity: 1;
}

.progress-step:hover::before {
    box-shadow: 0 0 0 2px var(--stepwise-primary-color);
    transform: scale(1.05);
}

.progress-step.completed:hover::before {
    box-shadow: 0 0 0 2px var(--stepwise-success-color);
}

.progress-label {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}


/* نوار دایره‌ای */

.stepwise-progress-bar.progress-style-circle {
    gap: 30px;
    padding: 40px;
}

.stepwise-progress-bar.progress-style-circle .progress-step::before {
    width: 50px;
    height: 50px;
    font-size: 18px;
}


/* نوار نقطه‌ای */

.stepwise-progress-bar.progress-style-dots {
    gap: 10px;
    padding: 20px;
}

.stepwise-progress-bar.progress-style-dots::before {
    display: none;
}

.stepwise-progress-bar.progress-style-dots .progress-step::before {
    width: 20px;
    height: 20px;
}


/* ============ محتوای مراحل ============ */

.stepwise-content {
    min-height: 400px;
    position: relative;
}

.stepwise-step {
    display: none;
    padding: 40px;
    animation: fadeIn 0.5s ease;
}

.stepwise-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-title {
    margin-bottom: 30px;
    border-bottom: 2px solid var(--stepwise-light-color);
    padding-bottom: 20px;
}

.step-title h2 {
    margin: 0;
    color: var(--stepwise-dark-color);
    font-size: 22px;
    font-weight: 600;
}


/* ============ فیلدهای مشخصات گیرنده ============ */

.recipient-fields-container {
    background: white;
}

.fields-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.field-group {
    display: flex;
    flex-direction: column;
}

.field-group label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--stepwise-dark-color);
}

.field-group label .required {
    color: var(--stepwise-danger-color);
    font-weight: 600;
}

.field-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--stepwise-border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: var(--stepwise-dark-color);
    transition: var(--stepwise-transition);
    font-family: inherit;
}

.field-input:focus {
    outline: none;
    border-color: var(--stepwise-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.field-input:invalid {
    border-color: var(--stepwise-danger-color);
}

.field-input::placeholder {
    color: #aaa;
}

.field-input:disabled {
    background: var(--stepwise-light-color);
    cursor: not-allowed;
}


/* استایل Textarea برای فیلدهای آدرس و یادداشت‌ها */

textarea.field-input:focus {
    outline: none;
    border-color: var(--stepwise-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}


/* استایل Select/Dropdown برای فیلد استان */

.field-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--stepwise-border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: var(--stepwise-dark-color);
    transition: var(--stepwise-transition);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 35px;
}

.field-select:focus {
    outline: none;
    border-color: var(--stepwise-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.field-select:disabled {
    background-color: var(--stepwise-light-color);
    cursor: not-allowed;
}

.field-select option {
    padding: 8px 12px;
    background: white;
    color: var(--stepwise-dark-color);
}


/* ============ محصولات ============ */

.products-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stepwise-product-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: white;
    border: 1px solid var(--stepwise-border-color);
    border-radius: var(--stepwise-border-radius);
    transition: var(--stepwise-transition);
}

.stepwise-product-card:hover {
    box-shadow: var(--stepwise-shadow-hover);
    border-color: var(--stepwise-primary-color);
}

.product-image {
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--stepwise-light-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--stepwise-dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    margin: 0;
    font-size: 14px;
    color: var(--stepwise-primary-color);
    font-weight: 600;
}


/* کنترل تعداد */

.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.quantity-control.quantity-style-default {
    background: var(--stepwise-light-color);
    border-radius: 6px;
    padding: 4px;
}

.quantity-control.quantity-style-minimal {
    gap: 12px;
}

.quantity-control.quantity-style-modern {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 25px;
    padding: 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--stepwise-transition);
    color: var(--stepwise-dark-color);
}

.quantity-control.quantity-style-minimal .qty-btn {
    background: transparent;
    border: 1px solid var(--stepwise-border-color);
}

.quantity-control.quantity-style-modern .qty-btn {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.qty-btn:hover {
    background: var(--stepwise-primary-color);
    color: white;
}

.quantity-control.quantity-style-modern .qty-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.qty-input {
    width: 50px;
    padding: 6px;
    border: 1px solid var(--stepwise-border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.quantity-control.quantity-style-minimal .qty-input {
    border: 1px solid var(--stepwise-border-color);
}

.quantity-control.quantity-style-modern .qty-input {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}


/* دکمهٔ حذف */

.btn-delete-product {
    padding: 8px 12px;
    background: var(--stepwise-danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: var(--stepwise-transition);
    flex-shrink: 0;
}

.btn-delete-product:hover {
    background: darken(#dc3545, 10%);
    transform: scale(1.05);
}


/* ============ حمل‌ونقل و پرداخت ============ */

.shipping-payment-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.coupon-section,
.order-review-section,
.shipping-methods-section,
.payment-gateways-section {
    background: var(--stepwise-light-color);
    padding: 20px;
    border-radius: var(--stepwise-border-radius);
}

.coupon-section h3,
.order-review-section h3,
.shipping-methods-section h3,
.payment-gateways-section h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--stepwise-dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.coupon-form {
    display: flex;
    gap: 10px;
}

.coupon-form input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--stepwise-border-color);
    border-radius: 6px;
    font-size: 14px;
}


/* خلاصهٔ سفارش */

.order-review-section {
    background: white;
    border: 1px solid var(--stepwise-border-color);
}

.order-items {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--stepwise-border-color);
    padding-bottom: 20px;
}

.order-totals {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--stepwise-dark-color);
}

.total-row.grand-total {
    font-size: 18px;
    font-weight: 600;
    color: var(--stepwise-primary-color);
    border-top: 2px solid var(--stepwise-border-color);
    padding-top: 10px;
    margin-top: 10px;
}


/* روش‌های حمل‌ونقل و درگاه‌های پرداخت */

.shipping-methods,
.payment-gateways {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.shipping-methods[data-style="card"],
.payment-gateways[data-style="card"] {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.shipping-method-card,
.payment-gateway-card {
    padding: 20px;
    border: 2px solid var(--stepwise-border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--stepwise-transition);
    text-align: center;
    background: white;
}

.shipping-method-card:hover,
.payment-gateway-card:hover {
    border-color: var(--stepwise-primary-color);
    box-shadow: var(--stepwise-shadow-hover);
}

.shipping-method-card.active,
.payment-gateway-card.active {
    border-color: var(--stepwise-success-color);
    background: rgba(40, 167, 69, 0.05);
}


/* ============ فوتر ============ */

.stepwise-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px;
    background: var(--stepwise-light-color);
    border-top: 1px solid var(--stepwise-border-color);
    gap: 30px;
}

.footer-left,
.footer-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.footer-center {
    flex: 1;
    text-align: center;
}

.order-total {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.total-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--stepwise-dark-color);
}

.total-amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--stepwise-primary-color);
}


/* ============ دکمه‌ها ============ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--stepwise-transition);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-prev {
    background: white;
    color: var(--stepwise-dark-color);
    border: 1px solid var(--stepwise-border-color);
}

.btn-prev:hover {
    background: var(--stepwise-light-color);
    border-color: var(--stepwise-dark-color);
}

.btn-next {
    background: var(--stepwise-primary-color);
    color: white;
}

.btn-next:hover {
    background: #0056b3;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.btn-checkout {
    background: var(--stepwise-success-color);
    color: white;
}

.btn-checkout:hover {
    background: #218838;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ============ رسپانسیو ============ */

@media (max-width: 768px) {
    .stepwise-checkout-header {
        padding: 30px 20px;
    }
    .stepwise-checkout-header h1 {
        font-size: 24px;
    }
    .stepwise-step {
        padding: 30px 20px;
    }
    .stepwise-progress-bar {
        flex-wrap: wrap;
        padding: 20px;
    }
    .stepwise-product-card {
        flex-direction: column;
        text-align: center;
    }
    .stepwise-footer {
        flex-direction: column;
        padding: 20px;
    }
    .footer-left,
    .footer-right,
    .footer-center {
        width: 100%;
        flex-direction: column;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    .fields-wrapper {
        gap: 15px;
    }
    .field-group {
        flex-basis: 100%;
    }
}

@media (max-width: 480px) {
    .stepwise-checkout-wrapper {
        margin: 10px auto;
        border-radius: 4px;
    }
    .stepwise-step {
        padding: 20px 15px;
    }
    .step-title h2 {
        font-size: 18px;
    }
    .stepwise-product-card {
        gap: 15px;
        padding: 15px;
    }
    .stepwise-footer {
        padding: 15px;
        gap: 10px;
    }
    .total-amount {
        font-size: 18px;
    }
}


/* ============ حالت‌های لود و خطا ============ */

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error-message {
    padding: 12px 15px;
    background: var(--stepwise-danger-color);
    color: white;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.success-message {
    padding: 12px 15px;
    background: var(--stepwise-success-color);
    color: white;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}


/* ============ انیمیشن‌های اضافی ============ */

@keyframes slideInFromRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100px);
        opacity: 0;
    }
}


/* فوکوس‌ها و حالت‌های تعاملی */

.stepwise-checkout-wrapper *:focus-visible {
    outline: 2px solid var(--stepwise-primary-color);
    outline-offset: 2px;
}


/* حالت تیره (Dark Mode) */

@media (prefers-color-scheme: dark) {
    .stepwise-checkout-wrapper {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    .stepwise-progress-bar {
        background: #2a2a2a;
    }
    .field-input,
    .qty-input {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #3a3a3a;
    }
    .stepwise-product-card {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }
    .stepwise-footer {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }
}