/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #050510;
    color: #ffffff;
    overflow-x: hidden;
}

/* إعدادات الخلفية 3D */
#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1; /* لجعل الخلفية وراء المحتوى */
}

/* تغليف المحتوى */
.content-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* الشريط العلوي */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 50px;
    background: rgba(5, 5, 16, 0.5);
    backdrop-filter: blur(10px); /* تأثير الزجاج */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
}

.logo span {
    color: #00f3ff; /* لون نيون أزرق */
    text-shadow: 0 0 10px #00f3ff;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: #e0e0e0;
    font-weight: 600;
    transition: color 0.3s;
}

nav a:hover {
    color: #00f3ff;
}

.btn-prof {
    background: linear-gradient(45deg, #7b2cbf, #00f3ff);
    padding: 10px 20px;
    border-radius: 8px;
    color: white !important;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-prof:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.7);
}

/* القسم الرئيسي (الـ Hero) */
.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 50px 20px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 15px;
    opacity: 0; /* مخفي في البداية لتشغيل حركة GSAP */
}

.hero-title span {
    color: #00f3ff;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #a0a0b0;
    max-width: 600px;
    margin-bottom: 50px;
    opacity: 0;
}

/* بطاقات المستويات الدراسية */
.levels-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.level-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    padding: 30px;
    border-radius: 15px;
    width: 300px;
    text-align: left;
    transition: transform 0.4s, border-color 0.4s;
    opacity: 0; /* للأنيميشن */
}

.level-card:hover {
    transform: translateY(-10px);
    border-color: #00f3ff;
    box-shadow: 0 10px 30px rgba(0, 243, 255, 0.1);
}

.level-card h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 10px;
}

.level-card p {
    color: #9090a0;
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.level-card button {
    background: transparent;
    border: 1px solid #00f3ff;
    color: #00f3ff;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s, color 0.3s;
}

.level-card button:hover {
    background: #00f3ff;
    color: #050510;
}
/* ==========================================
   تنسيقات صفحة المستويات الدراسية (Niveau)
   ========================================== */

.level-main {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.level-header {
    text-align: center;
    margin-bottom: 50px;
}

.back-btn {
    color: #a0a0b0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
    display: inline-block;
    margin-bottom: 20px;
}

.back-btn:hover {
    color: #00f3ff;
}

.level-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.level-title span {
    color: #7b2cbf;
    text-shadow: 0 0 15px rgba(123, 44, 191, 0.5);
}

.level-desc {
    color: #9090a0;
}

/* نظام التبويبات */
.tabs-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 12px 25px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.tab-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.5);
}

.tab-btn.active {
    background: #00f3ff;
    color: #050510;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.4);
    border-color: #00f3ff;
}

/* محتوى التبويبات والملفات */
.tab-content {
    display: none; /* إخفاء كل المحتوى افتراضياً */
}

.tab-content.active {
    display: block; /* إظهار المحتوى النشط فقط */
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.file-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s, background 0.3s;
}

.file-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.file-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.file-info {
    flex: 1;
}

.file-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.file-info p {
    font-size: 0.8rem;
    color: #9090a0;
}

.download-btn {
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 15px;
    border-radius: 6px;
    background: rgba(0, 243, 255, 0.1);
    color: #00f3ff;
    border: 1px solid #00f3ff;
    transition: all 0.3s;
}

.download-btn:hover {
    background: #00f3ff;
    color: #050510;
}

.drive-btn {
    border-color: #7b2cbf;
    color: #7b2cbf;
    background: rgba(123, 44, 191, 0.1);
}

.drive-btn:hover {
    background: #7b2cbf;
    color: #fff;
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: #a0a0b0;
    font-style: italic;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}
/* ==========================================
   فضاء الأستاذ (تسجيل الدخول ولوحة التحكم)
   ========================================== */

.prof-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    width: 100%;
}

/* صندوق تسجيل الدخول */
.auth-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    padding: 40px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-box h2, .dashboard h2 {
    font-size: 2rem;
    margin-bottom: 30px;
}

.auth-box h2 span, .dashboard h2 span {
    color: #00f3ff;
}

.auth-box form, .dash-card form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* تنسيق الحقول */
input[type="email"], input[type="password"], input[type="text"], input[type="url"], select, textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus {
    border-color: #00f3ff;
}

select option {
    background: #050510;
    color: white;
}

/* زر الإرسال */
.btn-submit {
    background: linear-gradient(45deg, #7b2cbf, #00f3ff);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    margin-top: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.5);
}

/* لوحة التحكم */
.dashboard {
    width: 100%;
    max-width: 1000px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.dash-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 15px;
}

.dash-card h3 {
    margin-bottom: 20px;
    color: #e0e0e0;
    font-size: 1.3rem;
}

/* التبديل بين الرفع والرابط */
.upload-type {
    display: flex;
    gap: 20px;
    margin: 5px 0;
}

.upload-type label {
    font-size: 0.9rem;
    color: #a0a0b0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-input {
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

/* كلاس الإخفاء */
.hidden {
    display: none !important;
}
/* ==========================================
   قسم الإعلانات في الصفحة الرئيسية
   ========================================== */
.annonces-section {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 40px auto;
    padding: 0 20px;
}

.annonces-title {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    display: inline-block;
}

.annonces-title span {
    color: #ff4757; /* لون مميز للإعلانات */
}

.annonce-card {
    background: linear-gradient(135deg, rgba(123, 44, 191, 0.1), rgba(0, 243, 255, 0.05));
    border-left: 4px solid #00f3ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.annonce-card h3 {
    color: #00f3ff;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.annonce-card p {
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.annonce-card .date {
    font-size: 0.8rem;
    color: #a0a0b0;
    margin-top: 10px;
    display: block;
    font-style: italic;
}
/* تنسيقات شريط مستوى الإعلان (Badges) */
.annonce-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.badge-niveau {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    margin-left: 10px;
}

.badge-general { background: rgba(255, 255, 255, 0.1); color: #fff; border: 1px solid rgba(255,255,255,0.3); }
.badge-1 { background: rgba(123, 44, 191, 0.2); color: #b565f5; border: 1px solid #7b2cbf; }
.badge-2 { background: rgba(0, 243, 255, 0.1); color: #00f3ff; border: 1px solid #00f3ff; }
.badge-3 { background: rgba(255, 71, 87, 0.1); color: #ff4757; border: 1px solid #ff4757; }

/* سلوك الانزلاق السلس للروابط */
html {
    scroll-behavior: smooth;
}
/* ==========================================
   قائمة إدارة وحذف الملفات (لوحة التحكم)
   ========================================== */
.doc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: background 0.3s;
}

.doc-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.doc-info-admin h4 {
    color: #00f3ff;
    font-size: 1rem;
    margin-bottom: 4px;
}

.doc-info-admin span {
    font-size: 0.8rem;
    color: #a0a0b0;
}

.btn-delete {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    border: 1px solid #ff4757;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #ff4757;
    color: white;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}
/* شاشة التحميل */
#preloader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #050510;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 9999;
}
#preloader p { margin-top: 20px; color: #00f3ff; font-weight: 600; letter-spacing: 2px; }

/* تصميم الذرة */
.atom { position: relative; width: 100px; height: 100px; }
.nucleus {
    position: absolute; top: 50%; left: 50%;
    width: 20px; height: 20px; background: #ff4757;
    border-radius: 50%; transform: translate(-50%, -50%);
    box-shadow: 0 0 15px #ff4757;
}
.electron {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border: 1px solid rgba(0, 243, 255, 0.3); border-radius: 50%;
}
.electron::before {
    content: ''; position: absolute; top: -4px; left: 50%;
    width: 8px; height: 8px; background: #00f3ff;
    border-radius: 50%; box-shadow: 0 0 10px #00f3ff;
}
/* تدوير الإلكترونات بمدارات مختلفة */
.electron:nth-child(1) { transform: rotateX(70deg) rotateY(20deg); }
.electron:nth-child(2) { transform: rotateX(70deg) rotateY(140deg); }
.electron:nth-child(3) { transform: rotateX(0deg) rotateY(0deg); }
/* ==========================================
   نظام الإشعارات المنبثقة (Toasts)
   ========================================== */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toast {
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: translateX(120%); /* مخفي خارج الشاشة يميناً */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(0); /* الدخول إلى الشاشة */
}

.toast.success {
    background: rgba(46, 213, 115, 0.15);
    border-left: 4px solid #2ed573;
}

.toast.error {
    background: rgba(255, 71, 87, 0.15);
    border-left: 4px solid #ff4757;
}

.toast-icon {
    font-size: 1.2rem;
}
/* ==========================================
   التوافق الشامل مع الهواتف الذكية (Responsive Mobile)
   ========================================== */
@media screen and (max-width: 768px) {
    /* منع الموقع من التحرك يميناً ويساراً */
    body, html {
        overflow-x: hidden !important;
        width: 100%;
    }

    /* تعديل الشريط العلوي */
    header {
        flex-direction: column;
        padding: 15px 10px !important;
        gap: 15px;
        text-align: center;
    }
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }
    .logo {
        font-size: 22px !important;
    }

    /* تصغير العناوين الضخمة إجبارياً */
    .hero {
        padding: 40px 15px !important;
    }
    .hero-title {
        font-size: 2.2rem !important; 
        line-height: 1.3 !important;
    }
    .hero-subtitle {
        font-size: 0.95rem !important;
        padding: 0 10px;
    }
    .level-title {
        font-size: 2rem !important;
    }

    /* تعديل البطاقات وشبكة الملفات */
    .levels-container {
        padding: 0 15px;
    }
    .level-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px !important;
    }
    .files-grid, .dashboard-grid {
        grid-template-columns: 1fr !important; /* عمود واحد فقط */
        gap: 15px;
    }

    /* تعديل التبويبات (Cours, Exercices...) */
    .tabs-container {
        flex-direction: column;
        padding: 0 15px;
    }
    .tab-btn {
        width: 100%;
        margin-bottom: 8px;
    }

    /* تعديل الإعلانات */
    .annonce-card {
        padding: 15px !important;
    }
    .annonce-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .badge-niveau {
        margin-left: 0 !important;
    }

    /* ==========================================
       إصلاحات فضاء الأستاذ في الهاتف
       ========================================== */
    .auth-box {
        padding: 25px 15px !important;
        width: 95% !important;
        margin: 0 auto;
    }
    .dash-card {
        padding: 20px 15px !important;
    }
    /* جعل جميع الخانات تأخذ العرض بالكامل */
    .dash-card form input, 
    .dash-card form select, 
    .dash-card form textarea {
        width: 100% !important;
    }
    /* ترتيب أزرار الاختيار (Cloudinary/Drive) عمودياً بدلاً من أفقياً */
    .upload-type {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }
    /* تعديل زر رفع الملفات */
    .file-input {
        width: 100% !important;
        font-size: 0.85rem !important;
        padding: 10px 5px !important;
    }
    .doc-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .btn-delete {
        width: 100%;
    }
}