:root {
    /* Light Theme */
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --secondary: #10B981;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --surface-glass: rgba(255, 255, 255, 0.7);
    --border: rgba(226, 232, 240, 0.8);
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

[data-theme="dark"] {
    --primary: #6366F1;
    --primary-light: #818CF8;
    --secondary: #10B981;
    --background: #0F172A;
    --surface: #1E293B;
    --surface-glass: rgba(30, 41, 59, 0.7);
    --border: rgba(51, 65, 85, 0.8);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'Cairo', sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hidden {
    display: none !important;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    color: var(--primary);
}

.logo span {
    color: var(--primary);
}

.site-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle, .lang-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.lang-toggle {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    width: auto;
    padding: 0 0.5rem;
}

.theme-toggle:hover, .lang-toggle:hover {
    color: var(--primary);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.login-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero-section {
    padding: 8rem 2rem 4rem;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70vh;
    gap: 4rem;
    position: relative;
}

/* Abstract Background Shapes */
.hero-section::before, .hero-section::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    z-index: -1;
    filter: blur(80px);
}

.hero-section::before {
    width: 400px;
    height: 400px;
    background: rgba(79, 70, 229, 0.15);
    top: -100px;
    right: -100px;
}

.hero-section::after {
    width: 300px;
    height: 300px;
    background: rgba(16, 185, 129, 0.1);
    bottom: 50px;
    left: 0;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.badge {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.hero-content h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero-content h1 span {
    color: var(--primary);
}

.hero-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.search-bar:focus-within {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
    border-color: var(--primary);
}

.search-bar i {
    color: var(--text-secondary);
    margin-left: 0.8rem;
}

.search-bar input {
    border: none;
    background: transparent;
    flex: 1;
    padding: 0.8rem 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: 'Cairo', sans-serif;
    outline: none;
}

.hero-graphics {
    flex: 1;
    position: relative;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-card {
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-glass);
    position: absolute;
    font-weight: 700;
    font-size: 1.2rem;
}

.glass-card i {
    font-size: 2rem;
}

.floating-1 {
    top: 20%;
    right: 10%;
    animation: float 6s ease-in-out infinite;
}

.floating-2 {
    bottom: 20%;
    right: 30%;
    animation: float 5s ease-in-out infinite 1s;
}

.floating-3 {
    top: 40%;
    left: 10%;
    animation: float 7s ease-in-out infinite 2s;
}

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

/* Main Content */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 2rem 6rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 800;
}

.filter-pills {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.pill {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.pill:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* Grid Layouts */
.categories-grid, .courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* Category Card */
.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s ease;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.category-card:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.category-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.category-card:hover .category-icon {
    background: var(--primary);
    color: white;
    transform: scale(1.1) rotate(5deg);
}

.category-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.category-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    border-top: 1px dashed var(--border);
    padding-top: 1rem;
}

/* Course Card */
.course-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.course-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
    background: var(--border);
}

.course-content {
    padding: 1.5rem;
}

.course-level {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
    margin-bottom: 1rem;
    display: inline-block;
}

.level-beginner { background: rgba(16, 185, 129, 0.1); color: var(--secondary); }
.level-intermediate { background: rgba(245, 158, 11, 0.1); color: #F59E0B; }
.level-advanced { background: rgba(239, 68, 68, 0.1); color: #EF4444; }

.course-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.course-instructor {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.instructor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
}

.instructor-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.course-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.course-footer i {
    color: var(--primary);
    margin-left: 0.4rem;
}

.start-course-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    padding: 0.8rem;
    margin-top: 1rem;
    border-radius: 8px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.course-card:hover .start-course-btn {
    background: var(--primary);
    color: white;
}

.back-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--primary);
}

/* Footer */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 4rem 2rem 2rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand p {
    color: var(--text-secondary);
    margin-top: 1rem;
    max-width: 300px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-links h3, .footer-social h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icons a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

.footer-bottom {
    max-width: 1280px;
    margin: 0 auto;
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Auth User Nav */
.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-avatar-nav {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid var(--border);
    object-fit: cover;
}
.user-points-nav {
    font-weight: bold;
    color: #F59E0B;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Locked Courses */
.course-card.locked {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}
.course-card.locked .start-course-btn {
    background: var(--border);
    color: var(--text-secondary);
}
.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5rem;
    z-index: 5;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 16px;
}
.lock-overlay p {
    font-size: 1rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

/* Task Action Buttons */
.course-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.course-actions button {
    flex: 1;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 700;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
}
.btn-watch {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}
.btn-watch:hover {
    background: var(--primary);
    color: white;
}
.btn-task {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary);
}
.btn-task:hover {
    background: var(--secondary);
    color: white;
}
.btn-task:disabled {
    background: var(--border);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Task Modal */
.task-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}
.task-modal.hidden { display: none !important; }
.task-modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.task-question {
    margin-bottom: 1.5rem;
}
.task-question h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}
.task-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.task-option {
    background: var(--background);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.task-option:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}
.task-option.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.task-submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    margin-top: 1rem;
}
.task-submit-btn:hover { background: #059669; }

/* Profile Page */
.profile-section {
    padding: 8rem 2rem 4rem;
    max-width: 1000px;
    margin: 0 auto;
    min-height: 80vh;
}
.profile-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}
.profile-avatar-container {
    position: relative;
}
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-light);
}
.edit-avatar-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: 2px solid var(--surface);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}
.profile-info h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.profile-info p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}
.profile-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}
.stat-box {
    background: var(--background);
    padding: 1rem 2rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border);
}
.stat-box h3 {
    font-size: 2rem;
    color: var(--primary);
}
.stat-box span {
    color: var(--text-secondary);
    font-weight: 600;
}

/* Video Modal */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.video-modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 1000px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.close-modal-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

html[dir="ltr"] .close-modal-btn {
    left: auto;
    right: 1rem;
}

.close-modal-btn:hover {
    background: #EF4444;
    color: white;
}

#modal-video-title {
    padding: 1.5rem;
    padding-left: 4rem;
    border-bottom: 1px solid var(--border);
    font-size: 1.2rem;
    text-align: right;
}

html[dir="ltr"] #modal-video-title {
    text-align: left;
    padding-left: 1.5rem;
    padding-right: 4rem;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive Design */
@media (max-width: 992px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
        padding-top: 6rem;
    }
    
    .hero-content h1 {
        font-size: 3rem;
    }
    
    .hero-graphics {
        height: 300px;
        width: 100%;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-links, .lang-toggle, .login-btn {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .floating-1, .floating-2, .floating-3 {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .floating-1 i, .floating-2 i, .floating-3 i {
        font-size: 1.5rem;
    }
}

/* Mobile Menu */
.mobile-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 1rem; flex-direction: column; gap: 1rem; box-shadow: var(--shadow-md); z-index: 1000; }
.mobile-dropdown.active { display: flex; }
.mobile-dropdown a, .mobile-dropdown button { font-size: 1.1rem; padding: 0.5rem; }
@media (max-width: 768px) { .nav-actions { gap: 0.5rem; } .user-menu { margin-right: 0.5rem; } .nav-container { padding: 0.5rem 1rem; } .logo { font-size: 1.2rem; } .logo img { width: 30px; height: 30px; } }
