/* ===== الألوان والمتغيرات العالمية ===== */
:root {
    --bg-page: #ffffff;
    --bg-header: #ffffff;
    --border: #e4e8ed;
    --primary: #0040bb;   /* أزرق العميل */
    --secondary: #c50211; /* أحمر العميل */
    --header-height: 64px;
    --text-primary: #1a2634;
    --text-secondary: #4a5a6e;
}

[data-theme="dark"] {
    --bg-page: #0d131a;
    --bg-header: #141d26;
    --border: #2a3a4a;
    --text-primary: #e8edf3;
    --text-secondary: #b0c4d9;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Cairo', sans-serif; transition: background-color 0.3s, color 0.3s; }
html, body { overflow-x: hidden; width: 100%; }
body { background-color: var(--bg-page); color: var(--text-primary); padding-top: var(--header-height); }

/* ===== الهيدر الموزون ===== */
.top-bar {
    background: var(--bg-header); padding: 0 16px;
    display: flex; align-items: center; justify-content: space-between;
    height: var(--header-height); position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    border-bottom: 1px solid var(--border); backdrop-filter: blur(10px);
}

.top-left, .top-right { display: flex; align-items: center; gap: 12px; }

/* ===== القائمة الرئيسية (ديسك توب) ===== */
.main-nav { flex: 1; display: flex; justify-content: center; }
.main-nav ul { display: flex; list-style: none; gap: 25px; }
.main-nav ul li {
    font-size: 15px; font-weight: 700; color: var(--text-primary);
    cursor: pointer; transition: 0.3s; position: relative;
    padding: 5px 0;
}
.main-nav ul li:hover, .main-nav ul li.active { color: var(--secondary); }
.main-nav ul li::after {
    content: ''; position: absolute; bottom: 0; right: 0; width: 0; height: 2px;
    background: var(--secondary); transition: 0.3s;
}
.main-nav ul li:hover::after, .main-nav ul li.active::after { width: 100%; }

/* ===== منطقة اللوجو والاسم ===== */
.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.logo-wrapper {
    width: 42px; height: 42px; border-radius: 50%; padding: 2px;
    background: var(--secondary); /* بوردر أحمر دائم */
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.logo-icon { width: 100%; height: 100%; background: #fff; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.logo-icon img { width: 90%; height: 90%; object-fit: cover; }

.logo-text {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: clamp(18px, 3.5vw, 24px);
    font-weight: 900;
    line-height: 1;
}
.logo-text .part1 { color: var(--secondary); } /* اطلالة - أحمر */
.logo-text .part2 { color: var(--primary); }   /* موتورز - أزرق */

/* تحسين الوضع الليلي للاسم */
[data-theme="dark"] .logo-text .part1 { color: #ff3333; text-shadow: 0 0 10px rgba(255,51,51,0.4); }
[data-theme="dark"] .logo-text .part2 { color: #3385ff; text-shadow: 0 0 10px rgba(51,133,255,0.4); }

.hamburger-icon {
    background: none; border: none; font-size: 24px; color: var(--text-primary);
    cursor: pointer; display: none;
    width: 40px; height: 40px; align-items: center; justify-content: center;
    border-radius: 8px; transition: 0.3s;
}
.hamburger-icon:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] .hamburger-icon:hover { background: rgba(255,255,255,0.1); }

/* ===== بقية العناصر ===== */
.hero-section {
    padding: 60px 20px 30px 20px; /* تقليل الحشوة العلوية والسفلية */
    background-image: url('../cars.jpeg');
    background-size: cover;
    background-position: center;
    min-height: 50vh; /* تقليل الارتفاع من 75 إلى 50 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #fff;
    width: 100%;
    text-align: center;
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
}
.hero-section * { position: relative; z-index: 2; }

.hero-section h1 {
    font-size: clamp(32px, 6vw, 56px);
    font-weight: 900;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.hero-section h1 span { color: var(--secondary); }

.hero-section p {
    font-size: clamp(16px, 2vw, 20px);
    font-weight: 500;
    max-width: 700px;
    margin-bottom: 35px;
    opacity: 0.9;
    line-height: 1.6;
}

/* ===== القائمة الجانبية ===== */
.side-menu {
    position: fixed; top: 0; right: -280px; width: 280px; height: 100vh;
    background: var(--bg-header); z-index: 1100; transition: 0.3s;
    border-left: 1px solid var(--border); display: flex; flex-direction: column;
}
.side-menu.open { right: 0; }
.side-header { padding: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
#closeSide {
    background: none; border: none; font-size: 22px; color: var(--text-primary);
    cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: 0.3s;
}
#closeSide:hover { background: rgba(0,0,0,0.05); }
[data-theme="dark"] #closeSide:hover { background: rgba(255,255,255,0.1); }

.side-nav { flex: 1; padding: 20px; }
.side-nav ul { list-style: none; }
.side-nav ul li { padding: 12px; font-weight: 700; color: var(--text-primary); cursor: pointer; display: flex; align-items: center; gap: 10px; transition: 0.3s; border-radius: 8px; }
.side-nav ul li.active { background: rgba(197, 2, 17, 0.1); color: var(--secondary); }

.side-footer { padding: 20px; border-top: 1px solid var(--border); }

.side-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1050; display: none;
}
.side-overlay.active { display: block; }

/* التحكم بظهور السويتش */
#themeSwitchSide { display: none; } /* مخفي في الديسك توب */

@media (max-width: 768px) {
    .main-nav { display: none; } /* إخفاء القائمة الرئيسية في الجوال */
    .hamburger-icon { display: flex; }
    .top-bar .logo-area { display: none; } /* إخفاء اللوجو من الهيدر في الجوال */
    .top-bar { padding: 0 10px; }
    #themeSwitch { display: none; } /* إخفاء السويتش من الهيدر في الجوال */
    #themeSwitchSide { display: block; } /* إظهاره في القائمة الجانبية */
}
/* ===== تفاصيل السيارة ===== */
.car-details-card {
    background: var(--bg-header);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}
.details-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 20px; margin-bottom: 20px;
}
.details-header h2 { color: var(--primary); font-size: 28px; }
.price-badge {
    background: var(--secondary); color: #fff;
    padding: 8px 20px; border-radius: 50px; font-weight: 800; font-size: 18px;
}
.info-row {
    display: flex; justify-content: space-between; padding: 12px 0;
    border-bottom: 1px dashed var(--border);
}
.info-row span { color: var(--text-secondary); font-weight: 600; }
.details-footer {
    margin-top: 30px; display: flex; gap: 15px;
}
.buy-btn {
    flex: 2; background: var(--primary); color: #fff; border: none;
    padding: 15px; border-radius: 12px; font-weight: 700; cursor: pointer; transition: 0.3s;
}
.back-btn {
    flex: 1; background: none; border: 1px solid var(--border);
    color: var(--text-primary); padding: 15px; border-radius: 12px;
    font-weight: 700; cursor: pointer; transition: 0.3s;
}
.buy-btn:hover { opacity: 0.9; transform: translateY(-3px); }
.back-btn:hover { background: var(--border); }
.loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    width: 100%;
}
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--border);
    border-bottom-color: var(--secondary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.loader-text {
    margin-top: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 14px;
}
