/**
 * سبد خرید و تکمیل خرید - استایل یکپارچه با قالب
 */
.page-cart .section-header,
.page-checkout .section-header {
    margin-bottom: var(--spacing-lg);
}
.page-cart .section-title,
.page-checkout .section-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
}
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-lg);
}
.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.alert-info {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
}
.cart-table-wrap {
    overflow-x: auto;
    margin-bottom: var(--spacing-xl);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}
.cart-table th,
.cart-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}
.cart-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}
.cart-table tbody tr:hover {
    background: var(--bg-secondary);
}
.cart-table img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
.cart-table .form-control,
.cart-table input[type="number"] {
    width: 4rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}
.cart-summary {
    max-width: 400px;
    margin-right: auto;
    margin-left: 0;
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}
.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
}
.cart-summary-row.total {
    font-size: var(--font-size-lg);
    font-weight: 700;
    border-top: 2px solid var(--border-color);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-md);
}
.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-xs);
}
.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0.35rem 0.75rem;
}
.btn-danger:hover {
    background: #b91c1c;
}
.checkout-form {
    max-width: 500px;
    margin-top: var(--spacing-lg);
}
.checkout-form .form-group {
    margin-bottom: var(--spacing-md);
}
.checkout-form label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-primary);
}
.checkout-form .form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-family: inherit;
}
.checkout-form textarea.form-control {
    min-height: 100px;
    resize: vertical;
}
.checkout-form .form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
}
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-xl);
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}
.pagination a:hover {
    background: var(--bg-hover);
}
.pagination .current {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}
.toolbar {
    margin-bottom: var(--spacing-lg);
}
.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
}
.search-form .form-control {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}
.search-form .select-category {
    max-width: 200px;
}
.page-products {
    padding-bottom: var(--spacing-2xl);
}

/* ============================================
   صفحه تکمیل خرید - طراحی حرفه‌ای
   ============================================ */

.checkout-section {
    padding: var(--spacing-xl) 0;
    background: linear-gradient(to bottom, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    min-height: calc(100vh - 200px);
}

.checkout-header {
    margin-bottom: var(--spacing-xl);
}

.checkout-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.checkout-breadcrumb a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.checkout-breadcrumb a:hover {
    color: #333333;
}

.checkout-breadcrumb svg {
    color: var(--text-muted);
}

.checkout-breadcrumb .active {
    color: var(--text-primary);
    font-weight: 600;
}

.checkout-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.checkout-alert {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.checkout-alert svg {
    flex-shrink: 0;
}

.checkout-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--spacing-xl);
    align-items: start;
}

.checkout-main {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.checkout-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.checkout-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
}

.checkout-card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    position: relative;
}

.checkout-card-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 2px;
    background: linear-gradient(to left, var(--accent-primary), transparent);
}

.checkout-card-header svg {
    color: var(--accent-primary);
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.checkout-card-header h2 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.checkout-form {
    padding: var(--spacing-lg);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.form-label svg {
    color: var(--accent-primary);
    flex-shrink: 0;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-control:hover {
    border-color: rgba(26, 26, 26, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(26, 26, 26, 0.08), 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-help {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.checkout-login-prompt {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(3, 105, 161, 0.1);
    transition: all 0.3s ease;
}

.checkout-login-prompt:hover {
    box-shadow: 0 4px 12px rgba(3, 105, 161, 0.15);
    transform: translateY(-2px);
}

.checkout-login-prompt svg {
    color: #0369a1;
    flex-shrink: 0;
}

.checkout-login-prompt strong {
    display: block;
    color: #0369a1;
    margin-bottom: 0.25rem;
}

.checkout-login-prompt p {
    margin: 0;
    font-size: var(--font-size-xs);
    color: #0369a1;
}

.btn-outline {
    padding: 0.5rem 1rem;
    border: 2px solid var(--accent-primary);
    background: transparent;
    color: var(--accent-primary);
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-outline:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.payment-methods {
    padding: var(--spacing-lg);
}

.payment-method {
    display: block;
    cursor: pointer;
    margin-bottom: var(--spacing-sm);
}

.payment-method:last-child {
    margin-bottom: 0;
}

.payment-method input[type="radio"] {
    display: none;
}

.payment-method-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.payment-method-content:hover {
    border-color: rgba(26, 26, 26, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.payment-method input[type="radio"]:checked + .payment-method-content {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.05) 0%, rgba(26, 26, 26, 0.02) 100%);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08), 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.payment-method-content svg {
    color: var(--accent-primary);
    flex-shrink: 0;
}

.payment-method-content strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.payment-method-content p {
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

.shipping-cost-display {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--accent-primary);
    margin-right: auto;
    padding-right: var(--spacing-md);
}

.shipping-method-option .payment-method-content {
    align-items: center;
}

/* Sidebar خلاصه سفارش */
.checkout-sidebar {
    position: sticky;
    top: var(--spacing-lg);
}

.checkout-summary-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    position: relative;
}

.summary-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 2px;
    background: linear-gradient(to left, var(--accent-primary), transparent);
}

.summary-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.edit-cart-link {
    font-size: var(--font-size-sm);
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.edit-cart-link:hover {
    color: #333333;
    text-decoration: underline;
}

.summary-products {
    padding: var(--spacing-md);
    max-height: 400px;
    overflow-y: auto;
}

.summary-products::-webkit-scrollbar {
    width: 6px;
}

.summary-products::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

.summary-products::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.summary-products::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.summary-product-item {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-xs);
}

.summary-product-item:hover {
    background: var(--bg-secondary);
    transform: translateX(-4px);
}

.summary-product-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.product-image-summary {
    position: relative;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.product-image-summary img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.summary-product-item:hover .product-image-summary img {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.product-quantity {
    position: absolute;
    top: -8px;
    left: -8px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #333333 100%);
    color: var(--bg-primary);
    font-size: 0.7rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg-card);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.product-info-summary {
    flex: 1;
    min-width: 0;
}

.product-info-summary h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-price-summary {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin: 0;
}

.product-total-summary {
    font-weight: 700;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    align-self: flex-start;
}

.summary-divider {
    height: 1px;
    background: linear-gradient(to left, var(--border-color) 0%, transparent 100%);
    margin: var(--spacing-md) 0;
    position: relative;
}

.summary-divider::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50px;
    height: 1px;
    background: linear-gradient(to left, var(--accent-primary), transparent);
}

.summary-details {
    padding: 0 var(--spacing-md);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.discount-row {
    color: #10b981;
}

.summary-total {
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-top: 2px solid var(--border-color);
    position: relative;
}

.summary-total::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 2px;
    background: linear-gradient(to left, var(--accent-primary), transparent);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.total-amount {
    font-size: 1.75rem;
    color: var(--accent-primary);
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.checkout-submit-btn {
    width: calc(100% - 2rem);
    padding: 1rem var(--spacing-md);
    background: linear-gradient(135deg, var(--accent-primary) 0%, #2d2d2d 50%, #333333 100%);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-lg);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: var(--spacing-md);
    box-shadow: 0 4px 16px rgba(26, 26, 26, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.checkout-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.checkout-submit-btn:hover::before {
    left: 100%;
}

.checkout-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(26, 26, 26, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #2d2d2d 0%, var(--accent-primary) 50%, #2d2d2d 100%);
}

.checkout-submit-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.3);
}

.checkout-submit-btn svg {
    flex-shrink: 0;
}

.checkout-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.checkout-security svg {
    color: #10b981;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .checkout-sidebar {
        position: static;
        order: -1;
    }
}

@media (max-width: 768px) {
    .checkout-title {
        font-size: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .checkout-card-header {
        padding: var(--spacing-md);
    }

    .checkout-form {
        padding: var(--spacing-md);
    }

    .summary-products {
        max-height: 300px;
    }
}
