body {
    font-family: 'Cairo', Arial, sans-serif;
    background: #f7f7f7;
    margin: 0;
    padding: 0;
    direction: rtl;
    transition: all 0.3s ease;
}

/* Smooth transitions for all interactive elements */
* {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Lesson content animations */
.lesson-content {
    animation: fadeInUp 0.6s ease-out;
    transform: translateY(0);
    opacity: 1;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading animation */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    font-size: 1.1em;
    color: #205081;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Navigation button hover effects */
.nav-btn {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Syllabus modal animations */
.syllabus-modal {
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.syllabus-overlay {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.three-column-container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    background: #f5f7fa;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .three-column-container {
        flex-direction: column;
        height: auto;
    }
    
    .syllabus-sidebar {
        width: 100%;
        min-width: auto;
        order: 3;
        max-height: 300px;
        border-left: none;
        border-top: 1px solid #ececec;
    }
    
    .theory-section {
        width: 100%;
        order: 1;
        padding: 15px;
    }
    
    .coding-section {
        width: 100%;
        order: 2;
        padding: 15px;
    }
    
    .coding-section iframe {
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .syllabus-sidebar {
        padding: 15px;
    }
    
    .theory-section,
    .coding-section {
        padding: 10px;
    }
    
    .section-title {
        font-size: 1.2rem;
    }
    
    .coding-section iframe {
        min-height: 350px;
    }
}

/* Syllabus Sidebar Styles */
.syllabus-sidebar {
    width: 20%;
    background: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-left: 1px solid #ececec;
    min-width: 220px;
}

.syllabus-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.view-syllabus-btn {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    color: #2a4365;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
}

.view-syllabus-btn .back-arrow {
    margin-left: 8px;
    font-size: 1.2rem;
}

.course-nav {
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 15px;
}

.nav-section-title {
    font-weight: 600;
    color: #2a4365;
    margin-bottom: 8px;
    font-size: 1rem;
}

.nav-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: #f0f7ff;
}

.nav-item.active {
    background: #e6f0ff;
    color: #2a4365;
    font-weight: 600;
}

.nav-item.completed::after {
    content: '✓';
    color: #4CAF50;
    margin-right: 6px;
    font-weight: bold;
}

.course-progress {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.progress-text {
    font-size: 0.9rem;
    color: #2a4365;
    margin-bottom: 8px;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    background: #4CAF50;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Coding Section Styles */
.coding-section {
    width: 30%;
    background: #f9f9f9;
    padding: 20px;
    overflow-y: auto;
    min-width: 280px;
    border-left: 1px solid #ececec;
}

/* Theory Section Styles */
.theory-section {
    width: 50%;
    background: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    min-width: 320px;
}

.section-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2a4365;
    font-size: 1.4rem;
    font-weight: 600;
}

.lesson-content {
    padding-right: 10px;
}

/* Syllabus Button Styles */
.syllabus-btn {
    background: #2a4365;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 20px;
    transition: background 0.2s ease;
}

.syllabus-btn:hover {
    background: #1a365d;
}

/* Code Example Styles */
.code-block {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 15px;
    position: relative;
    margin: 20px 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.code-title {
    font-weight: 600;
    color: #2a4365;
}

.copy-btn {
    background: none;
    border: none;
    color: #4a5568;
    cursor: pointer;
    font-size: 0.8rem;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    font-size: 1.1rem;
    color: #666;
}

.loading-spinner::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2a4365;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background: #fed7d7;
    border: 1px solid #fc8181;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}

.error-message h3 {
    color: #c53030;
    margin-bottom: 10px;
}

.error-message p {
    color: #744210;
    margin-bottom: 15px;
}

.retry-btn {
    background: #c53030;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    transition: background 0.2s ease;
}

.retry-btn:hover {
    background: #9b2c2c;
}

/* Lesson Navigation */
.lesson-navigation {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-btn {
    display: flex;
    align-items: center;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px 20px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.nav-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.nav-btn.prev-btn {
    justify-content: flex-start;
}

.nav-btn.next-btn {
    justify-content: flex-end;
    margin-right: auto;
}

.nav-arrow {
    font-size: 1.2rem;
    color: #2a4365;
    margin: 0 10px;
}

.nav-text {
    display: flex;
    flex-direction: column;
    text-align: inherit;
}

.nav-text small {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 2px;
}

.nav-text span {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .nav-buttons {
        flex-direction: column;
    }
    
    .nav-btn {
        min-width: auto;
        max-width: none;
    }
    
    .nav-btn.next-btn {
        margin-right: 0;
    }
}

.copy-msg {
    color: #48bb78;
    font-size: 0.8rem;
    margin-right: 5px;
    display: none;
}

pre {
    margin: 0;
    overflow-x: auto;
}

code {
    font-family: monospace;
    white-space: pre;
}

/* Collapsible Sidebar Styles */
.syllabus-sidebar.collapsed {
    width: 60px;
    min-width: 60px;
    overflow: hidden;
}

.syllabus-sidebar.collapsed .course-nav,
.syllabus-sidebar.collapsed .course-progress,
.syllabus-sidebar.collapsed .view-syllabus-btn span:not(.back-arrow) {
    display: none;
}

.syllabus-sidebar.collapsed .view-syllabus-btn {
    justify-content: center;
    padding: 8px 0;
}

.syllabus-sidebar.collapsed .syllabus-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.notebook-embed {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.07);
    padding: 24px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Enhanced Responsive Styles */
@media (max-width: 1400px) {
    .syllabus-sidebar {
        width: 20%;
    }
    
    .coding-section {
        width: 45%;
    }
    
    .theory-section {
        width: 35%;
    }
}

@media (max-width: 1200px) {
    .syllabus-sidebar {
        width: 25%;
    }
    
    .coding-section {
        width: 40%;
    }
    
    .theory-section {
        width: 35%;
    }
}

@media (max-width: 900px) {
    .three-column-container {
        flex-direction: column;
        height: auto;
    }
    
    .syllabus-sidebar,
    .coding-section,
    .theory-section {
        width: 100%;
        min-width: 0;
        min-height: auto;
    }
    
    .syllabus-sidebar {
        order: 1;
        flex-direction: row;
        align-items: center;
        padding: 15px;
        border-left: none;
        border-bottom: 1px solid #ececec;
    }
    
    .syllabus-sidebar.collapsed {
        width: 100%;
        min-width: 0;
    }
    
    .syllabus-header {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
        margin-left: 15px;
    }
    
    .course-nav {
        display: none;
    }
    
    .course-progress {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        margin-right: auto;
        display: flex;
        align-items: center;
    }
    
    .progress-text {
        margin-bottom: 0;
        margin-left: 10px;
    }
    
    .progress-bar {
        width: 100px;
    }
    
    .coding-section {
        order: 2;
    }
    
    .theory-section {
        order: 3;
    }
    
    .coding-section iframe {
        height: 400px;
    }
}

@media (max-width: 600px) {
    .syllabus-sidebar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .syllabus-header {
        margin-bottom: 10px;
        margin-left: 0;
    }
    
    .course-progress {
        margin-top: 10px;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .progress-text {
        margin-bottom: 5px;
        margin-left: 0;
    }
    
    .progress-bar {
        width: 100%;
    }
    
    .coding-section iframe {
        height: 300px;
    }
}
