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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background-color: #f8fafc;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

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

.login-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #1f2937;
    font-size: 1.875rem;
    font-weight: 700;
}

.login-card p {
    text-align: center;
    margin-bottom: 2rem;
    color: #6b7280;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn-primary {
    background: #2563eb;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    padding: 0.75rem 1.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-icon {
    background: #f3f4f6;
    color: #374151;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 1rem;
}

.btn-icon:hover {
    background: #e5e7eb;
}

/* Main Platform */
.main-header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 0;
}

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

.platform-title {
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 700;
}

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

.user-welcome {
    color: #6b7280;
    font-weight: 500;
}

.platform-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    padding: 1rem 2rem;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.tab-btn:hover {
    color: #2563eb;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Course Layout */
.course-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    min-height: 70vh;
}

.chapters-sidebar {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.progress-overview {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.progress-overview h3 {
    margin-bottom: 1rem;
    color: #1f2937;
    font-size: 1.125rem;
}

.progress-bar {
    background: #f3f4f6;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    background: linear-gradient(90deg, #10b981, #059669);
    height: 100%;
    transition: width 0.3s ease;
}

.progress-text {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.chapter {
    margin-bottom: 1rem;
}

.chapter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chapter-header:hover {
    background: #f3f4f6;
}

.chapter-title {
    font-weight: 600;
    color: #1f2937;
}

.chapter-progress {
    font-size: 0.75rem;
    color: #6b7280;
}

.chapter-toggle {
    background: none;
    border: none;
    font-size: 1rem;
    color: #6b7280;
    cursor: pointer;
    transition: transform 0.2s;
}

.chapter.expanded .chapter-toggle {
    transform: rotate(90deg);
}

.lessons-list {
    margin-top: 0.5rem;
    padding-left: 1rem;
    display: none;
}

.chapter.expanded .lessons-list {
    display: block;
}

.lesson-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    margin: 0.25rem 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lesson-item:hover {
    background: #f3f4f6;
}

.lesson-item.active {
    background: #dbeafe;
    color: #2563eb;
}

.lesson-status {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.75rem;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.lesson-status.completed {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.lesson-status.in-progress {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
}

.lesson-name {
    flex: 1;
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lesson-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.lesson-header h2 {
    color: #1f2937;
    font-size: 1.5rem;
}

.lesson-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#lesson-status {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

#lesson-status.not-started {
    background: #f3f4f6;
    color: #6b7280;
}

#lesson-status.in-progress {
    background: #fef3c7;
    color: #d97706;
}

#lesson-status.completed {
    background: #d1fae5;
    color: #065f46;
}

.lesson-content {
    margin-bottom: 2rem;
    min-height: 400px;
}

.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.lesson-video {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    background: #000;
}

.lesson-text {
    font-size: 1rem;
    line-height: 1.8;
    color: #374151;
}

.lesson-text h3 {
    color: #1f2937;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.lesson-text p {
    margin-bottom: 1rem;
}

.lesson-navigation {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

/* Community Layout */
.community-layout {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 70vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    color: #1f2937;
    font-size: 1.25rem;
}

.online-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.online-indicator {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
}

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

.message.own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.message-content {
    max-width: 70%;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.message-author {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.875rem;
}

.message-time {
    color: #6b7280;
    font-size: 0.75rem;
}

.message-text {
    background: #f3f4f6;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: #374151;
    font-size: 0.875rem;
}

.message.own .message-text {
    background: #2563eb;
    color: white;
}

.message-image {
    max-width: 200px;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#message-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
}

#message-input:focus {
    border-color: #2563eb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .course-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chapters-sidebar {
        order: 2;
    }
    
    .tab-navigation {
        overflow-x: auto;
    }
    
    .lesson-navigation {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .lesson-navigation button {
        width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .platform-content {
        padding: 1rem 0.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .chapters-sidebar {
        padding: 1rem;
    }
    
    .login-card {
        margin: 1rem;
    }
}