/* --- الإعدادات العامة والألوان --- */
:root {
    --bg-dark: #0a0a0a;         /* أسود عميق للخلفية */
    --bg-card: #141414;         /* أسود فاتح للبطاقات */
    --primary-purple: #9d4edd;  /* بنفسجي أساسي */
    --light-purple: #c77dff;    /* بنفسجي فاتح للتأثيرات */
    --text-white: #ffffff;
    --text-gray: #b0b0b0;
    --transition: 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    line-height: 1.6;
    direction: rtl;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

a { text-decoration: none; color: inherit; }

/* --- الهيدر وشريط البحث --- */
.navbar {
    background: #000;
    padding: 15px 0;
    border-bottom: 2px solid var(--primary-purple);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-purple);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span { color: var(--text-white); font-size: 14px; opacity: 0.7; }

.search-box {
    display: flex;
    background: #1a1a1a;
    border-radius: 25px;
    padding: 5px 15px;
    border: 1px solid #333;
}

.search-box input {
    background: none;
    border: none;
    color: white;
    padding: 8px;
    outline: none;
    width: 200px;
}

.search-box button {
    background: none;
    border: none;
    color: var(--primary-purple);
    cursor: pointer;
}

/* --- شريط أيقونات الشركات (تم التعديل هنا) --- */
.brands-bar {
    background: #111;
    padding: 20px 0;
    border-bottom: 1px solid #222;
}

.brands-flex {
    display: flex;
    align-items: center; /* محاذاة العناصر عمودياً */
    gap: 25px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: thin; /* للمتصفحات الحديثة */
}

.brands-flex::-webkit-scrollbar { height: 4px; }
.brands-flex::-webkit-scrollbar-thumb { background: var(--primary-purple); border-radius: 10px; }

.brand-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    transition: var(--transition);
}

.brand-item img { 
    width: 55px;            /* حجم موحد */
    height: 55px;           /* حجم موحد */
    object-fit: contain;    /* الحفاظ على أبعاد الشعار داخل المربع */
    margin-bottom: 8px; 
    filter: grayscale(1); 
    background: #fff;       /* خلفية بيضاء لإظهار الشعارات المفرغة */
    border-radius: 50%;     /* شكل دائري */
    padding: 8px;           /* مسافة داخلية */
    border: 2px solid transparent;
    transition: var(--transition);
}

.brand-item:hover img { 
    filter: grayscale(0); 
    transform: scale(1.1); 
    border-color: var(--primary-purple); 
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.4);
}

.brand-item span { 
    font-size: 12px; 
    color: var(--text-gray); 
    font-weight: 500;
}

.brand-item:hover span {
    color: var(--primary-purple);
}

/* --- المحتوى الرئيسي والجسم --- */
.main-container {
    display: flex;
    gap: 25px;
    padding: 30px 0;
}

.content-area { flex: 3; }
.section-title { margin-bottom: 25px; font-size: 22px; border-right: 4px solid var(--primary-purple); padding-right: 15px; }

/* --- شبكة الهواتف (Cards) --- */
.phones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.phone-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 15px;
    position: relative;
    border: 1px solid #222;
    transition: var(--transition);
}

.phone-card:hover {
    border-color: var(--primary-purple);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(157, 78, 221, 0.15);
}

.phone-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-purple);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 5px;
    z-index: 10;
}

.phone-img { text-align: center; margin-bottom: 15px; }
.phone-img img { max-width: 100%; height: 180px; object-fit: contain; }

.phone-info h3 { font-size: 18px; margin-bottom: 10px; }
.mini-specs { font-size: 13px; color: var(--text-gray); margin-bottom: 15px; }
.mini-specs span { display: block; margin-bottom: 3px; }

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #222;
    padding-top: 10px;
}

.price { color: var(--light-purple); font-weight: bold; }
.details-btn {
    background: var(--primary-purple);
    color: white;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 5px;
}

/* --- القائمة الجانبية (Sidebar) --- */
.sidebar { flex: 1; }
.sidebar-box { background: var(--bg-card); border-radius: 15px; padding: 20px; border: 1px solid #222; margin-bottom: 20px; }
.sidebar-title { font-size: 18px; margin-bottom: 15px; color: var(--light-purple); }

.popular-list { list-style: none; }
.popular-list li { margin-bottom: 15px; border-bottom: 1px solid #222; padding-bottom: 10px; }
.popular-list li:last-child { border-bottom: none; }
.popular-list a { display: flex; align-items: center; gap: 10px; }
.pop-img img { width: 45px; height: 45px; object-fit: contain; background: #000; border-radius: 5px; }
.pop-info h4 { font-size: 14px; }
.pop-info span { font-size: 12px; color: var(--light-purple); }

/* --- الفوتر --- */
.main-footer {
    background: #000;
    padding: 40px 0 20px;
    margin-top: 50px;
    border-top: 2px solid var(--primary-purple);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}

.footer-links ul { list-style: none; }
.footer-links a:hover { color: var(--primary-purple); }
.copyright { text-align: center; border-top: 1px solid #222; padding-top: 20px; font-size: 13px; color: var(--text-gray); }

/* --- التجاوب (Responsive) --- */
@media (max-width: 992px) {
    .main-container { flex-direction: column; }
    .sidebar { order: 2; }
    .content-area { order: 1; }
}

@media (max-width: 600px) {
    .search-box { width: 100%; order: 3; }
    .nav-flex { justify-content: center; }
    .phones-grid { grid-template-columns: 1fr 1fr; } /* هاتفين في السطر للموبايل */
    .brand-item img { width: 45px; height: 45px; } /* تصغير الشعارات قليلاً للموبايل */
}