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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --science-green: #27ae60;
    --science-purple: #9b59b6;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --white: #ffffff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-bg);
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* شريط التقدم */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--science-green), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

/* الهيدر المحسن مع شعار أصغر */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--science-purple));
    color: var(--white);
    padding: 1.5rem 0;
    text-align: center;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.logo-section {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.school-logo, .teacher-photo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid var(--white);
    object-fit: cover;
}

.header-text {
    flex: 1;
    min-width: 200px;
}

.logo {
    font-size: 2rem;
    margin-bottom: 0.3rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.8rem;
}

.youtube-badge .youtube-btn {
    background: #ff0000;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.youtube-badge .youtube-btn:hover {
    background: #cc0000;
    transform: scale(1.05);
}

/* القائمة المحسنة */
.navbar {
    background-color: var(--white);
    padding: 0.8rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.navbar a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 0.9rem;
}

.navbar a:hover {
    background-color: var(--secondary-color);
    color: var(--white);
}

/* زر القائمة للجوال */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
    padding: 0.5rem;
}

/* الأقسام المحسنة */
.section {
    background: var(--white);
    margin: 1.5rem 0;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
}

.section h2 {
    color: var(--primary-color);
    margin-bottom: 1.2rem;
    font-size: 1.6rem;
    text-align: center;
    border-bottom: 2px solid var(--science-green);
    padding-bottom: 0.5rem;
}

/* البطاقات المحسنة */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.card {
    background: var(--light-bg);
    padding: 1.2rem;
    border-radius: 10px;
    border-left: 3px solid var(--secondary-color);
    transition: all 0.3s ease;
    text-align: center;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.lesson-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 0.8rem;
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* التجارب الافتراضية */
.experiments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.experiment-card {
    background: linear-gradient(135deg, var(--light-bg), #e8f4f8);
    padding: 1.5rem 0.8rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.experiment-card:hover {
    border-color: var(--science-green);
    transform: scale(1.03);
}

.experiment-icon {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
}

.experiment-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* الاختبارات والتقييم */
.exams-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.quiz-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--light-bg);
    padding: 0.8rem;
    margin: 0.4rem 0;
    border-radius: 6px;
}

.progress-circle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: conic-gradient(var(--science-green) 0% 65%, #ddd 65% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    font-weight: bold;
    font-size: 0.8rem;
}

.results-chart {
    height: 180px;
    background: var(--light-bg);
    border-radius: 6px;
    padding: 0.8rem;
}

/* أخبار العلوم - البطاقات المصغرة */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.news-item {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    border-right: 3px solid var(--science-purple);
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.news-item:hover {
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.news-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.8rem;
}

.news-item h4 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1rem;
    flex: 1;
    line-height: 1.3;
}

.news-date {
    color: var(--accent-color);
    font-size: 0.8rem;
    background: rgba(231, 76, 60, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
}

.news-item p {
    color: var(--text-color);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-read-more {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: inline-block;
    transition: all 0.3s ease;
}

.news-read-more:hover {
    color: var(--primary-color);
    transform: translateX(3px);
}

/* بديل: تصميم شبكي للأخبار */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.news-grid-item {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    border-top: 3px solid var(--science-purple);
    transition: all 0.3s ease;
    text-align: center;
}

.news-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.news-icon {
    font-size: 1.5rem;
    color: var(--science-purple);
    margin-bottom: 0.5rem;
}

.news-grid-item h4 {
    color: var(--primary-color);
    margin: 0.5rem 0;
    font-size: 1rem;
    line-height: 1.3;
}

.news-grid-item p {
    color: var(--text-color);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* قسم اليوتيوب */
.youtube-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: center;
}

.channel-info {
    text-align: center;
}

.youtube-subscribe {
    background: #ff0000;
    color: white;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
}

.youtube-subscribe:hover {
    background: #cc0000;
}

.video-thumbnail {
    width: 100%;
    height: 160px;
    background: #ddd;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* التواصل */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.social-btn {
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.social-btn.youtube { background: #ff0000; }
.social-btn.facebook { background: #1877f2; }
.social-btn.instagram { background: #e4405f; }

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* الأزرار المحسنة */
.btn {
    display: inline-block;
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    text-decoration: none;
    margin-top: 0.4rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

/* الفوتر المحسن */
.footer {
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 1.2rem 0;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

/* تحسينات إضافية للتناسق */
.card, .experiment-card, .news-grid-item {
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

/* التجاوب للجوال - محسن */
@media (max-width: 768px) {
    .navbar {
        position: relative;
        padding: 0.5rem 0;
    }
    
    .navbar .container {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .navbar.active .container {
        max-height: 500px;
    }
    
    .navbar a {
        display: block;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        text-align: center;
    }
    
    .navbar a:last-child {
        border-bottom: none;
    }
    
    .menu-toggle {
        display: block;
        position: absolute;
        left: 20px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .cards, .experiments-grid {
        grid-template-columns: 1fr;
    }
    
    .exams-container, .youtube-section, .contact-grid {
        grid-template-columns: 1fr;
    }
    
    .section {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .logo {
        font-size: 1.7rem;
    }
    
    .school-logo, .teacher-photo {
        width: 60px;
        height: 60px;
    }
    
    .header {
        padding: 1.2rem 0;
    }
    
    .news-item {
        padding: 0.8rem;
    }
    
    .news-item-header {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .news-date {
        align-self: flex-start;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
    }
    
    .card, .experiment-card, .news-grid-item {
        min-height: 160px;
    }
    
    body {
        padding-top: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        padding: 1rem 0;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .school-logo, .teacher-photo {
        width: 50px;
        height: 50px;
    }
    
    .section h2 {
        font-size: 1.4rem;
    }
    
    .cards {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 1rem;
    }
    
    .lesson-image {
        height: 150px;
    }
    
    .news-item {
        padding: 0.7rem;
    }
    
    .news-item h4 {
        font-size: 0.95rem;
    }
    
    .news-item p {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
}