/* 
 * ملف التنسيقات الرئيسي
 * متجر الأجهزة الكهربائية
 * تصميم حديث ومرتب
 */

/* === المتغيرات === */
:root {
    --primary: #06b6d4;
    --primary-dark: #0891b2;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* === إعادة التعيين === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    direction: rtl;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
}

/* === الهيدر === */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.header-top {
    background: rgba(0,0,0,0.1);
    padding: 8px 0;
    font-size: 14px;
}

.header-main {
    padding: 15px 0;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 32px;
}

/* === البحث === */
.search-box {
    flex: 1;
    max-width: 500px;
}

.search-form {
    display: flex;
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.search-form input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    outline: none;
    font-size: 15px;
}

.search-form button {
    padding: 12px 25px;
    background: var(--primary-dark);
    color: white;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.search-form button:hover {
    background: var(--dark);
}

/* === أيقونات الهيدر === */
.header-icons {
    display: flex;
    align-items: center;
    gap: 25px;
}

.header-icon {
    position: relative;
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.header-icon:hover {
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === التنقل === */
.nav {
    background: var(--dark);
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 5px;
    padding: 0;
}

.nav-list a {
    display: block;
    padding: 15px 25px;
    color: white;
    font-weight: 500;
    transition: var(--transition);
    border-radius: 8px 8px 0 0;
}

.nav-list a:hover,
.nav-list a.active {
    background: var(--primary);
}

/* === البانر === */
.hero {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    padding: 60px 0;
    margin-bottom: 40px;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-text h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-text p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 25px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 30px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: white;
    color: var(--primary);
}

.btn-primary:hover {
    background: var(--dark);
    color: white;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--primary);
    color: white;
}

.btn-secondary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

/* === الأقسام === */
.section {
    padding: 50px 0;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    border-radius: 3px;
}

/* === التصنيفات === */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.category-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.category-card i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.category-card h3 {
    font-size: 16px;
    font-weight: 600;
}

/* === المنتجات === */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.product-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--danger);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    z-index: 1;
}

.product-image {
    height: 220px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    max-height: 100%;
    object-fit: contain;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-image i {
    font-size: 80px;
    color: var(--gray);
}

.product-info {
    padding: 20px;
}

.product-category {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-name a:hover {
    color: var(--primary);
}

.product-price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.current-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.old-price {
    font-size: 14px;
    color: var(--gray);
    text-decoration: line-through;
}

.product-actions {
    display: flex;
    gap: 10px;
}

.product-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 12px 15px;
    font-size: 14px;
}

/* === صفحة المنتج === */
.product-page {
    padding: 40px 0;
}

.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.product-gallery {
    position: relative;
}

.main-image {
    height: 400px;
    background: var(--light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image i {
    font-size: 150px;
    color: var(--gray);
}

.product-details h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
}

.product-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--secondary);
}

.product-description {
    color: var(--secondary);
    margin-bottom: 25px;
    line-height: 1.8;
}

.product-price-large {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.product-price-large .current-price {
    font-size: 32px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.quantity-selector label {
    font-weight: 600;
}

.quantity-input {
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.quantity-input button {
    width: 45px;
    height: 45px;
    background: var(--light);
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.quantity-input button:hover {
    background: var(--primary);
    color: white;
}

.quantity-input input {
    width: 60px;
    height: 45px;
    text-align: center;
    border: none;
    font-size: 18px;
    font-weight: 600;
}

/* === السلة === */
.cart-page {
    padding: 40px 0;
}

.cart-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
}

.cart-items {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

.cart-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 100px;
    height: 100px;
    background: var(--light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-image i {
    font-size: 40px;
    color: var(--gray);
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 8px;
}

.cart-item-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 18px;
}

.cart-item-remove {
    color: var(--danger);
    cursor: pointer;
    font-size: 20px;
}

.cart-summary {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.cart-summary h3 {
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 15px;
}

.summary-row.total {
    border-top: 2px solid var(--border);
    margin-top: 15px;
    padding-top: 20px;
    font-size: 20px;
    font-weight: 700;
}

.summary-row.total span:last-child {
    color: var(--primary);
}

/* === صفحة الدفع === */
.checkout-page {
    padding: 40px 0;
}

.checkout-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

.checkout-form {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.form-section {
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.payment-method {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.payment-method:hover,
.payment-method.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.payment-method input {
    width: 20px;
    height: 20px;
}

.payment-method i {
    font-size: 24px;
    color: var(--primary);
}

/* === الفوتر === */
.footer {
    background: var(--dark);
    color: white;
    padding: 60px 0 0;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

.footer-col h4 {
    font-size: 18px;
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 15px;
}

.footer-col h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.footer-col p {
    color: var(--gray);
    line-height: 1.8;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--gray);
}

.footer-links a:hover {
    color: var(--primary);
    padding-right: 5px;
}

.footer-contact li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    color: var(--gray);
}

.footer-contact i {
    color: var(--primary);
    font-size: 18px;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 25px 0;
    margin-top: 50px;
    text-align: center;
    color: var(--gray);
}

/* === الرسائل === */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* === سلة فارغة === */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart i {
    font-size: 80px;
    color: var(--gray);
    margin-bottom: 20px;
}

.empty-cart h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.empty-cart p {
    color: var(--secondary);
    margin-bottom: 25px;
}

/* === صفحة النجاح === */
.success-page {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 40px auto;
}

.success-icon {
    width: 100px;
    height: 100px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
}

.success-icon i {
    font-size: 50px;
    color: white;
}

.success-page h1 {
    font-size: 28px;
    margin-bottom: 15px;
}

.order-number {
    background: var(--light);
    padding: 15px 25px;
    border-radius: 8px;
    display: inline-block;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin: 20px 0;
}

/* === التحميل === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Responsive === */
@media (max-width: 1024px) {
    .product-detail,
    .cart-container,
    .checkout-container {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .search-box {
        order: 3;
        max-width: 100%;
        width: 100%;
        margin-top: 15px;
    }
    
    .hero-content {
        flex-direction: column;
        text-align: center;
    }
    
    .hero-text h1 {
        font-size: 28px;
    }
    
    .nav-list {
        overflow-x: auto;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
