/* ChatGPT-inspired Modern Color Palette */
:root {
    --primary: #10a37f;
    --primary-hover: #0d8c6f;
    --primary-light: rgba(16, 163, 127, 0.1);
    --secondary: #202123;
    --text-primary: #343541;
    --text-secondary: #6e6e80;
    --text-tertiary: #acacbe;
    --border-color: #e5e5e6;
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-tertiary: #ececf1;
    --ai-message-bg: #f7f7f8;
    --user-message-bg: #ffffff;
    --hover-color: #f0f0f0;
    --sidebar-width: 260px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    
    --border-radius-sm: 0.25rem;
    --border-radius: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
}

/* Dark Mode Colors (ChatGPT-inspired) */
.dark-mode {
    --primary: #10a37f;
    --primary-hover: #13bd94;
    --primary-light: rgba(16, 163, 127, 0.2);
    --secondary: #40414f;
    --text-primary: #ececf1;
    --text-secondary: #c5c5d2;
    --text-tertiary: #8e8ea0;
    --border-color: #4d4d4f;
    --bg-primary: rgb(26, 26, 26);
    --bg-secondary: #444654;
    --bg-tertiary: #202123;
    --ai-message-bg: #212121;
    --user-message-bg: #212121;
    --hover-color: #40414f;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'kern' 1, 'liga' 1;
}

.app-container {
    display: flex;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.sidebar-header span {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.new-chat-btn {
    margin: 16px;
    padding: 12px 16px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: var(--primary-hover);
}

/* Curriculum Navigation */
.curriculum-navigation {
    flex: 0 0 auto;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.curriculum-navigation h3 {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Selection Counter */
.selection-counter {
    font-size: 11px;
    color: var(--primary);
    font-weight: 500;
    background: var(--primary-light);
    padding: 4px 8px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 8px;
    border: 1px solid rgba(16, 163, 127, 0.3);
    animation: slideInCounter 0.3s ease;
}

@keyframes slideInCounter {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Dark mode selection counter */
.dark-mode .selection-counter {
    background: rgba(16, 163, 127, 0.2);
    border-color: rgba(16, 163, 127, 0.4);
    color: var(--primary);
}

.curriculum-list {
    list-style-type: none;
}

/* Curriculum item base styles */
.curriculum-item {
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    margin-bottom: 2px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.curriculum-item:hover {
    color: var(--text-primary);
}

/* Subject highlight */
.subject-item.active {
    background-color: transparent;
    border-left: 3px solid var(--primary);
}

.subject-item.active > span {
    color: var(--primary);
    font-weight: 500;
}

/* Chapter highlight */
.chapter-item.active {
    background-color: transparent;
    border-left: 3px solid rgb(147, 51, 234);
}

.chapter-item.active > span {
    color: rgb(147, 51, 234);
    font-weight: 500;
}

/* Concept highlight */
.concept-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-left: 3px solid rgb(59, 130, 246);
    position: relative;
}

.concept-item.active > span,
.concept-item.active {
    color: rgb(59, 130, 246);
    font-weight: 500;
}

/* Multiple selection indicator */
.concept-item.active::after {
    content: '✓';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: rgb(59, 130, 246);
    font-weight: bold;
}

/* Hover states */
.subject-item:hover {
    background-color: transparent;
    color: var(--primary);
}

.chapter-item:hover {
    background-color: transparent;
    color: rgb(147, 51, 234);
}

.concept-item:hover {
    background-color: transparent;
    color: rgb(59, 130, 246);
}

/* Update nested list styles */
.chapter-list, .concept-list {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Accordion Animation */
.curriculum-item.expanded > ul {
    animation: accordionExpand 0.3s ease-out;
}

@keyframes accordionExpand {
    0% {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

/* Smooth accordion collapse */
.curriculum-item:not(.expanded) > ul {
    max-height: 0;
    opacity: 0;
    transform: translateY(-5px);
}

/* Dark mode adjustments */
.dark-mode .subject-item.active > span {
    color: var(--primary);
}

.dark-mode .chapter-item.active > span {
    color: rgb(167, 89, 238);
}

.dark-mode .concept-item.active {
    background-color: rgba(96, 165, 250, 0.15);
    border-left-color: rgb(96, 165, 250);
}

.dark-mode .concept-item.active,
.dark-mode .concept-item.active > span {
    color: rgb(96, 165, 250);
}

.dark-mode .concept-item.active::after {
    color: rgb(96, 165, 250);
}

/* Chat History */
.chat-history {
    flex: 1;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.history-section {
    margin-bottom: 16px;
}

.history-section h3 {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-list {
    margin-bottom: 16px;
}

.chat-item {
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    margin-bottom: 4px;
    font-size: 14px;
    color: var(--text-primary);
    transition: background-color 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item:hover {
    background-color: var(--hover-color);
}

/* Model Selection */
.model-selection {
    padding: 16px;
}

.model-btn {
    width: 100%;
    padding: 10px 16px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.model-btn:hover {
    background-color: var(--hover-color);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    background-color: var(--bg-primary);
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: calc(-1 * var(--sidebar-width));
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 15;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius);
    transition: transform 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background-color: var(--hover-color);
}

.sidebar-toggle.shifted {
    transform: translateX(var(--sidebar-width));
}

/* Profile Section */
.profile-container {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 6px 12px 6px 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.profile-btn:hover {
    background-color: var(--hover-color);
}

.profile-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.profile-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.profile-menu {
    position: absolute;
    top: 50px;
    right: 0;
    width: 240px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 100;
}

.profile-menu.show {
    display: block;
}

.profile-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-info .profile-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-details, .profile-age {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.menu-items {
    padding: 8px 0;
}

.menu-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 14px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item:hover {
    background-color: var(--hover-color);
}

.item-icon {
    width: 20px;
    text-align: center;
}

.menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

.logout-btn {
    color: #ef4444;
}

/* Enhanced Dark Mode Toggle Button */
.dark-mode-toggle {
    position: relative;
    background: var(--bg-secondary) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 10px !important;
    padding: 10px 16px !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 140px !important;
    justify-content: flex-start !important;
}

.dark-mode-toggle:hover {
    background: var(--hover-color) !important;
    border-color: var(--primary) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dark-mode-toggle .item-icon {
    font-size: 18px !important;
    transition: transform 0.3s ease;
    min-width: 20px;
    text-align: center;
}

.dark-mode-toggle:hover .item-icon {
    transform: scale(1.2);
}

/* Light Mode Specific Styling */
.dark-mode-toggle.light-mode {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-color: #dee2e6 !important;
    color: #495057 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark-mode-toggle.light-mode:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%) !important;
    border-color: #1a73e8 !important;
    color: #1a73e8 !important;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.15);
}

.dark-mode-toggle.light-mode .item-icon {
    color: #ffc107;
}

.dark-mode-toggle.light-mode:hover .item-icon {
    color: #ff8f00;
}

/* Dark Mode Specific Styling */
.dark-mode .dark-mode-toggle.dark-mode {
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%) !important;
    border-color: #6b7280 !important;
    color: #f3f4f6 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dark-mode .dark-mode-toggle.dark-mode:hover {
    background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%) !important;
    border-color: #10a37f !important;
    color: #10a37f !important;
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

.dark-mode .dark-mode-toggle.dark-mode .item-icon {
    color: #fbbf24;
}

.dark-mode .dark-mode-toggle.dark-mode:hover .item-icon {
    color: #f59e0b;
}

/* Theme Toggle Animation */
.theme-toggle-animation {
    animation: themeSwitch 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes themeSwitch {
    0% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.05) rotate(-5deg); 
    }
    75% { 
        transform: scale(1.05) rotate(5deg); 
    }
    100% { 
        transform: scale(1) rotate(0deg); 
    }
}

/* Theme transition for smooth mode switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===== PLATFORM ANIMATIONS ===== */

/* New Chat Button - Pulse Animation (Primary Action) */
.new-chat-btn {
    position: relative;
    overflow: hidden;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.new-chat-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 163, 127, 0.3);
}

.new-chat-btn:hover::before {
    width: 120px;
    height: 120px;
}

.new-chat-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Sidebar Toggle - Smooth Flip Animation */
.sidebar-toggle {
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 15px rgba(16, 163, 127, 0.2);
}

.sidebar-toggle.shifted {
    transition: transform 0.3s ease;
}

.sidebar-toggle.shifted:hover {
    transform: translateX(var(--sidebar-width)) scale(1.1) rotate(-90deg);
}

/* Curriculum Items - Sophisticated Slide & Highlight */
.curriculum-item {
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-left: 3px solid transparent;
}

.curriculum-item::after {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    width: 3px;
    height: 0;
    background: currentColor;
    transition: height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.curriculum-item:hover {
    transform: translateX(8px);
    background: var(--hover-color);
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.curriculum-item:hover::after {
    height: 100%;
}

.curriculum-item.active::after {
    height: 100%;
    animation: activeGlow 0.5s ease;
}

@keyframes activeGlow {
    0% { box-shadow: 0 0 0 rgba(16, 163, 127, 0.5); }
    50% { box-shadow: 0 0 15px rgba(16, 163, 127, 0.3); }
    100% { box-shadow: 0 0 0 rgba(16, 163, 127, 0); }
}

/* Subject Items - Elegant Expand */
.subject-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.subject-item:hover {
    background: linear-gradient(90deg, var(--primary-light), transparent);
}

.subject-item.active {
    background: linear-gradient(90deg, var(--primary-light), rgba(16, 163, 127, 0.05));
    border-left-color: var(--primary);
    animation: subjectSelect 0.4s ease;
}

@keyframes subjectSelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Chapter Items - Smooth Cascade */
.chapter-item:hover {
    background: linear-gradient(90deg, rgba(52, 152, 219, 0.1), transparent);
}

.chapter-item.active {
    animation: chapterSelect 0.3s ease;
}

@keyframes chapterSelect {
    0% { opacity: 0.8; transform: translateX(-5px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* Concept Items - Gentle Pulse */
.concept-item:hover {
    background: linear-gradient(90deg, rgba(155, 89, 182, 0.1), transparent);
    animation: conceptHover 0.6s ease infinite alternate;
}

@keyframes conceptHover {
    0% { box-shadow: 0 0 0 rgba(155, 89, 182, 0); }
    100% { box-shadow: 0 0 8px rgba(155, 89, 182, 0.2); }
}

/* Chat History Items - Smooth Slide with Memory Effect */
.chat-item {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.chat-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), transparent);
    transition: width 0.3s ease;
    border-radius: 0 4px 4px 0;
}

.chat-item:hover {
    transform: translateX(6px);
    background: var(--hover-color);
    border-radius: 0 6px 6px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-item:hover::before {
    width: 4px;
}

/* Profile Button - Sophisticated Bounce */
.profile-btn {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.profile-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.profile-btn:hover .profile-icon {
    animation: profileIconSpin 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes profileIconSpin {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* Profile Menu - Elegant Slide Down */
.profile-menu {
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.profile-menu.show {
    transform: translateY(0);
    opacity: 1;
    animation: menuSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes menuSlideIn {
    0% { 
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    100% { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Menu Items - Ripple Effect */
.menu-item {
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.menu-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(16, 163, 127, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.menu-item:hover::before {
    width: 200px;
    height: 200px;
}

.menu-item:hover {
    transform: translateX(4px);
    background: var(--hover-color);
}

/* Model Button - Gentle Glow */
.model-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.model-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(16, 163, 127, 0.1) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.model-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.2);
}

.model-btn:hover::after {
    opacity: 1;
    animation: shimmer 1.5s ease infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Send Button - Power Pulse */
.send-btn {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.send-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(16, 163, 127, 0.4);
    animation: powerPulse 0.8s ease infinite alternate;
}

@keyframes powerPulse {
    0% { box-shadow: 0 6px 20px rgba(16, 163, 127, 0.4); }
    100% { box-shadow: 0 8px 25px rgba(16, 163, 127, 0.6); }
}

.send-btn:active {
    transform: scale(0.95) rotate(0deg);
}

/* Attach Button - Bounce */
.attach-btn:hover {
    animation: attachBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes attachBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

/* Dark Mode Specific Adjustments */
.dark-mode .curriculum-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-mode .chat-item:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.dark-mode .profile-btn:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* Chat Box - Modern AI Platform Style */
.chat-box {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-primary);
    padding-top: 16px; /* Reduced padding due to fixed header */
    width: 100%;
    touch-action: pan-y;
}

.message-container {
    width: 100%;
    max-width: 800px;
    padding: 0;
    background: var(--bg-primary);
    margin: 0 auto;
}

.message-container.ai {
    background: var(--bg-primary);
}

.dark-mode .message-container.ai {
    background: var(--bg-primary);
}

.message-content {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    max-width: 70%;
    padding: 12px 16px;
    width: 100%;
    position: relative;
}

.message-container.ai .message-content {
    margin-left: 0px;
    margin-right: auto;
}

.message-container.user .message-content {
    margin-left: auto;
    margin-right: 0%;
}

/* User message content is reversed to put avatar on right */
.message-container.user .message-content {
    flex-direction: row-reverse;
}

/* Message bubbles */
.message-bubble {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    max-width: calc(100% - 50px);
    overflow-wrap: break-word;
    padding: 0;
}

/* Remove bottom margin from last element in message bubble to reduce gap */
.message-bubble > *:last-child {
    margin-bottom: 0 !important;
}

/* Remove top margin from first element in message bubble */
.message-bubble > *:first-child {
    margin-top: 0 !important;
}

/* User message styling - only message text has background like Deepseek */
.message-container.user .message-bubble {
    background-color: rgba(52, 53, 65, 0.05);
    border-radius: 8px;
    padding: 12px 16px;
    display: inline-block;
    max-width: 100%;
}

.dark-mode .message-container.user .message-bubble {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Avatar styling */
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-container.user .avatar {
    background: rgb(25, 195, 125);
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.message-container.ai .avatar {
    background: white;
    border: 1px solid rgba(0,0,0,.1);
}

.dark-mode .message-container.ai .avatar {
    background: var(--bg-primary);
    border-color: rgba(255,255,255,.1);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .message-content {
        padding: 10px 12px;
        gap: 15px;
        max-width: 85%;
    }
    
    .message-container.ai .message-content {
        margin-left: 4px;
    }
    
    .message-container.user .message-content {
        margin-right: 16px;
    }
    
    .message-bubble {
        max-width: calc(100% - 45px);
    }
}

/* Input Area */
.input-container {
    padding: 16px 10%;
    position: relative;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    background-color: var(--bg-tertiary);
    transition: border-color 0.2s;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
    width: calc(100% - 48px);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.input-controls {
    display: flex;
    position: relative;
    align-items: flex-end;
}

/* Input wrapper with attachments styling */
.input-wrapper.has-attachments .input-controls {
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.input-wrapper.has-attachments {
    border-radius: var(--border-radius-lg);
}

.attach-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 0;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 8px;
    bottom: 8px;
    border-radius: 8px;
}

.attach-btn:hover {
    color: var(--primary);
}

/* Attach Options Dropdown */
.attach-options {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    width: 160px;
    margin-bottom: 8px;
}

.attach-options.show {
    display: block;
    animation: slideUpIn 0.2s ease;
}

@keyframes slideUpIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.attach-option {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.attach-option:hover {
    background-color: var(--hover-color);
}

.attach-option:first-child {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.attach-option:last-child {
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    padding: 14px 46px 14px 52px;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    background: transparent;
    color: var(--text-primary);
    min-height: 52px;
    max-height: 200px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

textarea::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

.send-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.send-btn:hover {
    background-color: var(--primary-hover);
}

.send-btn.loading {
    background-color: var(--primary) !important;
    cursor: pointer !important;
}

.send-btn.loading:hover {
    background-color: #0d8f6a !important;
    transform: scale(1.05) !important;
}

.send-btn.loading svg {
    display: none !important;
}

.send-btn.loading::after {
    content: '' !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    border-top-color: white !important;
    animation: spin 1s ease-in-out infinite !important;
}

@keyframes spin {
    to { 
        transform: rotate(360deg); 
    }
}

.input-footer {
    margin-top: 8px;
    display: flex;
    justify-content: center;
}

.disclaimer {
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Context Menu */
#context-menu {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

#context-menu div {
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: background-color 0.2s;
}

#context-menu div:hover {
    background-color: var(--hover-color);
}

/* Media Queries */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 320px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        will-change: transform;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }

    /* Mobile overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 0.5;
    }

    /* Swipe hint indicator - only on mobile */
    .swipe-hint {
        display: block;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 60px;
        background: linear-gradient(to right, var(--primary), transparent);
        z-index: 1002;
        opacity: 0.3;
        border-radius: 0 4px 4px 0;
        animation: swipeHint 3s ease-in-out infinite;
        pointer-events: none;
    }

    @keyframes swipeHint {
        0%, 70%, 100% { opacity: 0.3; }
        35% { opacity: 0.7; }
    }

    /* Hide hint when sidebar is active */
    .sidebar.active ~ .main-content .swipe-hint {
        display: none;
    }
    
    /* Main content adjustments */
    .main-content {
        margin-left: 0 !important;
        width: 100%;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    /* Sidebar toggle positioning */
    .sidebar-toggle {
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 1001;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .sidebar-toggle.shifted {
        transform: none;
    }
    
    /* Chat box mobile adjustments */
    .chat-box {
        flex: 1;
        overflow-y: auto;
        padding: 12px 12px 120px; /* Reduced top padding due to fixed header */
        -webkit-overflow-scrolling: touch;
        transition: padding-bottom 0.3s ease;
        align-items: stretch; /* Override center alignment on mobile */
    }

    /* Message content mobile sizing */
    .message-content {
        max-width: 95%;
        padding: 8px 8px;
        gap: 12px;
    }
    
    .message-container.ai .message-content {
        margin-left: 0px;
    }
    
    .message-container.user .message-content {
        margin-right: 24px;
    }
    
    /* Mobile message container */
    .message-container {
        max-width: 100%;
        margin: 0;
    }

    /* Avatar sizing for mobile */
    .avatar {
        width: 28px;
        height: 28px;
    }

    .avatar-svg {
        width: 20px;
        height: 20px;
    }

    /* Profile container mobile positioning */
    .profile-container {
        position: fixed;
        top: 16px;
        right: 16px;
        z-index: 1001;
    }

    .profile-btn {
        padding: 4px 8px 4px 4px;
    }

    .profile-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .profile-name {
        font-size: 13px;
    }

    /* Mobile input wrapper positioning - move up slightly */
    .input-wrapper {
        position: fixed;
        bottom: 12px; /* Move input box up from bottom */
        left: 12px;
        right: 12px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        border-radius: 25px;
        z-index: 100;
        /* Use environment variables for safe area */
        padding-bottom: max(4px, env(safe-area-inset-bottom));
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        min-height: 52px; /* iOS minimum touch target */
        display: flex;
        flex-direction: column;
        /* Better mobile interaction */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Mobile input controls */
    .input-controls {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 4px;
        min-height: 52px;
    }

    /* Mobile attachment preview */
    .attachment-preview-container {
        border-radius: 20px 20px 0 0;
        padding: 8px 12px 4px 12px;
        border-bottom: 1px solid var(--border-color);
        background: var(--bg-secondary);
    }

    /* Mobile input wrapper with attachments */
    .input-wrapper.has-attachments {
        border-radius: 25px;
    }

    .input-wrapper.has-attachments .input-controls {
        border-radius: 0 0 25px 25px;
    }

    /* Textarea mobile optimization */
    .input-controls textarea {
        flex: 1;
        padding: 12px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
        line-height: 1.4;
        min-height: 44px;
        max-height: 120px;
        border: none;
        background: transparent;
        color: var(--text-primary);
        outline: none;
        resize: none;
        border-radius: 20px;
        margin: 0 4px;
        /* Ensure textarea captures touch events properly */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        /* Better mobile focus behavior */
        -webkit-user-select: text;
        user-select: text;
        cursor: text;
    }

    /* Send button mobile optimization - flex positioning */
    .input-controls .send-btn {
        width: 40px;
        height: 40px;
        border-radius: 20px;
        background: var(--primary);
        border: none;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        cursor: pointer;
        /* Prevent button from interfering with textarea */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Attach button mobile - flex positioning */
    .input-controls .attach-btn {
        width: 40px;
        height: 40px;
        border-radius: 20px;
        background: transparent;
        border: 1px solid var(--border-color);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        cursor: pointer;
        font-size: 16px;
        /* Better mobile touch behavior */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        -webkit-user-select: none;
        user-select: none;
        transition: all 0.2s ease;
        /* Ensure button is tappable */
        position: relative;
        z-index: 2;
    }

    .input-controls .attach-btn:active {
        background-color: var(--hover-color);
        transform: scale(0.95);
    }

    /* File preview mobile */
    .attachment-preview-container {
        margin-bottom: 8px;
    }

    .file-preview {
        max-width: 150px;
        padding: 6px;
    }

    .file-preview img {
        width: 32px;
        height: 32px;
    }

    /* Curriculum navigation mobile */
    .curriculum-navigation {
        padding: 8px;
        width: 100%;
        overflow-x: hidden;
    }

    .curriculum-item {
        padding: 10px 6px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        word-wrap: break-word;
        line-height: 1.3;
    }

    /* Allow curriculum text to wrap on mobile */
    .curriculum-item span {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        word-wrap: break-word;
        hyphens: auto;
        line-height: 1.3;
    }

    /* Mobile nested curriculum lists */
    .chapter-list, .concept-list {
        margin-left: 8px;
        padding-left: 8px;
        width: calc(100% - 16px);
        overflow: visible;
    }

    /* Ensure nested items are fully visible */
    .chapter-item, .concept-item {
        padding: 8px 4px;
        margin-right: 4px;
    }

    /* Mobile curriculum item content wrapping */
    .curriculum-item {
        align-items: flex-start;
        min-height: 40px;
        padding: 8px 6px;
    }

    .curriculum-item span {
        flex: 1;
        padding-right: 4px;
    }

    /* Chat history mobile */
    .chat-history {
        padding: 12px;
    }

    .chat-item {
        padding: 10px 8px;
        min-height: 44px;
        font-size: 15px;
    }

    /* Profile menu mobile */
    .profile-menu {
        right: 8px;
        top: 56px;
        width: 200px;
    }

    /* Dark mode toggle mobile */
    .dark-mode-toggle {
        min-height: 44px;
        font-size: 15px;
    }

    /* Camera modal mobile full screen */
    .camera-modal.active {
        padding: 0;
    }

    .camera-container {
        height: 100vh;
        max-width: none;
        margin: 0;
        border-radius: 0;
    }

    /* Attach options mobile positioning */
    .attach-options {
        bottom: 100%;
        left: 8px;
        width: 140px;
        margin-bottom: 8px;
        z-index: 1001; /* Higher z-index for mobile */
    }

    .attach-option {
        padding: 12px;
        font-size: 15px;
        min-height: 44px;
        justify-content: flex-start;
    }

    /* Scrollbar mobile */
    ::-webkit-scrollbar {
        width: 4px;
    }

    /* Ensure body doesn't scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    /* Smooth transitions for mobile */
    .input-container,
    .chat-box {
        transition: all 0.3s ease;
    }

    /* Fix for mobile Safari address bar */
    .main-content {
        height: 100vh;
        height: -webkit-fill-available;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .input-container {
        /* Handle iOS Safari bottom bar */
        padding-bottom: max(12px, calc(env(safe-area-inset-bottom) + 12px));
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-box {
        padding-top: 50px;
    }

    .input-container {
        padding: 8px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    textarea {
        max-height: 80px;
    }

    .sidebar {
        width: 320px;
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .message-content {
        gap: 8px;
        padding: 6px 4px;
    }

    .input-container {
        padding: 8px;
    }

    .profile-container {
        top: 12px;
        right: 12px;
    }

    .sidebar-toggle {
        top: 12px;
        left: 12px;
    }
}

/* Mobile touch improvements */
@media (max-width: 768px) {
    /* Prevent text selection during touch */
    .sidebar-toggle,
    .profile-btn,
    .new-chat-btn,
    .curriculum-item,
    .chat-item,
    .send-btn,
    .attach-btn {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    /* Improve touch targets */
    .curriculum-item,
    .chat-item,
    .menu-item {
        min-height: 48px; /* Increased for better touch */
    }

    /* Smooth scrolling for mobile */
    .chat-box,
    .sidebar {
        scroll-behavior: smooth;
    }

    /* Remove hover effects on touch devices */
    @media (hover: none) and (pointer: coarse) {
        .curriculum-item:hover,
        .chat-item:hover,
        .menu-item:hover {
            background: transparent;
            transform: none;
        }
    }
}

/* Hide swipe hint on desktop */
.swipe-hint {
    display: none;
}

/* Message Action Buttons */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 0%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-container:hover .message-actions {
    opacity: 1;
}

/* AI message actions - align with text content */
.message-container.ai .message-actions {
    margin-left: 70px; /* padding (16px) + avatar (30px) + gap (24px) = 70px */
    justify-content: flex-start;
}

/* User message actions - align with right edge of content */
.message-container.user .message-actions {
    margin-right: 16px; /* Same as message-content padding */
    justify-content: flex-end;
}

.action-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}

.action-btn:hover {
    background-color: var(--hover-color);
    color: var(--text-primary);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* Like/Dislike states */
.action-btn.like-btn.liked {
    color: #10a37f;
    background-color: rgba(16, 163, 127, 0.1);
}

.action-btn.dislike-btn.disliked {
    color: #dc2626;
    background-color: rgba(220, 38, 38, 0.1);
}

.dark-mode .action-btn.like-btn.liked {
    color: #10a37f;
    background-color: rgba(16, 163, 127, 0.15);
}

.dark-mode .action-btn.dislike-btn.disliked {
    color: #f87171;
    background-color: rgba(248, 113, 113, 0.15);
}

/* Copy button feedback */
.action-btn.copy-btn:active {
    background-color: rgba(16, 163, 127, 0.1);
    color: #10a37f;
}

/* Edit button */
.action-btn.edit-btn:hover {
    background-color: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
}

.dark-mode .action-btn.edit-btn:hover {
    background-color: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

/* Share button */
.action-btn.share-btn:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.dark-mode .action-btn.share-btn:hover {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* Mobile adjustments for action buttons */
@media (max-width: 768px) {
    .message-actions {
        gap: 6px;
    }
    
    /* AI message actions mobile alignment */
    .message-container.ai .message-actions {
        margin-left: 51px; /* mobile: padding (8px) + avatar (28px) + gap (15px) = 51px */
    }
    
    /* User message actions mobile alignment */
    .message-container.user .message-actions {
        margin-right: 8px; /* Same as mobile message-content padding */
    }
    
    .action-btn {
        min-width: 32px;
        height: 32px;
        padding: 8px;
    }
    
    .action-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* Curriculum Navigation Styles */
.curriculum-navigation {
    margin-bottom: 20px;
}

.curriculum-navigation h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.curriculum-profile {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.curriculum-profile .profile-info small {
    color: var(--text-secondary);
    font-size: 12px;
}

.curriculum-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.curriculum-item {
    margin-bottom: 2px;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.subject-item {
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.subject-header {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.subject-header:hover {
    opacity: 0.9;
}

.subject-toggle {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.subject-item.expanded .subject-toggle {
    transform: rotate(180deg);
}

.chapters-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
}

.subject-item.expanded .chapters-list {
    display: block;
}

.chapter-item {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.chapter-item:hover {
    background: var(--hover-color);
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-toggle {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

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

.concepts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: var(--bg-tertiary);
    display: none;
}

.chapter-item.expanded .concepts-list {
    display: block;
}

.concept-item {
    padding: 6px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.concept-item:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.concept-item:last-child {
    border-bottom: none;
}

.concept-name {
    flex: 1;
}



.curriculum-placeholder {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.curriculum-placeholder p {
    margin-bottom: 8px;
    font-size: 14px;
}

.curriculum-placeholder .retry-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
}

.curriculum-placeholder .retry-btn:hover {
    background: var(--primary-hover);
}

.curriculum-item.selected {
    background: var(--primary);
    color: white !important;
}



.attachment-preview-container {
    display: none; /* Hidden by default */
    position: absolute;
    right: auto;
    left: 8px;
    bottom: calc(100% + 4px); /* Position just above the attach button */
    gap: 6px;
    align-items: center;
    z-index: 10;
    background-color: var(--bg-secondary);
    border-radius: 20px;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.attachment-preview-container:not(:empty) {
    display: flex; /* Show only when there are files */
}

.file-preview {
    position: relative;
}

.remove-file-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #dc2626;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 1;
    border: 2px solid white; /* White border for contrast */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* Subtle shadow for depth */
    transition: transform 0.2s ease; /* Add a subtle interaction effect */
}

.remove-file-btn::before,
.remove-file-btn::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 2px;
    background-color: white;
    transform-origin: center;
}

.remove-file-btn::before {
    transform: rotate(45deg);
}

.remove-file-btn::after {
    transform: rotate(-45deg);
}

.remove-file-btn:active {
    transform: scale(0.9); /* Slight press effect */
}

/* Dark mode adjustments */
.dark-mode .remove-file-btn {
    background: #f87171;
    border-color: #1a1a1a; /* Dark border for contrast in dark mode */
}

/* Ensure good touch target on mobile */
@media (max-width: 768px) {
    .remove-file-btn {
        width: 28px;
        height: 28px;
        top: -10px;
        right: -10px;
    }

    .remove-file-btn::before,
    .remove-file-btn::after {
        width: 14px;
    }
}

/* ========================================
   MODERN CURRICULUM UI STYLES
   ======================================== */

/* Enhanced Curriculum Navigation */
.curriculum-navigation {
    margin: 24px 0 !important;
    padding: 0 12px !important;
}

.curriculum-navigation h3 {
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    margin-bottom: 20px !important;
    font-weight: 700 !important;
    position: relative !important;
    padding-left: 12px !important;
}

.curriculum-navigation h3::before {
    content: '📚' !important;
    position: absolute !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 16px !important;
}

/* Modern Curriculum List */
.curriculum-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

/* Modern Subject Cards */
.curriculum-item.subject-item {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    border-left: 1px solid var(--border-color) !important;
}

.curriculum-item.subject-item:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12) !important;
    border-color: var(--primary) !important;
}

.curriculum-item.subject-item.active {
    border-color: var(--primary) !important;
    box-shadow: 0 8px 32px rgba(16, 163, 127, 0.2) !important;
    background: linear-gradient(135deg, var(--bg-primary), rgba(16, 163, 127, 0.02)) !important;
}

.curriculum-item.subject-item.active .subject-header {
    background: linear-gradient(135deg, var(--primary), #0d8f6a) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3) !important;
}

/* Subject Header Styling */
.subject-header {
    padding: 14px 18px !important;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary)) !important;
    border-bottom: 1px solid rgba(var(--border-color-rgb), 0.5) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    transition: all 0.2s ease !important;
    position: relative !important;
}

.subject-header:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--bg-secondary)) !important;
}

.subject-header::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 4px !important;
    height: 100% !important;
    background: linear-gradient(180deg, var(--primary), #3498db) !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
}

.subject-item:hover .subject-header::before,
.subject-item.active .subject-header::before {
    opacity: 1 !important;
}

.subject-name {
    font-weight: 600 !important;
    font-size: 14px !important;
    color: var(--text-primary) !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.subject-toggle {
    font-size: 14px !important;
    color: var(--text-secondary) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-weight: bold !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: var(--bg-primary) !important;
}

.subject-item.expanded .subject-toggle {
    transform: rotate(180deg) !important;
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

/* Modern Chapter List */
.chapters-list {
    list-style: none !important;
    padding: 8px !important;
    margin: 0 !important;
    background: var(--bg-primary) !important;
    border-left: none !important;
    margin-left: 0 !important;
    padding-left: 8px !important;
    gap: 6px !important;
    display: flex !important;
    flex-direction: column !important;
}

.curriculum-item.chapter-item {
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    background: var(--bg-primary) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.curriculum-item.chapter-item:last-child {
    border-bottom: none !important;
}

.curriculum-item.chapter-item:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15) !important;
    border-color: rgba(52, 152, 219, 0.5) !important;
}

.curriculum-item.chapter-item.active {
    border-color: rgb(147, 51, 234) !important;
    box-shadow: 0 4px 16px rgba(147, 51, 234, 0.2) !important;
    background: linear-gradient(135deg, var(--bg-primary), rgba(147, 51, 234, 0.08)) !important;
    transform: translateY(-2px) !important;
}

.curriculum-item.chapter-item.active .chapter-name {
    color: rgb(147, 51, 234) !important;
    font-weight: 600 !important;
}

.chapter-header {
    padding: 12px 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.chapter-name {
    font-weight: 500 !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

.chapter-name::before {
    content: '📖' !important;
    margin-right: 12px !important;
    font-size: 16px !important;
}

.chapter-toggle {
    font-size: 12px !important;
    color: var(--text-secondary) !important;
    transition: transform 0.3s ease !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: var(--bg-secondary) !important;
}

.chapter-item.expanded .chapter-toggle {
    transform: rotate(180deg) !important;
    background: rgba(147, 51, 234, 0.1) !important;
    color: rgb(147, 51, 234) !important;
}

/* Modern Concept Pills */
.concepts-list {
    list-style: none !important;
    padding: 8px 16px 16px 16px !important;
    margin: 0 !important;
    background: rgba(var(--bg-secondary-rgb), 0.1) !important;
    display: block !important;
    border-top: 1px solid rgba(var(--border-color-rgb), 0.2) !important;
    position: relative !important;
}

.curriculum-item.concept-item {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    display: block !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    margin: 0 0 4px 0 !important;
    border-left: 1px solid var(--border-color) !important;
    position: relative !important;
    overflow: hidden !important;
    min-height: auto !important;
}

.curriculum-item.concept-item::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent) !important;
    transition: left 0.5s ease !important;
}

.curriculum-item.concept-item:hover::before {
    left: 100% !important;
}

.curriculum-item.concept-item:hover {
    background: linear-gradient(135deg, var(--primary-light), rgba(59, 130, 246, 0.05)) !important;
    border-color: var(--primary) !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 6px 20px rgba(16, 163, 127, 0.15) !important;
}

.curriculum-item.concept-item.active {
    background: linear-gradient(135deg, var(--primary), rgba(16, 163, 127, 0.8)) !important;
    color: white !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3) !important;
    transform: translateY(-2px) scale(1.02) !important;
}

.curriculum-item.concept-item.active .concept-name {
    color: white !important;
    font-weight: 600 !important;
}





.curriculum-item.concept-item.active::after {
    color: white !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    width: 18px !important;
    height: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
}

.concept-name {
    color: inherit !important;
    position: relative !important;
    z-index: 1 !important;
}



/* Empty State Enhancement */
.curriculum-placeholder {
    text-align: center !important;
    padding: 60px 20px !important;
    color: var(--text-secondary) !important;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary)) !important;
    border-radius: 20px !important;
    border: 2px dashed var(--border-color) !important;
    margin: 20px 0 !important;
    position: relative !important;
    overflow: hidden !important;
}

.curriculum-placeholder::before {
    content: '📚' !important;
    font-size: 48px !important;
    display: block !important;
    margin-bottom: 16px !important;
    opacity: 0.5 !important;
}

.placeholder-content p {
    margin: 12px 0 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
}

.placeholder-content p:first-child {
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    font-size: 16px !important;
}

/* Smooth Expand/Collapse Animations */
.chapters-list,
.concepts-list {
    max-height: 0 !important;
    overflow: hidden !important;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.subject-item.expanded .chapters-list {
    max-height: 1000px !important;
}

.chapter-item.expanded .concepts-list {
    max-height: 500px !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .curriculum-navigation {
        margin: 16px 0 !important;
        padding: 0 8px !important;
    }
    
    .subject-header {
        padding: 12px 16px !important;
    }
    
    .chapter-header {
        padding: 10px 14px !important;
    }
    
    .concepts-list {
        padding: 6px 12px 12px 12px !important;
        margin: 0 !important;
    }
    
    .curriculum-item.concept-item {
        font-size: 12px !important;
        padding: 10px 14px !important;
        min-height: auto !important;
        margin: 0 0 3px 0 !important;
    }
    
    .curriculum-item.subject-item {
        border-radius: 12px !important;
    }
}

