/* ===== ملف التصميم الكامل والموحد (style.css) ===== */

/* 1. المتغيرات والألوان */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #f59e0b;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f1f5f9;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

/* 2. إعدادات عامة */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8fafc; /* خلفية أفتح قليلاً للعين */
    color: var(--dark);
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; display: block; border-radius: var(--radius); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px 40px; width: 100%; }

/* 3. الهيدر */
header { background: var(--white); box-shadow: var(--shadow); padding: 0.7rem 0; position: sticky; top: 0; z-index: 1000; }
.navbar { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { font-weight: 600; font-size: 0.95rem; color: var(--dark); }
.nav-links a:hover { color: var(--primary); }
.btn-nav { background: var(--primary); color: var(--white) !important; padding: 8px 16px; border-radius: 50px; }
.btn-nav:hover { background: var(--primary-dark); }

/* 4. البطاقات والشبكة العامة */
.grid-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 30px; }
.card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.3s ease; display: flex; flex-direction: column; border: 1px solid #e2e8f0; }
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.card-body { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }

/* 5. النماذج والأزرار */
.form-control { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; margin-bottom: 15px; font-family: inherit; }
.form-control:focus { outline: 2px solid var(--primary); border-color: transparent; }
.btn-primary { background: var(--primary); color: white; padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; transition: 0.3s; text-align: center; display: inline-block; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #ef4444; color: white; padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.9rem; }
.alert { padding: 15px; margin-bottom: 20px; border-radius: 8px; }
.alert-success { background-color: #dcfce7; color: #166534; }
.alert-danger { background-color: #fee2e2; color: #991b1b; }

/* 6. الجداول */
.table-container { overflow-x: auto; }
.styled-table { width: 100%; border-collapse: collapse; margin: 25px 0; background-color: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.styled-table th { background-color: #f8fafc; color: var(--dark); font-weight: 800; padding: 12px 15px; text-align: right; }
.styled-table td { padding: 12px 15px; border-bottom: 1px solid #dddddd; }
.styled-table tbody tr:hover { background-color: #f1f5f9; }

/* =========================================
   🎓 تنسيقات الأكاديمية (الجديدة)
   ========================================= */

/* كرت الدورة */
.course-card { height: 100%; }
.course-thumb { height: 180px; position: relative; overflow: hidden; background: #e0e7ff; }
.course-thumb img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.course-card:hover .course-thumb img { transform: scale(1.05); }
.course-level { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.7); color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; backdrop-filter: blur(4px); }
.course-meta { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--gray); margin-bottom: 15px; border-bottom: 1px solid #f1f5f9; padding-bottom: 10px; }
.course-price { font-size: 1.1rem; font-weight: 800; color: var(--primary); }

/* صفحة مشاهدة الدورة */
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

.lesson-sidebar { position: sticky; top: 90px; max-height: calc(100vh - 120px); overflow-y: auto; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #e2e8f0; }
.lesson-sidebar-header { background: var(--primary); color: white; padding: 15px; font-weight: bold; position: sticky; top: 0; }
.lesson-item { display: flex; align-items: center; gap: 10px; padding: 15px; border-bottom: 1px solid #f1f5f9; transition: 0.2s; color: var(--dark); }
.lesson-item:hover { background: #f8fafc; color: var(--primary); }
.lesson-item.active { background: #eff6ff; border-right: 4px solid var(--primary); font-weight: bold; color: var(--primary-dark); }
.lesson-icon { font-size: 1.2rem; min-width: 30px; text-align: center; }

/* الامتحانات */
.quiz-container { background: #fff; padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #e2e8f0; }
.question-box { background: #f8fafc; padding: 20px; border-radius: 10px; border: 1px solid #e2e8f0; margin-bottom: 20px; }
.question-title { font-weight: 700; margin-bottom: 15px; color: var(--dark); font-size: 1.1rem; }
.option-label { display: flex; align-items: center; gap: 10px; padding: 10px; cursor: pointer; transition: 0.2s; border-radius: 6px; }
.option-label:hover { background: #e2e8f0; }
.result-box { text-align: center; padding: 40px; border-radius: var(--radius); margin-top: 20px; }
.result-success { background: #dcfce7; border: 1px solid #bbf7d0; }
.result-fail { background: #fee2e2; border: 1px solid #fecaca; }

/* لوحة التحكم والإحصائيات */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card { background: var(--white); padding: 25px; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; border: 1px solid #f1f5f9; }
.stat-info h3 { font-size: 2rem; margin: 0; color: var(--primary); line-height: 1; }
.stat-info p { margin: 5px 0 0; color: var(--gray); font-size: 0.95rem; }
.stat-icon { font-size: 2.5rem; opacity: 0.8; background: #eff6ff; width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }

/* الشارات (Badges) */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; display: inline-block; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* النوافذ المنبثقة (Modals) */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; backdrop-filter: blur(3px); animation: fadeIn 0.3s; }
.modal-content { background: white; max-width: 500px; margin: 50px auto; padding: 30px; border-radius: 16px; position: relative; box-shadow: var(--shadow-lg); animation: slideUp 0.3s; }
.close-modal { position: absolute; top: 20px; left: 20px; cursor: pointer; font-size: 1.5rem; color: var(--gray); transition: 0.2s; }
.close-modal:hover { color: var(--danger); transform: rotate(90deg); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* استجابة الموبايل */
@media (max-width: 768px) {
    .nav-links { display: none; } /* يفضل إضافة زر قائمة للجوال */
    .grid-academy { grid-template-columns: 1fr; }
    .lesson-sidebar { position: static; max-height: none; margin-top: 30px; }
}

/* ===== ملف التصميم الكامل والموحد (style.css) ===== */

/* 1. المتغيرات والألوان */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #f59e0b;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f1f5f9;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

/* 2. إعدادات عامة */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
img { max-width: 100%; display: block; border-radius: var(--radius); }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px 40px; width: 100%; }

/* 3. الهيدر (القائمة العلوية) */
header {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 0.7rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark);
}
.nav-links a:hover { color: var(--primary); }
.btn-nav {
    background: var(--primary);
    color: var(--white) !important;
    padding: 8px 16px;
    border-radius: 50px;
}
.btn-nav:hover { background: var(--primary-dark); }

/* 4. القسم الترحيبي (Hero Section) */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
    color: white;
    text-align: center;
    padding: 60px 20px;
    margin-bottom: 40px;
    border-radius: var(--radius);
}
.hero h1 { font-size: 2.5rem; margin-bottom: 10px; }
.hero p { font-size: 1.1rem; opacity: 0.9; max-width: 600px; margin: 0 auto 20px; }

/* مربع البحث */
.search-box {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}
.search-box input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border-radius: 50px;
    border: none;
    outline: none;
    font-size: 1rem;
    box-shadow: var(--shadow-lg);
}
.search-box button {
    position: absolute;
    right: 5px;
    top: 5px;
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 5. تنسيق المقالات (Cards) - للصفحات العامة */
.section-title { margin-bottom: 20px; font-size: 1.5rem; border-right: 5px solid var(--accent); padding-right: 15px; margin-top: 0; }
.grid-posts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}
.card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.card-img { height: 200px; object-fit: cover; width: 100%; }
.card-body { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.card-meta { font-size: 0.8rem; color: var(--gray); margin-bottom: 10px; display: flex; gap: 10px; }
.card-title { font-size: 1.25rem; margin-bottom: 10px; font-weight: 700; line-height: 1.4; }
.card-excerpt { color: var(--gray); font-size: 0.95rem; margin-bottom: 20px; flex-grow: 1; }
.btn-read {
    color: var(--primary);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
}

/* 6. صفحة المقال الكامل */
.single-post { background: var(--white); padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.post-header { text-align: center; margin-bottom: 30px; }
.post-header h1 { font-size: 2.5rem; margin-bottom: 15px; }
.full-img { max-height: 500px; width: 100%; object-fit: cover; margin-bottom: 30px; }
.post-content { font-size: 1.1rem; line-height: 1.8; color: #334155; }
.post-content img { margin: 20px auto; } 

/* 7. التعليقات والنماذج */
.comments-area { margin-top: 50px; background: var(--white); padding: 30px; border-radius: var(--radius); }
.comment-item { border-bottom: 1px solid #e2e8f0; padding: 20px 0; }
.form-control {
    width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; margin-bottom: 15px;
    font-family: inherit;
}
.form-control:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* 8. الأزرار */
.btn-primary {
    background: var(--primary); color: white; padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem;
    transition: background 0.3s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-danger {
    background: #ef4444; color: white; padding: 6px 12px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.85rem;
}
.btn-edit {
    background: var(--accent); color: white; padding: 6px 12px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.85rem; margin-left: 5px;
}

/* 9. تنسيق الجداول */
.table-container { overflow-x: auto; }
.styled-table {
    width: 100%; border-collapse: collapse; margin: 25px 0; font-size: 0.95rem;
    background-color: var(--white); border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden; box-shadow: var(--shadow);
}
.styled-table thead tr { background-color: var(--primary); color: #ffffff; text-align: right; font-weight: bold; }
.styled-table th, .styled-table td { padding: 12px 15px; border-bottom: 1px solid #dddddd; }
.styled-table tbody tr:last-of-type { border-bottom: 2px solid var(--primary); }
.styled-table tbody tr:hover { background-color: #f3f4f6; }

/* 10. صفحات الدخول والتسجيل (Auth) */
.auth-wrapper {
    min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
    background: var(--white); padding: 40px; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; text-align: center;
}
.auth-card h2 { color: var(--primary); margin-bottom: 20px; }
.auth-card .form-control { background: #f8fafc; }

/* 11. صفحة الملف الشخصي (Profile Page) - هذا الجزء هو المهم لصفحتك الحالية */
.profile-header {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 30px;
    text-align: center;
    padding: 40px 20px;
    position: relative;
    border-top: 5px solid var(--primary);
}
.profile-avatar-container {
    width: 130px;
    height: 130px;
    margin: 0 auto 20px;
    position: relative;
    border-radius: 50%;
    border: 5px solid var(--light);
    box-shadow: var(--shadow-lg);
    background: var(--white);
}
.profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.profile-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 5px;
}
.profile-email {
    color: var(--gray);
    font-size: 1rem;
    margin-bottom: 25px;
    display: inline-block;
    background: var(--light);
    padding: 5px 15px;
    border-radius: 20px;
}
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
    padding-top: 25px;
    border-top: 1px solid #e2e8f0;
}
.stat-item {
    text-align: center;
    min-width: 80px;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
    line-height: 1.2;
}
.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 500;
}
.profile-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
}
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}
.profile-sidebar-card {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.profile-info-list li {
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}
.profile-info-list li:last-child { border-bottom: none; }
.profile-info-label { font-weight: 600; color: var(--dark); }
.profile-info-value { color: var(--gray); }

/* 12. التذييل والتنبيهات */
footer {
    text-align: center; padding: 30px 0; margin-top: auto; color: var(--gray); border-top: 1px solid #e2e8f0; background: var(--white);
}
.alert { padding: 15px; margin-bottom: 20px; border-radius: 8px; }
.alert-danger { background-color: #fee2e2; color: #991b1b; }
.alert-success { background-color: #dcfce7; color: #166534; }
.alert-info { background-color: #e0f2fe; color: #075985; }

/* 13. إضافات خاصة للصفحة الرئيسية (Strip Layout) */
.home-posts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.post-strip {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 15px;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
    border: 1px solid transparent;
}
.post-strip:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.post-strip-img-container {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-left: 20px;
    flex-shrink: 0;
    background-color: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
}
.post-strip-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.post-strip-icon {
    font-size: 24px;
    color: var(--gray);
    opacity: 0.5;
}
.post-strip-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.post-strip-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}
.post-strip-meta {
    font-size: 0.85rem;
    color: var(--gray);
    display: flex;
    gap: 15px;
}
.post-strip-btn {
    width: 40px;
    height: 40px;
    background: var(--light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    transition: 0.3s;
    margin-right: 15px;
}
.post-strip:hover .post-strip-btn {
    background: var(--primary);
    color: var(--white);
}

/* 14. ودجت الطقس وترقيم الصفحات */
.weather-widget {
    margin-top: 40px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 40px;
}
.page-num {
    padding: 8px 12px;
    background: var(--white);
    border-radius: 6px;
    color: var(--dark);
    font-weight: 600;
    box-shadow: var(--shadow);
}
.page-num.active {
    background: var(--primary);
    color: var(--white);
}

/* 15. استجابة الموبايل */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero h1 { font-size: 1.8rem; }
    .auth-card { padding: 20px; }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-stats { gap: 20px; }
}

@media (max-width: 600px) {
    .post-strip {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    .post-strip-img-container {
        margin-left: 0;
        margin-bottom: 15px;
        width: 100%;
        height: 150px;
    }
    .post-strip-meta { justify-content: center; }
    .post-strip-btn { display: none; }
}