:root {
    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --secondary: #f43f5e;
    --dark: #0f172a;
    --light: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 15px 25px rgba(0, 0, 0, 0.15), 0 5px 10px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --code-bg: #1e293b;
    --code-text: #f1f5f9;
    --code-comment: #94a3b8;
    --code-tag: #f87171;
    --code-attribute: #60a5fa;
    --code-string: #34d399;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: var(--light);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40vh;
    background: var(--primary-gradient);
    z-index: -1;
    border-radius: 0 0 20px 20px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --light: #0f172a;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --card-bg: rgba(15, 23, 42, 0.8);
    }
    
    body::before {
        opacity: 0.9;
    }
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    padding: 0.8rem 0;
    transition: var(--transition);
}

@media (prefers-color-scheme: dark) {
    .navbar {
        background: rgba(15, 23, 42, 0.8) !important;
    }
}

.navbar-brand {
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
}

.nav-link {
    font-weight: 500;
    color: var(--text-primary) !important;
    position: relative;
    padding: 0.5rem 1rem !important;
    margin: 0 0.2rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.1);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 70%;
}

/* Main Content */
.container {
    max-width: 1200px;
}

.mt-5 {
    margin-top: 3rem !important;
}

.content-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition);
}

h1 {
    font-weight: 800;
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-weight: 700;
    font-size: 1.8rem;
    margin: 2rem 0 1.2rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 0.5rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: var(--primary-gradient);
}

p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Code Editor */
.editor-container {
    position: relative;
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.editor-header {
    background: var(--code-bg);
    color: white;
    padding: 0.8rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.editor-header span {
    font-size: 0.9rem;
    font-weight: 500;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.editor-actions button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.editor-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
}

#codeEditor {
    width: 100%;
    min-height: 250px;
    background: var(--code-bg);
    color: var(--code-text);
    font-family: 'Fira Code', 'Monaco', 'Cascadia Code', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 1.2rem;
    border: none;
    resize: vertical;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    tab-size: 4;
    -moz-tab-size: 4;
}

#codeEditor:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary);
}

/* Preview Section */
.preview-container {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.preview-header {
    background: var(--primary-gradient);
    color: white;
    padding: 0.8rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header span {
    font-size: 0.9rem;
    font-weight: 500;
}

#preview {
    background: white;
    min-height: 200px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

@media (prefers-color-scheme: dark) {
    #preview {
        background: #1e293b;
        border-color: #334155;
    }
}

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    border-radius: 10px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Feedback Section */
#feedback {
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    transition: var(--transition);
}

.feedback-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: rgb(16, 185, 129);
}

.feedback-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: rgb(239, 68, 68);
}

.feedback-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: rgb(59, 130, 246);
}

/* Lesson Navigation */
.lesson-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    .lesson-navigation {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Syntax Highlighting (basic) */
.tag { color: var(--code-tag); }
.attribute { color: var(--code-attribute); }
.string { color: var(--code-string); }
.comment { color: var(--code-comment); font-style: italic; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-card {
    animation: fadeIn 0.6s ease-out;
}

h1 { animation: fadeIn 0.6s ease-out 0.1s both; }
p { animation: fadeIn 0.6s ease-out 0.2s both; }
h2 { animation: fadeIn 0.6s ease-out 0.3s both; }
.editor-container { animation: fadeIn 0.6s ease-out 0.4s both; }
.preview-container { animation: fadeIn 0.6s ease-out 0.5s both; }

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.6rem;
    }
    
    .content-card {
        padding: 1.5rem;
    }
    
    body::before {
        height: 30vh;
    }
    
    .lesson-navigation {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Additional styles for other pages */
/* Progress Section (for lessons.php) */
.progress-section {
    margin-bottom: 2.5rem;
}

.progress-container {
    background: rgba(99, 102, 241, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
}

.progress-text {
    font-weight: 600;
    margin-right: 1.5rem;
    min-width: 120px;
    color: var(--text-primary);
}

.progress-bar-container {
    flex-grow: 1;
    height: 12px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(500%); }
}

.progress-percent {
    font-weight: 700;
    margin-left: 1.5rem;
    font-size: 1.2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Lessons List (for lessons.php) */
.lessons-list {
    list-style: none;
    padding: 0;
}

.lesson-item {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm);
}

@media (prefers-color-scheme: dark) {
    .lesson-item {
        background: rgba(15, 23, 42, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

.lesson-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.lesson-link {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.lesson-link:hover {
    color: var(--primary);
}

.lesson-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.2rem;
    flex-shrink: 0;
    transition: var(--transition);
}

.lesson-item:hover .lesson-icon {
    background: var(--primary-gradient);
    transform: scale(1.1);
}

.lesson-icon i {
    color: var(--primary);
    font-size: 1.2rem;
    transition: var(--transition);
}

.lesson-item:hover .lesson-icon i {
    color: white;
}

.lesson-content {
    flex-grow: 1;
}

.lesson-title {
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.lesson-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lesson-status {
    margin-left: 1rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-completed {
    background: rgba(16, 185, 129, 0.1);
    color: rgb(16, 185, 129);
}

.status-current {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.status-upcoming {
    background: rgba(107, 114, 128, 0.1);
    color: rgb(107, 114, 128);
}

/* Homepage specific styles (for index.php) */
ul {
    list-style: none;
    padding: 0;
    margin-bottom: 2.5rem;
}

ul li {
    padding: 0.8rem 0;
    padding-left: 2rem;
    position: relative;
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: var(--transition);
}

ul li:hover {
    color: var(--primary);
    transform: translateX(5px);
}

ul li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-size: 1.2rem;
}