/* LMS Portal Styles */

:root {
    --lms-primary: #2563eb;
    --lms-primary-dark: #1d4ed8;
    --lms-secondary: #7c3aed;
    --lms-success: #059669;
    --lms-warning: #d97706;
    --lms-danger: #dc2626;
    --lms-info: #0891b2;
    
    --lms-gray-50: #f8fafc;
    --lms-gray-100: #f1f5f9;
    --lms-gray-200: #e2e8f0;
    --lms-gray-300: #cbd5e1;
    --lms-gray-400: #94a3b8;
    --lms-gray-500: #64748b;
    --lms-gray-600: #475569;
    --lms-gray-700: #334155;
    --lms-gray-800: #1e293b;
    --lms-gray-900: #0f172a;
    
    --lms-sidebar-width: 280px;
    --lms-sidebar-collapsed: 60px;
    --lms-header-height: 70px;
    
    --lms-border-radius: 8px;
    --lms-border-radius-lg: 12px;
    --lms-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --lms-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --lms-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* LMS Container Layout */
.lms-container {
    display: flex;
    min-height: 100vh;
    background: var(--lms-gray-50);
    margin-top: var(--lms-header-height);
}

/* Sidebar Styles */
.lms-sidebar {
    width: var(--lms-sidebar-width);
    background: white;
    border-right: 1px solid var(--lms-gray-200);
    box-shadow: var(--lms-shadow);
    position: fixed;
    top: var(--lms-header-height);
    left: 0;
    height: calc(100vh - var(--lms-header-height));
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 100;
    padding-bottom: 4rem; /* Add more padding at bottom for better scrolling */
}

.lms-sidebar.collapsed {
    width: var(--lms-sidebar-collapsed);
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--lms-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--lms-gray-800);
    margin: 0;
}

.sidebar-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-toggle span {
    width: 18px;
    height: 2px;
    background: var(--lms-gray-600);
    margin: 1px 0;
    transition: 0.3s;
}

/* Progress Overview */
.progress-overview {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--lms-gray-200);
}

.progress-circle {
    margin-bottom: 1rem;
}

.progress-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(var(--lms-primary) 0deg, var(--lms-gray-200) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
}

.progress-ring::before {
    content: '';
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: white;
    position: absolute;
}

.progress-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--lms-primary);
    position: relative;
    z-index: 1;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--lms-gray-600);
    margin: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem 0;
    min-height: calc(100vh - 120px); /* Ensure enough height */
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Enable scrolling if needed */
}

.nav-section {
    margin-bottom: 2rem;
}

/* Ensure Quick Tools section is fully visible */
.nav-section:last-child {
    margin-bottom: 3rem; /* Extra space for the last section */
    padding-bottom: 2rem; /* Additional padding */
    border: 2px solid #e3f2fd; /* Temporary border to see section bounds */
    background: rgba(227, 242, 253, 0.1); /* Light background */
}

/* Debug: Make nav items more visible */
.nav-section:last-child .nav-link {
    border: 1px solid #ddd; /* Temporary border for visibility */
    margin-bottom: 0.5rem; /* More space between items */
    background: white; /* Ensure background is visible */
}

/* Make sure all nav links are visible with better spacing */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--lms-gray-700);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    min-height: 44px; /* Ensure minimum touch target size */
    margin-bottom: 0.25rem; /* Add space between items */
    width: 100%; /* Full width */
    box-sizing: border-box; /* Include padding in width calculation */
    border-radius: 6px; /* Add rounded corners */
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--lms-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 1rem;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column; /* Stack items vertically */
    gap: 0.5rem; /* Add space between items */
}

.nav-list li {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%; /* Full width for each item */
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--lms-gray-700);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--lms-gray-100);
    color: var(--lms-primary);
}

.nav-link.active {
    background: var(--lms-primary);
    color: white;
    font-weight: 500;
}

/* Special styling for ChemAI Bot link */
#openChemAIBot {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-radius: 8px !important;
    margin: 0.5rem 0 !important; /* Only top/bottom margin */
    font-weight: 600 !important;
    border: 2px solid transparent !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2) !important;
    width: calc(100% - 1rem) !important; /* Full width minus margins */
    margin-left: 0.5rem !important;
    margin-right: 0.5rem !important;
}

#openChemAIBot:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4) !important;
}

#openChemAIBot .icon-bot::before {
    filter: brightness(0) invert(1) !important; /* Make icon white */
}

/* Make sure all nav items are visible */
.nav-list li {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%; /* Full width for each item */
}

/* Board Sections */
.board-section {
    margin-bottom: 1rem;
}

.board-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--lms-gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.board-toggle:hover {
    background: var(--lms-gray-100);
}

.board-toggle i {
    transition: transform 0.2s ease;
}

.board-toggle.expanded i {
    transform: rotate(90deg);
}

.class-list {
    display: none;
    padding-left: 1rem;
}

.class-list.expanded {
    display: block;
}

.class-item {
    margin-bottom: 0.5rem;
}

.class-toggle {
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.8rem;
    color: var(--lms-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.class-toggle:hover {
    background: var(--lms-gray-50);
    color: var(--lms-primary);
}

.chapter-list {
    display: none;
    padding-left: 1rem;
}

.chapter-list.expanded {
    display: block;
}

.chapter-item {
    padding: 0.25rem 1rem;
    font-size: 0.75rem;
    color: var(--lms-gray-500);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chapter-item:hover {
    color: var(--lms-primary);
}

/* Main Content Area */
.lms-main {
    flex: 1;
    margin-left: var(--lms-sidebar-width);
    padding: 2rem;
    transition: margin-left 0.3s ease;
    overflow-y: auto;
}

.lms-main.expanded {
    margin-left: var(--lms-sidebar-collapsed);
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--lms-gray-900);
    margin: 0 0 0.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 0.5rem;
}

.section-header p {
    font-size: 1rem;
    color: var(--lms-gray-600);
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    border-radius: var(--lms-border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--lms-shadow);
    border: 1px solid var(--lms-gray-200);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lms-gray-100);
    border-radius: var(--lms-border-radius);
}

.stat-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--lms-gray-900);
    margin: 0;
}

.stat-content p {
    font-size: 0.875rem;
    color: var(--lms-gray-600);
    margin: 0;
}

/* Quick Actions */
.quick-actions {
    margin-bottom: 3rem;
}

.quick-actions h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 1.5rem;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.action-card {
    background: white;
    border-radius: var(--lms-border-radius-lg);
    padding: 2rem;
    box-shadow: var(--lms-shadow);
    border: 1px solid var(--lms-gray-200);
    text-align: center;
    transition: transform 0.2s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--lms-shadow-lg);
}

.action-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.action-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 0.5rem;
}

.action-card p {
    font-size: 0.875rem;
    color: var(--lms-gray-600);
    margin: 0 0 1.5rem;
}

/* Recent Activity */
.recent-activity h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 1.5rem;
}

.activity-list {
    background: white;
    border-radius: var(--lms-border-radius-lg);
    border: 1px solid var(--lms-gray-200);
    overflow: hidden;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--lms-gray-200);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lms-gray-100);
    border-radius: var(--lms-border-radius);
}

.activity-content h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 0.25rem;
}

.activity-content p {
    font-size: 0.75rem;
    color: var(--lms-gray-600);
    margin: 0 0 0.25rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--lms-gray-500);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--lms-border-radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--lms-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--lms-primary-dark);
}

.btn-secondary {
    background: var(--lms-gray-200);
    color: var(--lms-gray-700);
}

.btn-secondary:hover {
    background: var(--lms-gray-300);
}

/* Icons */
.icon-dashboard::before { content: "📊"; }
.icon-home::before { content: "🏠"; }
.icon-play::before { content: "▶️"; }
.icon-trophy::before { content: "🏆"; }
.icon-book::before { content: "📚"; }
.icon-chevron-right::before { content: "▶"; }
.icon-table::before { content: "⚛️"; }
.icon-quiz::before { content: "❓"; }
.icon-calculator::before { content: "🧮"; }
.icon-ai::before { content: "🤖"; }
.icon-bot::before { content: "💬"; }
.icon-tools::before { content: "🛠️"; }
.icon-music::before { content: "🎵"; }

/* Responsive Design */
@media (max-width: 1024px) {
    .lms-sidebar {
        transform: translateX(-100%);
    }
    
    .lms-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .lms-main {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .lms-main {
        padding: 1rem;
    }
    
    .section-header h1 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .action-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .lms-main {
        padding: 0.75rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--lms-gray-300);
    border-top: 2px solid var(--lms-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Scrollbar */
.lms-sidebar::-webkit-scrollbar {
    width: 6px;
}

.lms-sidebar::-webkit-scrollbar-track {
    background: var(--lms-gray-100);
}

.lms-sidebar::-webkit-scrollbar-thumb {
    background: var(--lms-gray-300);
    border-radius: 3px;
}

.lms-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--lms-gray-400);
}

/* Chapter Content Styles */
.chapter-content {
    max-width: 100%;
}

.breadcrumb {
    font-size: 0.875rem;
    color: var(--lms-gray-600);
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--lms-gray-100);
    border-radius: var(--lms-border-radius);
}

.breadcrumb span {
    margin: 0 0.25rem;
}

/* Content Tabs */
.content-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--lms-gray-200);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--lms-gray-600);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--lms-primary);
}

.tab-btn.active {
    color: var(--lms-primary);
    border-bottom-color: var(--lms-primary);
}

.tab-content {
    margin-top: 2rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Chapter Overview */
.chapter-overview h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 1rem;
}

.learning-objectives {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.learning-objectives h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 1rem;
}

.learning-objectives ul {
    margin: 0;
    padding-left: 1.5rem;
}

.learning-objectives li {
    margin-bottom: 0.5rem;
    color: var(--lms-gray-700);
}

.chapter-progress {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.chapter-progress h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--lms-gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--lms-primary);
    transition: width 0.3s ease;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.video-card {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s ease;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--lms-shadow-lg);
}

.video-thumbnail {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.video-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 0.5rem;
}

.video-card p {
    font-size: 0.875rem;
    color: var(--lms-gray-600);
    margin: 0 0 1rem;
}

/* Notes Content */
.notes-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.note-card {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 1.5rem;
    text-align: center;
}

.note-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 0.5rem;
}

.note-card p {
    font-size: 0.875rem;
    color: var(--lms-gray-600);
    margin: 0 0 1rem;
}

/* Practice Section */
.practice-section {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 2rem;
}

.difficulty-levels {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.difficulty-btn {
    padding: 0.5rem 1rem;
    background: var(--lms-gray-200);
    border: none;
    border-radius: var(--lms-border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.difficulty-btn.active {
    background: var(--lms-primary);
    color: white;
}

.problem-list {
    display: grid;
    gap: 1rem;
}

.problem-card {
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.problem-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 0.5rem;
}

.problem-card p {
    font-size: 0.875rem;
    color: var(--lms-gray-600);
    margin: 0;
}

/* Quiz Section */
.quiz-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.quiz-info {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 2rem;
}

.quiz-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 1rem;
}

.quiz-info ul {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
}

.quiz-info li {
    margin-bottom: 0.5rem;
    color: var(--lms-gray-700);
}

.quiz-history {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 2rem;
}

.quiz-history h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 1rem;
}

/* Continue Grid */
.continue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.continue-card {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.continue-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--lms-shadow-lg);
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.achievement-card {
    background: white;
    border: 1px solid var(--lms-gray-200);
    border-radius: var(--lms-border-radius);
    padding: 1.5rem;
    text-align: center;
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.achievement-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--lms-gray-900);
    margin: 0 0 0.5rem;
}

.achievement-card p {
    font-size: 0.875rem;
    color: var(--lms-gray-600);
    margin: 0;
}

.achievement-card.locked {
    opacity: 0.6;
}

.achievement-card.locked .achievement-icon {
    filter: grayscale(1);
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
    .content-tabs {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .quiz-section {
        grid-template-columns: 1fr;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
    }
    
    .notes-content {
        grid-template-columns: 1fr;
    }
    
    .problem-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .difficulty-levels {
        flex-direction: column;
    }
}
