* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary: #667eea;
    --secondary: #764ba2;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    direction: rtl;
    text-align: right;
}

.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-icon {
    position: relative;
    font-size: 28px;
    cursor: pointer;
}

.cart-count {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-top: 30px;
}

.products-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f0f0f0;
}

.product-info {
    padding: 15px;
}

.product-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.product-price {
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 5px;
}

.product-discount {
    color: #ff6b6b;
    font-size: 14px;
    margin-bottom: 10px;
}

.product-rating {
    color: #f39c12;
    font-size: 14px;
}

.cart-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.cart-section h3 {
    margin-bottom: 15px;
    color: #333;
}

.cart-items {
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.cart-item-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.quantity-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.remove-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.empty-cart {
    text-align: center;
    color: #999;
    padding: 20px 0;
}

.cart-total {
    border-top: 2px solid var(--primary);
    padding-top: 15px;
    margin-bottom: 15px;
    color: #333;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: opacity 0.3s;
}

.checkout-btn:hover {
    opacity: 0.9;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.checkout-modal {
    max-width: 500px;
}

.close {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

#modal-product-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
}

.modal-product-info h2 {
    margin-bottom: 10px;
    color: #333;
}

.modal-product-info p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.rating-display {
    margin-bottom: 15px;
    font-size: 18px;
    color: #f39c12;
}

.price-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.price {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}

.original-price {
    text-decoration: line-through;
    color: #999;
}

.add-to-cart-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.add-to-cart-btn:hover {
    background: var(--secondary);
}

/* Reviews Section */
.reviews-section {
    border-top: 2px solid #eee;
    padding-top: 20px;
}

.reviews-section h3 {
    margin-bottom: 15px;
}

.add-review {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.add-review input,
.add-review select,
.add-review textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.add-review textarea {
    min-height: 80px;
    resize: vertical;
}

#submit-review-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.review-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border-right: 3px solid var(--primary);
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.review-author {
    font-weight: bold;
    color: #333;
}

.review-rating {
    color: #f39c12;
}

.review-comment {
    color: #666;
    line-height: 1.5;
    font-size: 14px;
}

.review-date {
    color: #999;
    font-size: 12px;
    margin-top: 5px;
}

/* Checkout Form */
#checkout-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#checkout-form input,
#checkout-form textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.order-summary {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    font-size: 18px;
    color: #333;
}

.submit-btn {
    padding: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .modal-body {
        grid-template-columns: 1fr;
    }

    .cart-section {
        position: static;
    }
}
