/* متغيرات التصميم */
:root {
    --primary: #4361ee;
    --primary-light: #6a7dee;
    --secondary: #3a0ca3;
    --accent: #f72585;
    --accent-light: #ff70a6;
    --dark: #1a1a2e;
    --dark-light: #2a2a42;
    --light: #f8f9fa;
    --light-dark: #e9ecef;
    --text-dark: #2b2d42;
    --text-light: #edf2f4;
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.2);
}

/* التنسيقات الأساسية */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--light);
    color: var(--text-dark);
    transition: background 0.5s ease, color 0.5s ease;
    padding-top: 80px; /* لمنع اختفاء المحتوى خلف الهيدر الثابت */
}

body.dark-mode {
    background-color: var(--dark);
    color: var(--text-light);
}

/* الهيكل العام للهيدر */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    height: 80px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
}

.dark-mode .main-header {
    background-color: rgba(26, 26, 46, 0.98);
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.header-section {
    display: flex;
    align-items: center;
    height: 100%;
    flex: 1;
}

/* أزرار المستخدم */
.user-actions {
    justify-content: flex-start;
    gap: 1rem;
}

.auth-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 45px;
    padding: 0 1.8rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    overflow: hidden;
    transition: var(--transition);
    z-index: 1;
}

.login-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: var(--shadow-sm);
}

.signup-btn {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
    position: relative;
}

.btn-icon {
    transition: var(--transition);
    font-size: 0.9rem;
}

.btn-hover-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    transition: var(--transition);
    z-index: -1;
    border-radius: 30px;
}

.login-btn .btn-hover-effect {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.signup-btn .btn-hover-effect {
    background: var(--primary);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.auth-btn:hover .btn-hover-effect {
    left: 0;
}

.signup-btn:hover {
    color: white;
    border-color: transparent;
}

.auth-btn:hover .btn-icon {
    transform: translateX(3px) rotate(10deg);
}

/* الشعار المركزي */
.logo-container {
    justify-content: center;
}

.dynamic-logo {
    display: flex;
    align-items: center;
    font-size: 2.4rem;
    font-weight: 900;
    cursor: pointer;
    position: relative;
    padding: 0 1rem;
    height: 100%;
}

.logo-part {
    display: inline-block;
    transition: var(--transition);
    position: relative;
    z-index: 2;
    line-height: 1;
}

.logo-m {
    color: var(--primary);
    animation: float 4s ease-in-out infinite;
}

.logo-dot {
    color: var(--accent);
    margin: 0 2px;
    animation: pulse 2.5s infinite;
}

.logo-h {
    color: var(--primary);
    animation: bounce 3s ease infinite;
}

.logo-a {
    color: var(--accent);
    animation: colorShift 5s infinite;
}

.logo-s {
    color: var(--secondary);
    animation: wave 3.5s ease infinite;
}

.logo-n {
    color: var(--primary);
    animation: glow 2.5s ease infinite;
}

.logo-glowing-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(67, 97, 238, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: var(--transition);
    border-radius: 50%;
    pointer-events: none;
}

.dynamic-logo:hover .logo-glowing-effect {
    opacity: 1;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes colorShift {
    0%, 100% { color: var(--accent); }
    50% { color: var(--accent-light); }
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(8deg); }
    75% { transform: rotate(-8deg); }
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 5px var(--primary); }
    50% { text-shadow: 0 0 15px var(--primary); }
}

/* التعديلات على قائمة التنقل */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 0.2rem; /* تقليل المسافة بين العناصر */
    height: 100%;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem; /* تقليل الحشو الداخلي */
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem; /* تصغير حجم الخط قليلاً */
    text-decoration: none;
    color: var(--text-dark);
    transition: var(--transition);
    overflow: hidden;
    height: auto; /* إزالة الارتفاع الثابت */
    min-height: 45px; /* ارتفاع أدنى للحفاظ على التصميم */
    white-space: nowrap; /* منع التفاف النص */
    z-index: 1;
}

.dark-mode .nav-link {
    color: var(--text-light);
}

.nav-icon {
    margin-left: 5px; /* تقليل المسافة بين النص والأيقونة */
    transition: var(--transition);
    font-size: 0.9rem; /* تصغير حجم الأيقونة */
}

.nav-hover-effect {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    transition: var(--transition);
    z-index: -1;
    border-radius: 8px;
}

.nav-link[data-text="عن المنصة"] .nav-hover-effect {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(67, 97, 238, 0.2));
}

.nav-link[data-text="الكورسات"] .nav-hover-effect {
    background: linear-gradient(135deg, rgba(58, 12, 163, 0.1), rgba(58, 12, 163, 0.2));
}

.nav-link[data-text="المعمل الافتراضي"] .nav-hover-effect {
    background: linear-gradient(135deg, rgba(247, 37, 133, 0.1), rgba(247, 37, 133, 0.2));
}

.nav-link[data-text="اختبارات الذكاء"] .nav-hover-effect {
    background: linear-gradient(135deg, rgba(255, 112, 166, 0.1), rgba(255, 112, 166, 0.2));
}

.nav-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.nav-link:hover .nav-hover-effect {
    left: 0;
}

.nav-link:hover .nav-icon {
    transform: scale(1.1) rotate(10deg); /* تخفيف تأثير الدوران */
}

.nav-link[data-text="عن المنصة"]:hover {
    color: var(--primary);
}

.nav-link[data-text="الكورسات"]:hover {
    color: var(--secondary);
}

.nav-link[data-text="المعمل الافتراضي"]:hover {
    color: var(--accent);
}

.nav-link[data-text="اختبارات الذكاء"]:hover {
    color: var(--accent-light);
}

/* زر تبديل الوضع - معدل بحجم أكبر */
.mode-switch-container {
    margin-left: 8px; /* تقليل المساحة الجانبية */
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1000;
}

.mode-switch {
    position: relative;
    width: 70px;
    height: 35px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    overflow: visible;
}

.mode-switch-track {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 17.5px;
    transition: all 0.5s ease;
    overflow: hidden;
}

.dark-mode .mode-switch-track {
    background: linear-gradient(135deg, #0f2027, #203a43);
}

/* تصميم الهلال - معدل بحجم أكبر */
.moon-crescent {
    position: absolute;
    top: 3.5px;
    right: 3.5px;
    width: 28px;
    height: 28px;
    background: #f5f7fa;
    border-radius: 50%;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.moon-mask {
    position: absolute;
    top: -3.5px;
    left: 7px;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    transition: all 0.5s ease;
}

.dark-mode .moon-mask {
    background: linear-gradient(135deg, #0f2027, #203a43);
    left: -7px;
}

.moon-crescent i {
    color: #ffd700;
    font-size: 14px;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

/* تصميم الشمس - معدل بحجم أكبر */
.sun-center {
    position: absolute;
    top: 3.5px;
    left: 3.5px;
    width: 28px;
    height: 28px;
    background: #ffd700;
    border-radius: 50%;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sun-center i {
    color: #ff6b00;
    font-size: 14px;
    transition: all 0.3s ease;
}

.sun-rays {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.ray {
    position: absolute;
    background: #ffd700;
    width: 3px;
    height: 10px;
    top: -5px;
    left: 13px;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* تأثيرات الحركة المعدلة */
.dark-mode .moon-crescent {
    transform: translateX(-35px);
}

.dark-mode .sun-center {
    transform: translateX(35px);
    opacity: 0;
}

/* تأثير دوران الشمس */
.mode-switch:hover .sun-center i {
    animation: rotateSun 5s linear infinite;
}

@keyframes rotateSun {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}