/**
 * نظام اعتدال - التنسيقات الرئيسية
 * ألوان الهوية البصرية لجمعية اعتدال
 */

:root {
    --gray-dark: #5b6670;
    --green-primary: #6cb499;
    --beige: #baa88d;
    --blue-dark: #003866;
    --teal: #2f7e99;
    --orange: #ff6b00;
    --white: #ffffff;
    --bg-light: #f5f7f9;
    --text-dark: #2d3436;
    --text-muted: #636e72;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #d63031;
    --shadow-sm: 0 2px 10px rgba(91, 102, 112, 0.08);
    --shadow-md: 0 5px 25px rgba(91, 102, 112, 0.12);
    --shadow-lg: 0 10px 50px rgba(91, 102, 112, 0.15);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Sans Arabic', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.8;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ========== الهيدر ========== */
.header {
    background: var(--gray-dark);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 30px;
}

.logo img {
    height: 55px;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: rgba(255,255,255,0.85);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: var(--white);
}

.cart-badge {
    background: var(--orange);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 5px;
}

/* ========== Hero ========== */
.hero {
    background: linear-gradient(135deg, var(--gray-dark) 0%, var(--teal) 50%, var(--green-primary) 100%);
    padding: 70px 30px;
    text-align: center;
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -100px;
    left: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(108,180,153,0.3) 0%, transparent 70%);
    border-radius: 50%;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    position: relative;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* ========== التصنيفات الرئيسية ========== */
.main-categories {
    max-width: 1400px;
    margin: -40px auto 0;
    padding: 0 30px;
    position: relative;
    z-index: 10;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.main-category-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
    display: block;
}

.main-category-card:hover, .main-category-card.active {
    transform: translateY(-8px);
    border-color: var(--green-primary);
    box-shadow: var(--shadow-lg);
}

.main-category-card.active {
    background: linear-gradient(135deg, var(--green-primary), var(--teal));
    color: var(--white);
}

.category-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, var(--green-primary), var(--teal));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--white);
    transition: all 0.3s ease;
}

.main-category-card.active .category-icon {
    background: rgba(255,255,255,0.2);
}

.category-name {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ========== الأقسام الفرعية ========== */
.sub-categories {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 30px;
}

.sub-categories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: none;
}

.sub-categories-scroll::-webkit-scrollbar {
    display: none;
}

.sub-category-chip {
    padding: 10px 24px;
    background: var(--white);
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e8ecef;
    color: var(--text-dark);
}

.sub-category-chip:hover, .sub-category-chip.active {
    background: var(--teal);
    color: var(--white);
    border-color: var(--teal);
}

/* ========== المحتوى ========== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--green-primary);
}

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

.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(91,102,112,0.08);
}

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

.product-image {
    height: 220px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #e8ecef 0%, #d5dce0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.product-image .placeholder-icon {
    font-size: 4rem;
    color: rgba(91,102,112,0.2);
}

.product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-available { background: var(--success); color: var(--white); }
.badge-limited { background: var(--warning); color: var(--text-dark); }
.badge-out { background: var(--danger); color: var(--white); }

.product-body {
    padding: 22px;
}

.product-category-tag {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--teal);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    background: rgba(47,126,153,0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-dark);
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.detail-tag {
    background: var(--bg-light);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.detail-tag i {
    color: var(--green-primary);
    font-size: 0.75rem;
}

.product-stock {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.stock-bar {
    flex: 1;
    height: 6px;
    background: #e8ecef;
    border-radius: 3px;
    overflow: hidden;
}

.stock-fill {
    height: 100%;
    border-radius: 3px;
}

.stock-fill.high { background: linear-gradient(90deg, var(--success), #55efc4); }
.stock-fill.medium { background: linear-gradient(90deg, #f39c12, var(--warning)); }
.stock-fill.low { background: linear-gradient(90deg, var(--danger), #e17055); }
.stock-fill.out { background: var(--danger); width: 0 !important; }

.stock-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.product-actions {
    margin-top: 18px;
}

/* ========== الأزرار ========== */
.btn {
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green-primary), var(--teal));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108,180,153,0.35);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--gray-dark);
    border: 2px solid #e8ecef;
}

.btn-secondary:hover {
    background: #e8ecef;
}

.btn-orange {
    background: linear-gradient(135deg, var(--orange), #e55039);
    color: var(--white);
}

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

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

.btn-block { width: 100%; }
.btn-sm { padding: 10px 18px; font-size: 0.9rem; }

/* ========== السلة العائمة ========== */
.floating-cart {
    position: fixed;
    bottom: 35px;
    left: 35px;
    z-index: 999;
}

.cart-btn {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--orange), #e55039);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(255,107,0,0.4);
    transition: all 0.3s ease;
    border: none;
    position: relative;
}

.cart-btn:hover {
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--gray-dark);
    color: var(--white);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

/* ========== النماذج ========== */
.form-group {
    margin-bottom: 22px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-dark);
}

.form-label .required {
    color: var(--danger);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e8ecef;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--green-primary);
    box-shadow: 0 0 0 4px rgba(108,180,153,0.15);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

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

/* ========== صفحة السلة ========== */
.cart-page, .checkout-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.cart-page h1, .checkout-page h1 {
    font-size: 1.8rem;
    color: var(--gray-dark);
    margin-bottom: 30px;
    text-align: center;
}

.cart-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--white);
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    align-items: center;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.cart-item-info h3 {
    font-size: 1.1rem;
    color: var(--gray-dark);
    margin-bottom: 5px;
}

.cart-item-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-item-qty button {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background: var(--white);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cart-item-qty button:hover {
    background: var(--green-primary);
    border-color: var(--green-primary);
    color: var(--white);
}

.cart-item-qty span {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 30px;
    text-align: center;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.remove-btn:hover {
    opacity: 1;
}

.empty-cart, .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-cart i, .empty-state i {
    font-size: 5rem;
    opacity: 0.2;
    margin-bottom: 20px;
    display: block;
}

.empty-cart h3, .empty-state h3 {
    color: var(--gray-dark);
    margin-bottom: 15px;
}

/* ========== الموقع ========== */
.location-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--teal), var(--blue-dark));
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    justify-content: center;
}

.location-btn:hover {
    opacity: 0.9;
}

.map-container {
    margin-top: 12px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.map-container iframe {
    width: 100%;
    height: 200px;
    border: none;
}

/* ========== صفحة النجاح ========== */
.success-page {
    text-align: center;
    padding: 80px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.success-icon {
    width: 100px;
    height: 100px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    margin: 0 auto 30px;
}

.success-page h1 {
    color: var(--gray-dark);
    margin-bottom: 15px;
}

.order-number {
    background: var(--bg-light);
    padding: 15px 30px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin: 20px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--teal);
}

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

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 50px;
}

.footer-brand img {
    height: 55px;
    margin-bottom: 18px;
}

.footer-brand p {
    opacity: 0.85;
    line-height: 1.8;
}

.footer-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--green-primary);
}

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

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

.footer-links a {
    color: rgba(255,255,255,0.8);
    transition: all 0.3s ease;
}

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

.footer-bottom {
    max-width: 1400px;
    margin: 35px auto 0;
    padding-top: 25px;
    border-top: 1px solid rgba(255,255,255,0.15);
    text-align: center;
    opacity: 0.7;
    font-size: 0.9rem;
}

/* ========== التنبيهات ========== */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 16px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    z-index: 9999;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-success { background: var(--success); color: var(--white); }
.toast-warning { background: var(--warning); color: var(--text-dark); }
.toast-error { background: var(--danger); color: var(--white); }

/* ========== التحميل ========== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
    margin-left: 15px;
}

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

/* ========== التوافقية ========== */
@media (max-width: 992px) {
    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .header-nav { display: none; }
    
    .hero h1 { font-size: 2rem; }
    .hero { padding: 50px 20px; }
    
    .main-categories { padding: 0 15px; }
    .main-content { padding: 20px 15px; }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .main-category-card {
        padding: 20px 15px;
    }
    
    .category-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .floating-cart {
        bottom: 20px;
        left: 20px;
    }
    
    .cart-btn {
        width: 60px;
        height: 60px;
    }
    
    .cart-item {
        flex-wrap: wrap;
    }
}
