/*
 * app-state.css
 * strict visibility control for state-driven rendering
 * Source of Truth for:
 * - Boot Loading State
 * - Active Module Visibility
 * - CSS Isolation Scoping (where global selectors would leak)
 */

/* -------------------------------------------------------------------------
   GLOBAL APP ROOT
   ------------------------------------------------------------------------- */
#app-root {
    position: relative;
    width: 100%;
    height: 100%;
    /* Or min-height based on context */
    /* Ensure stacking context for loaders */
    isolation: isolate;
}

/* -------------------------------------------------------------------------
   I. BOOT PROCESS (Zero Flash Guarantee)
   ------------------------------------------------------------------------- */

/* Default state: Ensure ONLY loader shows until [data-boot-state="ready"] */
body:not([data-boot-state="ready"]) .app-module:not(.always-visible) {
    display: none !important;
}

/* The Loader itself */
#app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--main-bg, #121212);
    /* Fallback dark */
    z-index: 9999;

    /* Center content */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    /* Allow pointer events only while visible */
    pointer-events: all;

    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

/* Skeleton Loader Structure */
/* Skeleton Loader Structure */
#app-loader .skeleton-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

/* Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

#app-loader .skeleton-item {
    background: #1e1e1e;
    background: linear-gradient(90deg, #1e1e1e 25%, #2a2a2a 50%, #1e1e1e 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 12px;
}

/* Specific Skeleton Shapes matching No-Chat View */
#app-loader .skeleton-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 24px;
}

#app-loader .skeleton-title {
    width: 240px;
    height: 32px;
    border-radius: 8px;
    margin-bottom: 8px;
}

#app-loader .skeleton-subtitle {
    width: 320px;
    height: 16px;
    border-radius: 6px;
    opacity: 0.5;
}

#app-loader .skeleton-input {
    width: 100%;
    max-width: 600px;
    height: 52px;
    border-radius: 99px;
    margin-top: 40px;
}

/* When ready, hide the loader */
body[data-boot-state="ready"] #app-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}


/* -------------------------------------------------------------------------
   II. MODULE VISIBILITY (Deterministic Switching)
   ------------------------------------------------------------------------- */

/* Establish the base rule: All modules are hidden by default */
.app-module {
    display: none !important;
}

/* Active Module Rules based on [data-active-mode] on body/root */

/* Ensure the inner wrapper propagates the flex height from main-content */
.main-content-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    /* Crucial for nested scroll containers */
}

/* Mode: Teach Me, Learn, Memorize, Chat -> Show Home Module ONLY if NO active chat */
body[data-active-mode="teachme"] .main-content:not(.has-chat) .app-module[data-module="home"],
body[data-active-mode="learn"] .main-content:not(.has-chat) .app-module[data-module="home"],
body[data-active-mode="memorize"] .main-content:not(.has-chat) .app-module[data-module="home"],
body[data-active-mode="chat"] .main-content:not(.has-chat) .app-module[data-module="home"] {
    display: block !important;
}

/* Mode: Teach Me, Learn, Memorize, Chat -> Show Chat Module if HAS active chat */
body[data-active-mode="teachme"] .main-content.has-chat .app-module[data-module="chat"],
body[data-active-mode="learn"] .main-content.has-chat .app-module[data-module="chat"],
body[data-active-mode="memorize"] .main-content.has-chat .app-module[data-module="chat"],
body[data-active-mode="chat"] .main-content.has-chat .app-module[data-module="chat"] {
    display: flex !important;
    flex-direction: column;
    /* Use flex-grow instead of fixed height to fill main-content naturally */
    flex: 1 !important;
    width: 100%;
    overflow: hidden;
    /* Prevent double scrollbars */
}

/* Force message container specific growth within the chat module */
body[data-active-mode="teachme"] .main-content.has-chat .app-module[data-module="chat"] .chat-messages-container,
body[data-active-mode="learn"] .main-content.has-chat .app-module[data-module="chat"] .chat-messages-container,
body[data-active-mode="memorize"] .main-content.has-chat .app-module[data-module="chat"] .chat-messages-container,
body[data-active-mode="chat"] .main-content.has-chat .app-module[data-module="chat"] .chat-messages-container {
    flex: 1 !important;
    /* Critical: Expand to push input down */
    overflow-y: auto !important;
    min-height: 0 !important;
}

/* TOOL OPEN EXCEPTION (Split Screen) */
/* tools.js moves chat content into .centered-content (Home Module) */
/* So we must SHOW Home Module and HIDE Chat Module wrapper */
body .main-content.has-chat.has-tool-open .app-module[data-module="home"] {
    display: block !important;
}

body .main-content.has-chat.has-tool-open .app-module[data-module="chat"] {
    display: none !important;
}

/* Mode: Test -> Show Test Module */
body[data-active-mode="test"] .app-module[data-module="test"] {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Mode: Classroom -> Show Classroom Module */
body[data-active-mode="classroom"] .app-module[data-module="classroom"] {
    display: block !important;
    width: 100%;
    height: 100%;
}

/* Mode: How To Study -> Show How To Study Module */
body[data-active-mode="study"] .app-module[data-module="study"] {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Also cover how_to_study -> Show How To Study Module */
body[data-active-mode="how_to_study"] .app-module[data-module="how-to-study"] {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    height: 100%;
}


/* -------------------------------------------------------------------------
   III. CSS ISOLATION UTILITIES
   ------------------------------------------------------------------------- */
/* 
   Ensure module contents don't leak out 
   (Since we are hiding non-active modules with display:none via .app-module, 
    styles won't apply to visible elements, but global styles might still leak IN.
    The goal is to scope styles to [data-module="..."] where possible.) 
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base styles... */
:root {

    /* Font Size Variables - Base (Medium) */
    --font-size-base: 14px;
    --font-size-message: 15.5px;
    --font-size-title: 13px;
    --font-size-conversation: 13.5px;
    --font-size-sidebar: 15.5px;
    --font-size-small: 11px;
    --font-size-large: 17px;
    --font-size-xlarge: 19px;
    --avatar-blue: #4A74E8;
    --surface-card: #FFFFFF;
}

/* Light Theme */
body[data-theme="light"] {
    --sidebar-bg: #F3F4F6;
    /* Crisp white sidebar */
    --main-bg: #F3F4F6;
    /* Slightly off-white for better separation */

    /* Text colors */
    --text-primary: #0D0D0D;
    /* Deep neutral black for strong contrast */
    --text-secondary: #333333;
    /* Softer dark gray for subtitles */
    --text-faded: #555555;
    /* Dimmed gray for placeholder or muted text */
    --text-tertiary: #999999;
    /* Tertiary text color for less important text */

    /* Borders & dividers */
    --border-color: #D9D9D9;
    /* Light neutral gray for soft boundaries */
    --nav-active-bg: #F2F2F2;
    /* Gentle highlight for active areas */
    --bg-active: #E8E8E8;
    /* Background for active items */
    --bg-tertiary: #F9F9F9;
    /* Tertiary background for scrollbars */

    /* Inputs */
    --input-main-bg: #FFFFFF;
    --input-bg: #F7F7F7;
    /* Keep inputs clean and white */
    --input-border: #CCCCCC;
    /* Subtle but visible border */
    --tool-bg: #F5F5F5;
    /* Slightly darker grey for tool section */
    --dropdown-bg: #FFFFFF;
    /* Dedicated dropdown surface */

    /* Accent color (use same family as dark mode for consistency) */
    --accent: #FFC400;
    /* Muted blue for links/buttons */
    --accent-hover: #6C90FF;
    /* Slightly lighter hover tone */

    /* Surfaces */
    --surface-card: #FFFFFF;
    /* Opaque white background */
}


/* Dark Theme (Default) */
body[data-theme="dark"] {
    --sidebar-bg: #121212;
    --main-bg: #121212;

    /* Text colors with higher contrast */
    --text-primary: #F5F5F5;
    /* Brighter white, but still soft */
    --text-secondary: #B5B5B5;
    /* More distinct gray */
    --text-faded: #7A7A7A;
    /* Slightly brighter for legibility */
    --text-tertiary: #8A8A8A;
    /* Tertiary text color for less important text */

    /* UI elements */
    --border-color: #1E1E1E;
    --nav-active-bg: #3A3A3A;
    --bg-active: #4A4A4A;
    /* Background for active items */
    --bg-tertiary: #2D2D2D;
    /* Tertiary background for scrollbars */
    --input-main-bg: #303030;
    --input-bg: #2A2A2A;
    --input-border: #3C3C3C;
    --tool-bg: #1F1F1F;
    /* Darker charcoal grey for tool section */
    --dropdown-bg: #1F1F1F;

    /* Accent */
    --accent: #FFC400;
    --accent-hover: #7DA3FF;

    /* Surfaces */
    --surface-card: #1E1E1E;
    /* Opaque dark background */
}

/* Dark Charcoal Theme */
body[data-theme="dark"][data-dark-variant="charcoal"] {
    --sidebar-bg: #1E1E1E;
    --main-bg: #212121;

    /* Text colors */
    --text-primary: #E5E5E5;
    --text-secondary: #B0B0B0;
    --text-faded: #808080;
    --text-tertiary: #909090;
    /* Tertiary text color for less important text */

    /* UI elements */
    --border-color: #2D2D2D;
    --nav-active-bg: #2D2D2D;
    --bg-active: #3D3D3D;
    /* Background for active items */
    --bg-tertiary: #353535;
    /* Tertiary background for scrollbars */
    --input-main-bg: #303030;
    --input-bg: #2D2D2D;
    --input-border: #3A3A3A;
    --tool-bg: #252525;
    /* Darker charcoal grey for tool section */
    --dropdown-bg: #1F1F1F;

    /* Accent */
    --accent: #FFC400;

    /* Surfaces */
    --surface-card: #252525;
}

html {
    /* Ensure HTML has background color to prevent white flashes during overscroll */
    width: 100%;
    height: 100%;
    background-color: var(--main-bg);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    background-color: var(--main-bg);
    color: var(--text-primary);
    width: 100%;
    height: 100vh;
    /* Use dvh for keyboard-safe height on mobile */
    height: 100dvh;
    overflow: hidden;
    /* Prevent pull-to-refresh on mobile which reveals background */
    overscroll-behavior-y: none;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* Disable tap highlight on mobile */
    -webkit-tap-highlight-color: transparent;
}

/* Main Header Bar (for non-logged-in users) */
.main-header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--main-bg);
    padding: 0 24px;
    display: none;
    /* Hidden by default, shown via JS or CSS */
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.main-header-bar.show {
    opacity: 1;
}

body:not(.user-logged-in).session-checked .main-header-bar {
    display: flex;
}

body:not(.user-logged-in).session-checked .app-container {
    padding-top: 64px;
}

/* Hide elements until session check completes - prevents flash of wrong UI */
body:not(.session-checked) .main-header-bar {
    opacity: 0;
    visibility: hidden;
}

body:not(.session-checked) .sidebar {
    opacity: 0;
    visibility: hidden;
}

body.session-checked .main-header-bar {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

body.session-checked .sidebar {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

/* Hide sidebar when user is not logged in */
body:not(.user-logged-in) .sidebar {
    display: none !important;
}

body:not(.user-logged-in) .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (max-width: 768px) {
    .header-logo {
        gap: 4px !important;
    }
}

.header-logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.header-logo-text {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

@media (max-width: 768px) {
    .header-logo-link {
        gap: 4px !important;
    }
}

.login-header-btn {
    background-color: var(--text-primary) !important;
    color: var(--main-bg) !important;
    border: 1px solid transparent !important;
}

.login-header-btn:hover {
    opacity: 0.9;
    transform: none;
}

.signup-header-btn {
    background: transparent !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

@media (max-width: 768px) {
    .signup-header-btn {
        display: none !important;
    }
}

.signup-header-btn:hover {
    background-color: var(--nav-active-bg);
}

.help-header-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
}

.help-header-btn:hover {
    background-color: var(--nav-active-bg);
}

/* Hide sidebar when user is not logged in */
body:not(.user-logged-in) .sidebar {
    display: none;
}

body:not(.user-logged-in) .main-content {
    margin-left: 0;
    width: 100%;
}

.app-container {
    display: flex;
    height: 100vh;
    /* Use dvh for keyboard-safe height on mobile */
    height: 100dvh;
    width: 100%;
    background-color: var(--main-bg);
}

/* Sidebar Styles */
.sidebar {
    width: 230px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), padding 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1100;
}

.sidebar.collapsed {
    width: 70px !important;
    padding: 20px 8px !important;
    overflow: visible !important;
}

.sidebar {
    overflow: visible !important;
}

.sidebar.collapsed .search-bar input {
    opacity: 0;
    width: 0;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

.sidebar.collapsed .search-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    margin: 0 auto;
    transition: width 0.3s ease, margin 0.3s ease;
    border-radius: 50%;
    cursor: pointer;
}

.sidebar.collapsed .search-bar:hover {
    background-color: var(--nav-active-bg);
    border-radius: 50%;
}

.sidebar.collapsed .search-bar i {
    position: static;
    transform: none;
}

/* Add transitions for text elements */
.nav-item span,
.nav-item-main span,
.history-header span,
.history-date,
.history-item span {
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 200px;
    overflow: hidden;
    font-size: 14px;
    white-space: nowrap;
}

.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-item i:last-child,
.sidebar.collapsed .nav-item-main span,
.sidebar.collapsed .nav-item-main i:last-child,
.sidebar.collapsed .history-header span,
.sidebar.collapsed .history-header i:last-child,
.sidebar.collapsed .history-date,
.sidebar.collapsed .history-item span,
.sidebar.collapsed .history-item-edit,
.sidebar.collapsed .history-item-tool-indicator,
.sidebar.collapsed .history-item-dropdown {
    display: none !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0 !important;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 6px auto;
    display: flex;
    /* Removed !important to respect inline display: none */
    flex-direction: row !important;
    align-items: center;
    gap: 0 !important;
}

.sidebar.collapsed .nav-item-main {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.sidebar.collapsed .nav-item.active {
    justify-content: center;
    align-items: center;
    padding: 10px;
    margin: 0 auto;
    text-align: center;
}

.sidebar.collapsed .nav-item.active i {
    margin: 0 auto;
    width: auto;
    display: block;
    text-align: center;
}

.sidebar.collapsed .nav-item:hover {
    background-color: var(--nav-active-bg);
    border-radius: 50%;
}

.sidebar.collapsed .nav-item i,
.sidebar.collapsed .nav-item svg,
.sidebar.collapsed .history-header svg {
    width: 20px;
    height: 20px;
    margin: 0 auto !important;
    /* Force center margin */
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar.collapsed .history-item svg {
    width: 17px;
    height: 17px;
    margin: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Removed redundant history header chevron rule, handled by general rule above */

.sidebar.collapsed .history-header {
    justify-content: center;
    padding: 0 !important;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 6px auto;
    display: flex;
    align-items: center;
}

.sidebar.collapsed .history-header-left {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
}

.sidebar.collapsed .history-header:hover {
    background-color: var(--nav-active-bg);
    border-radius: 50%;
}

.sidebar.collapsed .history-item {
    justify-content: center;
    padding: 0 !important;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin: 6px auto;
    display: flex;
    align-items: center;
}

.sidebar.collapsed .history-item-mode-icon {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}


.sidebar.collapsed .sidebar-footer {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: flex-direction 0.3s ease;
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sidebar.collapsed .sidebar-header-top {
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    margin: 0 auto 0 auto;
    transition: justify-content 0.3s ease, background-color 0.2s;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.sidebar.collapsed .search-bar {
    display: none;
}

.sidebar.collapsed .sidebar-logo:hover {
    background-color: var(--nav-active-bg);
    border-radius: 50%;
}

.sidebar.collapsed .nav-submenu {
    display: none !important;
}

.nav-submenu {
    transition: opacity 0.2s ease, max-height 0.3s ease;
}

.sidebar.collapsed .collapse-btn i,
.sidebar.collapsed .collapse-btn svg {
    transform: rotate(180deg);
}

.sidebar-header {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.sidebar-header .collapse-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header .collapse-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.search-bar {
    position: relative;
    width: 100%;
}

.search-bar i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
    pointer-events: none;
    transition: color 0.2s ease;
}

.search-bar input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-bar input::placeholder {
    color: var(--text-faded);
}

.search-bar input:focus {
    background-color: var(--sidebar-bg);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.search-bar input:focus+i {
    color: var(--accent);
}

/* Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-item:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.nav-item.has-submenu.expanded:hover {
    background-color: transparent;
}

.nav-item.has-submenu.expanded .nav-item-main:hover {
    background-color: transparent;
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--google-blue-light);
    color: var(--google-blue);
}

.nav-item i,
.nav-item svg {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item.has-submenu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.nav-item.has-submenu .nav-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.nav-item.has-submenu .nav-item-main i:last-child {
    margin-left: auto;
    font-size: 12px;
    opacity: 1;
    transition: opacity 0.2s ease, max-width 0.3s ease, transform 0.3s ease;
    max-width: 20px;
    overflow: hidden;
}

.nav-item.has-submenu:not(.expanded) .nav-item-main i:last-child {
    transform: rotate(0deg);
}

.nav-item.has-submenu.expanded .nav-item-main i:last-child {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    margin-top: 4px;
    padding-left: 0;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
    max-height: 0;
    opacity: 0;
}

.nav-item.has-submenu.expanded .nav-submenu {
    display: flex;
    flex-direction: column;
    max-height: 500px;
    opacity: 1;
}

/* History */
.sidebar-history {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}


.sidebar.collapsed #conversationsList,
.sidebar.collapsed .history-date {
    display: none !important;
}

.sidebar-history.collapsed {
    overflow: visible;
}

.sidebar-history .history-group::-webkit-scrollbar {
    width: 4px;
}

.sidebar-history .history-group::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-history .history-group::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.sidebar-history .history-group:hover::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    margin-top: 10px;
}

.history-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: gap 0.3s ease;
}

.history-header:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    border-radius: 12px;
}

.history-header i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.history-header i:last-child {
    opacity: 1;
    transition: opacity 0.2s ease, max-width 0.3s ease, transform 0.3s ease;
    max-width: 20px;
    overflow: hidden;
}

.sidebar-history:not(.collapsed) .history-header i:last-child {
    transform: rotate(0deg);
}

.sidebar-history.collapsed .history-header i:last-child {
    transform: rotate(180deg);
}

.history-group {
    margin-bottom: 8px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-bottom 0.3s ease;
    max-height: 5000px;
    opacity: 1;
}

.sidebar-history .history-group {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scroll-behavior: smooth;
}

.sidebar-history.collapsed .history-group {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    overflow: hidden;
}

.history-date {
    padding: 12px 16px 8px;
    color: var(--text-faded);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-item {
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    border-radius: 10px;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 0;
}

.history-item:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.history-item.active {
    background-color: var(--bg-active);
    color: var(--text-primary);
}

/* Share actions */
.share-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-action-btn:hover {
    background-color: var(--hover-bg);
}

.share-action-btn.accept {
    color: #4CAF50;
}

.share-action-btn.accept:hover {
    background-color: rgba(76, 175, 80, 0.1);
}

.share-action-btn.deny {
    color: #f44336;
}

.share-action-btn.deny:hover {
    background-color: rgba(244, 67, 54, 0.1);
}

.pending-share {
    border-left: 3px solid var(--accent);
}

.history-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-mode-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.history-item-mode-icon svg {
    width: 17px;
    height: 17px;
}

.history-item-rename-input {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    color: var(--text-primary);
    font-size: inherit;
    font-family: inherit;
    outline: none;
    margin: 0;
    min-width: 0;
    width: 100%;
}


.history-item-edit {
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 4px;
    margin-left: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.history-item-edit:hover {
    background-color: var(--nav-active-bg);
}

.history-item:hover .history-item-edit {
    opacity: 1;
}

.history-item-edit svg {
    width: 16px;
    height: 16px;
    color: var(--text-primary);
}

/* Tool indicator badge for conversations with open tools */
.history-item-tool-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background-color: var(--accent);
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-item.has-tool .history-item-tool-indicator {
    opacity: 1;
}

.history-item-tool-indicator svg {
    width: 12px;
    height: 12px;
    color: white;
}

.history-item-dropdown {
    position: fixed;
    background-color: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    padding: 8px;
    min-width: 190px;
    z-index: 10000;
    visibility: hidden;
    opacity: 0;
    top: auto;
    right: auto;
    transform: translateY(12px);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-item-dropdown.show {
    visibility: visible !important;
    opacity: 1 !important;
    display: block !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-item:hover {
    background-color: var(--nav-active-bg);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-primary);
}

.dropdown-item span {
    flex: 1;
}

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

.dropdown-item-danger {
    color: #ef4444;
}

.dropdown-item-danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.dropdown-item-danger svg {
    color: #ef4444;
}

.history-item:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-secondary);
}

.history-item.active {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.history-item.see-all {
    margin-top: 4px;
    color: var(--text-secondary);
}

/* Sidebar Footer */
.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    position: relative;
}

.user-menu-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
}

.user-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .user-name {
    display: none;
}

.sidebar.collapsed .user-avatar {
    margin: 0 auto;
}

.sidebar.collapsed .user-menu-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--avatar-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid var(--border-color);
}

.user-avatar:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.user-menu {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 0;
    background-color: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px;
    min-width: 240px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 10005;
    animation: slideUpDropdown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

@keyframes slideUpDropdown {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bridge gap between avatar and menu to prevent menu from closing */
.user-menu-container::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 8px;
    z-index: 999;
    pointer-events: auto;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-menu-header {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-faded);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 14px 6px;
    opacity: 0.8;
}

.user-menu-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 12px;
    opacity: 0.3;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-menu-item:hover {
    background-color: var(--nav-active-bg);
}

.user-menu-item i:first-child {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.user-menu-item span {
    flex: 1;
}

.user-menu-item i:last-child {
    font-size: 12px;
    opacity: 0.6;
}

.user-menu-item.has-submenu {
    position: relative;
}

/* Bridge to fill gap between menu item and submenu */
.user-menu-item.has-submenu::after {
    content: '';
    position: absolute;
    top: 0;
    left: 100%;
    width: 10px;
    height: 100%;
    z-index: 1000;
    pointer-events: auto;
}

.user-submenu {
    position: absolute;
    top: 0;
    left: calc(100% + 10px);
    background-color: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px;
    min-width: 200px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateX(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10006;
    pointer-events: auto;
}

.user-submenu.position-bottom {
    top: auto;
    bottom: 0;
}

.user-menu-item.has-submenu:hover .user-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Mobile: Show submenu when toggled via click */
@media (max-width: 1199px) {
    .user-menu-item.has-submenu.active .user-submenu {
        opacity: 1;
        visibility: visible;
        transform: translateX(0);
    }
}

.user-submenu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    transition: background-color 0.2s;
    cursor: pointer;
}

.user-submenu-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.user-submenu-item:hover {
    background-color: var(--nav-active-bg);
}

.sidebar.collapsed .user-menu {
    left: 8px;
    right: auto;
    bottom: calc(100% + 12px);
}

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

.collapse-btn i {
    transition: transform 0.3s ease;
}

.collapse-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

/* Hide collapse button on mobile */
@media (max-width: 1199px) {
    .collapse-btn {
        display: none !important;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    background-color: var(--main-bg);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}


/* AI Disclaimer - only show when chat is active */
.ai-disclaimer {
    display: none;
    text-align: center;
    margin-top: 12px;
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
}


.main-header {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    /* Remove all borders */
    border: none !important;
    border-top: none !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
}

.main-header-logo {
    display: none;
    align-items: center;
    gap: 12px;
    margin-right: auto;
}


.main-header-logo img {
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.main-header-logo-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.sidebar-toggle-btn svg {
    width: 24px;
    height: 24px;
}

.header-segment {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, padding 0.2s ease;
    background: none;
    border: none;
}

.header-segment span {
    display: none;
    white-space: nowrap;
}

.header-segment.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    padding: 8px 16px;
}

.header-segment.active span {
    display: inline;
}

.header-segment svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Hide profile and settings buttons in header right section - DISABLED for redesign */
/* #profileBtn,
#settingsBtn {
    display: none !important;
} */

.header-segment.header-mode-dropdown {
    padding: 8px;
    gap: 4px;
    position: relative;
}

.header-segment.header-mode-dropdown svg:last-child {
    width: 13px;
    height: 13px;
    margin-left: 2px;
}

.header-segment.header-mode-dropdown.active {
    padding: 8px 16px;
}

.header-segment.header-mode-dropdown.active span {
    display: inline;
}

/* Header mode dropdown menu positioning */
#headerModeDropdownMenu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    min-width: 160px;
    margin-top: 0;
}


#headerModeDropdownMenu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

#headerModeDropdownMenu .dropdown-item:hover {
    background-color: var(--nav-active-bg);
}

#headerModeDropdownMenu .dropdown-item svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.header-right-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.tools-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--text-faded);
    background: var(--input-main-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    flex-shrink: 0;
    padding: 0;
    gap: 0;
}

.tools-btn.icon-only {
    padding: 0;
    gap: 0;
}

.tools-btn.icon-only svg {
    width: 18px;
    height: 18px;
}

.tools-btn svg {
    width: 18px;
    height: 18px;
}

.tools-btn span {
    display: none !important;
}

.tools-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    border-color: var(--text-faded);
}

.tools-btn.active {
    background-color: var(--accent);
    color: var(--text-primary);
    border-color: var(--accent);
}

.curriculum-insights-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--text-faded);
    background: var(--input-main-bg);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.curriculum-insights-btn svg {
    width: 18px;
    height: 18px;
}

.curriculum-insights-btn span {
    display: none !important;
}

.curriculum-insights-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    border-color: var(--text-faded);
}

.curriculum-insights-btn.active {
    background-color: var(--accent);
    color: var(--text-primary);
    border-color: var(--accent);
}

.curriculum-insights-btn.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.agent-control-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--text-faded);
    background: var(--input-main-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    flex-shrink: 0;
    padding: 0;
    gap: 0;
    position: relative;
}

.agent-control-button .agent-status-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: background 0.3s ease;
    display: block;
    margin: 0;
    border: 2px solid var(--input-main-bg);
    z-index: 1;
}

.agent-control-button .agent-control-text {
    display: none !important;
}

.agent-control-button:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    border-color: var(--text-faded);
}

.agent-control-button.active {
    background-color: var(--accent);
    color: var(--text-primary);
    border-color: var(--accent);
}

.curriculum-insights-btn.has-update::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--main-bg);
}

.curriculum-insights-input-btn {
    background-color: var(--nav-active-bg);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.curriculum-insights-input-btn svg {
    width: 14px;
    height: 14px;
}

.curriculum-insights-input-btn span {
    display: inline-block;
}

.curriculum-insights-input-btn:hover:not(.disabled) {
    background-color: var(--bg-active);
    color: var(--text-primary);
}

.curriculum-insights-panel {
    position: absolute;
    top: 64px;
    right: 24px;
    width: min(360px, calc(100% - 32px));
    background: var(--card-bg, var(--main-bg));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    padding: 18px 20px;
    z-index: 50;
    display: none;
    flex-direction: column;
    gap: 16px;
    max-height: 70vh;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}

.curriculum-insights-panel.open {
    display: flex;
    animation: fadeInScale 0.18s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.curriculum-insights-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.curriculum-insights-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.curriculum-insights-title svg {
    width: 18px;
    height: 18px;
}

.curriculum-insights-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

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

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

.curriculum-insights-action:hover {
    background: var(--nav-active-bg);
    color: var(--text-primary);
}

.curriculum-insights-action:disabled,
.curriculum-insights-action[aria-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
}

.curriculum-insights-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.curriculum-insights-close:hover {
    background: var(--nav-active-bg);
    color: var(--text-primary);
}

.curriculum-insights-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
}

.curriculum-insights-empty {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.curriculum-insights-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.curriculum-insights-section h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin: 0;
}

.curriculum-insights-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
}

.curriculum-insights-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.curriculum-insights-row span:first-child {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.curriculum-insights-row span:last-child {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.curriculum-insights-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.curriculum-insights-progress-bar {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: var(--border-color);
    overflow: hidden;
}

.curriculum-insights-progress-bar span {
    position: absolute;
    inset: 0;
    background: var(--accent);
    border-radius: inherit;
}

.curriculum-insights-progress label {
    font-size: 12px;
    color: var(--text-secondary);
}

.curriculum-insights-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.curriculum-insights-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-primary);
}

.curriculum-insights-objectives li {
    align-items: flex-start;
}

.curriculum-objective-status {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    background: rgba(29, 78, 216, 0.1);
    color: #1d4ed8;
    flex-shrink: 0;
    margin-top: 2px;
}

.curriculum-objective-status.objective-status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.curriculum-objective-status.objective-status-in_progress {
    background: rgba(249, 115, 22, 0.15);
    color: #c2410c;
}

.curriculum-objective-status.objective-status-pending {
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
}

.curriculum-insights-list li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 6px;
    background: var(--accent);
    flex-shrink: 0;
}

.curriculum-insights-objectives li::before {
    display: none;
}

#curriculumInsightsModal .all-files-modal {
    max-width: 1000px;
    width: 95%;
}

#curriculumInsightsModal .all-files-modal-body {
    padding: 28px;
    background: var(--main-bg);
    max-height: 80vh;
    overflow-y: auto;
}

#curriculumInsightsModal .all-files-modal-body {
    padding: 24px;
}

#curriculumInsightsModal .curriculum-insights-body {
    max-height: calc(80vh - 48px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.curriculum-insights-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    font-size: 12px;
}

.curriculum-insights-link svg {
    width: 14px;
    height: 14px;
}

.curriculum-insights-link:hover {
    text-decoration: underline;
}

.privacy-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

body:not(.user-logged-in) .privacy-indicator {
    display: none;
}

body:not(.user-logged-in) .mode-info-btn {
    display: none;
}

body:not(.user-logged-in) .tools-btn:not(.allow-guest) {
    display: none;
}

body:not(.user-logged-in) .require-login:not(.allow-guest) {
    display: none !important;
}

.main-content:not(.has-chat) .require-chat {
    display: none !important;
}


/* body:not(.user-logged-in) #curriculumBtn rule removed to use allow-guest logic */

/* body.user-logged-in #curriculumBtn rule removed to use allow-guest logic */

.privacy-indicator i {
    font-size: 12px;
}

.centered-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    max-height: 100vh;
    overflow-y: auto;
}


/* Chat section wrapper - 550px wide, contains chat messages and input */
.chat-section-wrapper {
    display: flex;
    flex-direction: column;
    width: 550px;
    flex: 0 0 550px;
    border-right: 1px solid var(--border-color);
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* Remove border-right when tool is open */
.main-content.has-tool-open .chat-section-wrapper {
    border-right: none;
}

.chat-section-wrapper .chat-messages-container {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.chat-section-wrapper .main-input-container {
    width: 100%;
    flex: 0 0 auto;
}

/* Tool interface panel - inside centered-content, hidden by default */
.tool-interface-panel {
    display: none;
    flex: 1;
    background-color: var(--input-bg);
    /* Darker charcoal grey for tool section */
    border-radius: 20px;
    /* Add border radius */
    /* Removed border-left - no border between chat and tool */
    position: relative;
    overflow: hidden;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.tool-interface-panel.show {
    display: flex;
}

.tool-interface-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.tool-interface-close:hover {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.tool-interface-close svg {
    width: 20px;
    height: 20px;
}

.tool-interface-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.tool-interface-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px;
    /* Removed border-bottom */
    flex-shrink: 0;
}

.tool-interface-title-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tool-interface-header h2 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.tool-interface-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
    line-height: 1.4;
}

.tool-interface-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-interface-back {
    display: none;
    align-items: center;
    gap: 6px;
    border: none;
    background: var(--nav-active-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.tool-interface-back:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.tool-interface-back-icon {
    font-size: 16px;
    line-height: 1;
}

.tool-interface-body {
    flex: 1;
}

.tool-interface-description {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.tool-interface-placeholder {
    background-color: var(--input-bg);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: var(--text-secondary);
}

.tool-interface-placeholder p {
    margin: 0;
    font-size: 14px;
}

.mode-info-btn {
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
}

.mode-info-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    border-radius: 50%;
}

.mode-info-btn svg {
    width: 15px;
    height: 15px;
}

/* Chat Messages Container */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
    margin: 0;
    width: 100%;
    min-height: 0;
    /* Ensure scrolling works properly */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 8px;
    width: 100%;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-message.search-highlight {
    background-color: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    padding: 8px;
    margin: 8px -8px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.search-match {
    background-color: rgba(59, 130, 246, 0.4);
    color: var(--text-primary);
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.user-message {
    justify-content: flex-end;
}

.assistant-message {
    justify-content: flex-start;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 13px;
}

.assistant-avatar {
    background-color: transparent;
}

.assistant-avatar img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: contain;
}

.message-content {
    max-width: 80%;
    min-width: 0;
}

.user-message-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    width: 100%;
}

.assistant-message-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.assistant-message-text {
    padding: 0;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

/* Formatted Content Styles */
.formatted-content {
    line-height: 1.5;
    white-space: normal;
}

.formatted-content h1,
.formatted-content h2,
.formatted-content h3,
.formatted-content h4,
.formatted-content h5,
.formatted-content h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: var(--text-primary);
}

.formatted-content h1 {
    font-size: 1.75em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.3em;
}

.formatted-content h2 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3em;
}

.formatted-content h3 {
    font-size: 1.25em;
}

.formatted-content h4 {
    font-size: 1.1em;
}

.formatted-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5em 0;
}

.formatted-content p {
    margin: 0.5em 0;
}

.formatted-content ul,
.formatted-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.formatted-content li {
    margin: 0.25em 0;
}

.formatted-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.formatted-content code {
    background-color: var(--input-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: var(--text-primary);
}

.formatted-content pre {
    background-color: var(--input-bg);
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1em 0;
}

.formatted-content pre code {
    background: none;
    padding: 0;
}

.formatted-content blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1em;
    margin: 1em 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* MathJax Styles */
.formatted-content .MathJax {
    color: var(--text-primary) !important;
}

.formatted-content .MathJax_Display {
    margin: 1.5em 0;
    text-align: center;
}

.formatted-content mjx-container {
    display: inline-block;
    margin: 0.5em 0;
}

.formatted-content mjx-container[display="true"] {
    display: block;
    margin: 1.5em auto;
    text-align: center;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.message-text {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: var(--font-size-message);
}

.user-message-text {
    background-color: var(--input-bg);
    padding: 8px 14px;
    border-radius: 16px;

    color: var(--text-primary);
    max-width: 100%;
}

/* Message Files */
.message-files {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-image {
    max-width: 150px;
    max-height: 100px;
    width: auto;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.assistant-response-image {
    display: block;
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
    margin: 8px 0;
}

@media (max-width: 1199px) {
    .assistant-response-image {
        max-width: 100%;
        height: 240px;
        max-height: 240px;
    }
}

.message-image:hover {
    transform: scale(1.02);
}

/* Image Lightbox */
.image-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.image-lightbox-overlay.show {
    display: flex;
}

.image-lightbox-content {
    position: relative;
    max-width: 80vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-lightbox-content img {
    max-width: 80%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
}

.image-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001;
}

.image-lightbox-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.image-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001;
}

.image-lightbox-nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.image-lightbox-nav.show {
    display: flex;
}

.image-lightbox-prev {
    left: 20px;
}

.image-lightbox-next {
    right: 20px;
}

.image-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    backdrop-filter: blur(4px);
}

.message-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--input-bg);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.message-file-item.clickable {
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.message-file-item.clickable:hover {
    background-color: var(--bg-active);
    transform: translateY(-1px);
}

.message-file-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.assistant-message-text {
    padding: 0;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    align-items: center;
}

.message-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.message-action-btn:hover {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-radius: 50%;
}

.message-action-btn i {
    font-size: 14px;
}

.message-action-btn.hint-btn.active {
    background-color: var(--accent);
    color: white;
    border-radius: 50%;
}

/* Message Hint Container */
.message-hint-container {
    margin-top: 12px;
    padding: 12px 16px;
    background-color: var(--input-bg);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-hint-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.message-hint-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-hint-text {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
}

/* Structured Hint Styles */
.message-hint-content.structured-hint {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hint-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hint-label {
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.hint-value {
    color: var(--text-primary);
    margin-left: 0;
}

.hint-list {
    margin: 4px 0 0 0;
    padding-left: 20px;
    list-style-type: none;
}

.hint-list li {
    margin: 3px 0;
    color: var(--text-primary);
    font-style: italic;
}

.hint-list li::before {
    content: "• ";
    color: var(--accent);
    font-weight: bold;
    margin-right: 6px;
}

/* Message Guidance Container */
.message-guidance-container {
    margin-top: 12px;
    padding: 12px 16px;
    background-color: var(--input-bg);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    animation: fadeIn 0.2s ease-in;
}

.message-guidance-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.message-guidance-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-guidance-text {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
}

.message-action-btn.info-btn.active {
    background-color: var(--accent);
    color: var(--bg-primary);
    border-radius: 50%;
}

/* Loading Indicator */
.loading-message .message-text {
    padding: 12px 0;
}

.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: loading-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loading-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Lessons Container */
.lessons-container {
    background-color: var(--input-bg);

    border-radius: 12px;
    padding: 24px;
    margin-top: 8px;
}

.lessons-container h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.lessons-summary {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lesson-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background-color: var(--main-bg);

    border-radius: 8px;
    transition: all 0.2s;
}

.lesson-item:hover {
    background-color: var(--nav-active-bg);
}

.lesson-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--nav-active-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    color: var(--text-primary);
}

.lesson-content {
    flex: 1;
}

.lesson-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.lesson-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.lesson-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.lesson-status.completed {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.lesson-status.pending {
    background-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

/* Memory Schedule Container */
.memory-schedule-container {
    background-color: var(--input-bg);

    border-radius: 12px;
    padding: 24px;
    margin-top: 8px;
}

.memory-schedule-container h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.memory-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.memory-info p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.memory-info p strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Scrollbar styling */
.chat-messages-container::-webkit-scrollbar {
    width: 8px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-faded);
}

/* Modern scrollbar styling for all scrollable elements */
*::-webkit-scrollbar {
    width: 8px;
}

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

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

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-faded);
}

/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.main-logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    margin-bottom: 48px;
}

.main-logo img,
.main-logo-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

.logo-text {
    font-size: 43px;
    font-weight: 500;
    letter-spacing: -2px;
    margin: 0;
}

.logo-text-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.mode-subtitle {
    font-size: var(--font-size-title);
    font-weight: 400;
    color: var(--text-secondary);
    margin: 0;
    opacity: 0.8;
}

.main-input-container {
    width: 100%;
}

.input-surface {
    background-color: var(--input-main-bg);
    border: 1px solid var(--border-color);
    border-radius: 35px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.input-surface:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

/* File Preview Container */
.file-preview-container {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-bottom: 0;
    padding: 12px 17px 4px 17px;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    background-color: transparent;
    border: none;
    border-radius: 0;
}

/* File Error Message */
.file-error-message {
    padding: 6px 17px 8px 17px;
    font-size: 12px;
    color: #ef4444;
    background-color: transparent;
    border-radius: 0;
    border: none;
    display: none;
    animation: fadeIn 0.2s ease;
}

.file-error-message.show {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-preview-container:not([style*="display: none"])+.file-error-message+#fileInput+.main-input-box,
.file-preview-container:not([style*="display: none"])+#fileInput+.main-input-box {
    margin-top: 0;
}


.file-preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background-color: var(--nav-active-bg);
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 80px;
    max-width: 100px;
    position: relative;
    flex-shrink: 0;
}

.file-preview-item:hover {
    background-color: var(--input-main-bg);
}

.file-preview-image {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    background-color: var(--input-main-bg);
}

.file-preview-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

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

.file-preview-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    text-align: center;
}

.file-preview-name {
    font-size: 10px;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.file-preview-size {
    font-size: 9px;
    color: var(--text-secondary);
}

.file-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
}

.file-preview-remove:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.file-preview-remove svg {
    width: 12px;
    height: 12px;
}

.main-input-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: transparent;
    border-radius: 0;
    padding: 10px 15px 10px 15px;
    margin-bottom: 0;
    border: none;
    outline: none !important;
}

.file-preview-container:not([style*="display: none"])~.main-input-box {
    margin-top: 0;
}


.input-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--text-faded);
    background: var(--input-main-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.input-icon-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    border-color: var(--text-faded);
}

.input-icon-btn svg {
    width: 18px;
    height: 18px;
}

.main-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    padding: 0;
    margin: 0;
    resize: none;
    outline: none !important;
    font-family: inherit;
    line-height: 1.5;
    min-height: 24px;
    max-height: 400px;
    transition: height 0.1s ease-out;
}

.main-input::placeholder {
    color: var(--text-faded);
    font-size: 15px;
}

.asai-hint-gif {
    width: 30px;
    vertical-align: middle;
    margin: 0 4px;
}

.asai-btn-gif {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--text-faded);
    background: white;
    color: #1a1a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0;
    padding: 0;
    position: relative;
}

.send-button:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    border-color: var(--text-faded);
}

.send-button svg {
    position: absolute;
    width: 18px;
    height: 18px;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-button .live-chat-icon {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.send-button .send-icon {
    opacity: 0;
    transform: scale(0.8) translateY(8px);
    display: block !important;
}

.send-button.has-text .live-chat-icon {
    opacity: 0;
    transform: scale(0.8) translateY(-8px);
    pointer-events: none;
}

.send-button.has-text .send-icon {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.voice-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--text-faded);
    background: var(--input-main-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    flex-shrink: 0;
    padding: 0;
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}

.voice-button.hide {
    opacity: 0;
    transform: scale(0.8);
    visibility: hidden;
    pointer-events: none;
}

.voice-button:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    border-color: var(--text-faded);
}

.voice-button svg {
    width: 18px;
    height: 18px;
}

.input-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

.input-dropdown {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s;
}

.input-dropdown:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.input-dropdown i {
    font-size: 10px;
}

#autoDropdown {
    padding: 8px 10px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 10px 14px;
    background-color: var(--input-bg);
    border: none;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.action-btn i,
.action-btn svg {
    font-size: 14px;
    width: 16px;
    height: 16px;
}

.action-btn svg {
    fill: currentColor;
}

.action-btn i:last-child {
    font-size: 10px;
    margin-left: 4px;
}

.deepsearch-btn svg {
    width: 14px;
    height: 14px;
}

/* Action Button Group (Split Button) */
.action-btn-group {
    display: flex;
    align-items: center;
    position: relative;
    background-color: var(--input-bg);
    border-radius: 20px;
    transition: all 0.2s;
}

.action-btn-group:hover {
    background-color: var(--nav-active-bg);
}

.action-btn-group .action-btn {
    background: transparent !important;
    padding-right: 8px;
}

.action-btn-dropdown-toggle {
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0 10px;
    height: 38px;
    cursor: pointer;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn-dropdown-toggle:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.action-btn-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--dropdown-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1000;
    flex-direction: column;
    gap: 2px;
}

.action-btn-dropdown.show {
    display: flex;
}

.action-btn-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.action-btn-dropdown-item:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.action-btn-dropdown-item i {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* Upgrade Card */
.upgrade-card {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px 16px 18px;
    background-color: var(--input-bg);

    border-radius: 12px;
    max-width: 300px;
}

.upgrade-content {
    flex: 1;
}

.upgrade-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upgrade-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.upgrade-btn {
    padding: 8px 20px;
    background-color: var(--upgrade-purple);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.upgrade-btn:hover {
    opacity: 0.9;
}

/* Dropdown Menu */
.dropdown-menu {
    position: fixed;
    background-color: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px;
    display: none;
    z-index: 1020;
    min-width: 160px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

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

.dropdown-item {
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-item svg,
.dropdown-item i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.dropdown-item span {
    flex: 1;
}

.dropdown-item .fa-chevron-right {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.6;
}

.attach-dropdown-menu {
    min-width: 220px;
    position: fixed;
}

.dropdown-item {
    position: relative;
}

.recent-item {
    position: relative;
}

.recent-files-preview {
    position: fixed;
    background-color: var(--input-bg);
    border-radius: 8px;
    padding: 12px;
    width: fit-content;
    min-width: 320px;
    max-width: 340px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1021;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.2s, transform 0.2s;
    border: 1px solid var(--border-color);
}

.recent-files-preview.show {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.recent-files-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 14px;
}

.recent-files-grid {
    display: grid;
    grid-template-columns: repeat(2, 150px);
    gap: 8px;
    width: fit-content;
}

.recent-file-item {
    position: relative;
    width: 150px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    background-color: var(--input-bg);
    flex-shrink: 0;
}

.recent-file-item:hover {
    transform: scale(1.05);
}

.recent-file-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--input-bg);
    color: var(--text-secondary);
}

.recent-file-icon svg {
    width: 32px;
    height: 32px;
}

.recent-files-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 14px;
}

.recent-files-more-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background-color: var(--nav-active-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-files-more-btn:hover {
    background-color: var(--input-bg);
    border-color: var(--text-secondary);
}

/* All Files Modal Styles */
.all-files-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.all-files-modal-overlay.show {
    display: flex;
}

.all-files-modal {
    background-color: var(--main-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.all-files-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.all-files-modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.all-files-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
}

.all-files-modal-close:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.all-files-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    background: var(--main-bg);
}

.all-files-loading,
.all-files-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 20px;
    font-size: 14px;
}

.all-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.all-file-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background-color: var(--nav-active-bg);
    border: 1px solid var(--border-color);
}

.all-file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.all-file-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.all-file-icon {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--input-bg);
    color: var(--text-secondary);
}

.all-file-icon svg {
    width: 40px;
    height: 40px;
}

.all-file-info {
    padding: 10px;
}

.all-file-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.all-file-size {
    font-size: 11px;
    color: var(--text-secondary);
}

.dropdown-item:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.dropdown-item.active {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

/* Mode Info Popup */
.mode-info-popup {
    min-width: 320px;
    max-width: 400px;
    padding: 0;
    overflow: hidden;
    position: fixed;
    z-index: 2000;
}

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

.mode-info-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.mode-info-section {
    padding: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.mode-info-item {
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.mode-info-item:hover {
    background-color: var(--nav-active-bg);
}

.mode-info-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.mode-info-title strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.mode-info-shortcut {
    font-size: 12px;
    color: var(--text-secondary);
    background-color: var(--input-bg);
    padding: 4px 8px;
    border-radius: 4px;
}

.mode-info-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.mode-info-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.mode-info-footer p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.mode-info-footer kbd {
    display: inline-block;
    padding: 2px 6px;
    background-color: var(--input-bg);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-primary);
}

/* Search Popup */
.search-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(12px);
}

.search-popup.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.search-popup-content {
    background-color: var(--sidebar-bg);
    border-radius: 20px;
    width: 80%;
    max-width: 1400px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    border: none;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-popup-content.minimized {
    width: 50%;
    height: 70vh;
}

.search-popup-header {
    position: relative;
    padding: 32px;
    border-bottom: none;
    background-color: transparent;
}

.search-popup-input {
    width: 100%;
    padding: 16px 48px 16px 0;
    /* Remove left padding to align with text */
    background-color: transparent;
    border: none;
    border-radius: 0;
    color: var(--text-primary);
    font-size: 17px;
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
}

.search-popup-input:focus {
    background-color: transparent;
    box-shadow: none;
}

.search-popup-header i {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 20px;
    opacity: 0.7;
}

.search-popup-split {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: var(--sidebar-bg);
}

/* Sidebar */
.search-popup-sidebar {
    width: 380px;
    display: flex;
    flex-direction: column;
    border-right: none;
    background-color: transparent;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-popup-content.minimized .search-popup-sidebar {
    width: 100%;
}

.search-sidebar-section {
    padding: 16px 24px;
}

.search-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background-color: var(--input-bg);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.search-action-item:hover {
    background-color: var(--nav-active-bg);
    transform: translateY(-1px);
}

.search-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.search-section {
    padding: 8px 12px;
    margin-bottom: 12px;
}

.search-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 12px;
}

.search-section-header h3 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: 0.8;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.search-item:hover,
.search-item.hovered {
    background-color: var(--nav-active-bg);
}

.search-item.active {
    background-color: var(--bg-active);
}

.search-item-mode-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background-color: var(--input-bg);
    border-radius: 8px;
    flex-shrink: 0;
}

.search-item-title {
    flex: 1;
    color: var(--text-primary);
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}

.search-item-time {
    color: var(--text-tertiary);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0.8;
}

/* Preview Pane */
.search-popup-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    border-left: none;
    background-color: transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    overflow: hidden;
}

.search-popup-content.minimized .search-popup-preview {
    flex: 0;
    width: 0;
    opacity: 0;
    pointer-events: none;
}

.preview-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 16px;
    opacity: 0.6;
}

.preview-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    /* Contain scrolling to the body */
}

.preview-body {
    flex: 1;
    overflow-y: auto !important;
    /* Force scroll visibility */
    padding: 12px 40px 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 0;
    /* Important for flex-grow scrolling behavior */
    min-height: 0;
}

.preview-message {
    max-width: 90%;
    padding: 18px 22px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.6;
}

.preview-message.user {
    align-self: flex-end;
    background-color: var(--accent-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.preview-message.assistant {
    align-self: flex-start;
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: none;
}

.preview-footer {
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--sidebar-bg);
    border-top: none;
}

.preview-actions-right {
    display: flex;
    gap: 12px;
    opacity: 0;
    /* Hidden by default */
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.search-popup-content.has-hovered-item .preview-actions-right {
    opacity: 1;
    /* Visible on hover */
    pointer-events: auto;
}

.preview-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.expand-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    opacity: 0.7;
}

.expand-btn:hover {
    color: var(--text-primary);
    background: var(--input-bg);
    opacity: 1;
}

.expand-btn svg {
    display: block;
}

.preview-action-btn:hover {
    background-color: var(--nav-active-bg);
    transform: translateY(-1px);
}

.preview-action-btn.primary {
    background-color: var(--accent-primary);
    color: white;
}

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

.preview-action-btn.danger {
    color: #ef4444;
}

.preview-action-btn.danger:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.keyboard-shortcut {
    font-size: 10px;
    opacity: 0.6;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.expand-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.expand-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.search-loading,
.search-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.search-loading i {
    animation: spin 1s linear infinite;
    font-size: 24px;
    margin-bottom: 12px;
}

.expand-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.expand-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.search-footer-actions {
    display: flex;
    gap: 8px;
}

.search-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--input-bg);

    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-action-btn:hover {
    background-color: var(--nav-active-bg);
}

.search-action-btn i {
    font-size: 12px;
}

.keyboard-shortcut {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: 4px;
}

/* Responsive */
@media (max-width: 1199px) {
    .main-header-logo,

    /* Hide drawer icon if user isn't logged in */
    body:not(.user-logged-in) .sidebar-toggle-btn {
        display: none !important;
    }

    .sidebar-toggle-btn {
        display: flex;
    }

    /* Hide logo text on mobile always (regardless of login status or chat state) */
    .main-header-logo-text {
        display: none !important;
    }

    /* Hide the entire logo container on mobile when not logged in - more specific */
    body:not(.user-logged-in) .main-header .main-header-logo,
    body:not(.user-logged-in) .main-header .main-header-logo *,
    body:not(.user-logged-in) .main-header .main-header-logo-text {
        display: none !important;
        visibility: hidden !important;
    }

    /* Hide header bar logo text on mobile when not logged in */
    body:not(.user-logged-in) .main-header-bar .header-logo-text {
        display: none !important;
        visibility: hidden !important;
    }

    .main-header {
        justify-content: space-between;
    }


    /* Hide mode info button on mobile */
    .mode-info-btn {
        display: none !important;
    }

    /* Keep buttons circular on mobile - same as desktop */
    .tools-btn {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        justify-content: center;
    }

    .tools-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    .curriculum-insights-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    .curriculum-insights-btn {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
    }

    /* Hide labels on header buttons on mobile in chat view */
    .main-content.has-chat .main-header .header-btn.pill-btn span {
        display: none !important;
    }

    .main-content.has-chat .main-header .header-btn.pill-btn {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        justify-content: center !important;
        min-width: 36px !important;
        border-radius: 50% !important;
    }

    .privacy-indicator span {
        display: none;
    }

    .privacy-indicator {
        gap: 0;
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .privacy-indicator i {
        font-size: 18px !important;
    }

    /* Agent control button on mobile - keep same circular style */
    .agent-control-button {
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        justify-content: center;
        min-width: 36px !important;
    }

    .agent-control-button .agent-status-indicator {
        width: 8px !important;
        height: 8px !important;
        margin: 0 !important;
        border-radius: 50%;
        top: 4px !important;
        right: 4px !important;
    }

    /* Make input section more mobile-friendly */
    .main-input-container {
        padding: 12px 16px 16px 16px;
    }

    .main-input-box {
        padding: 8px 10px 8px 10px;
        gap: 8px;
    }

    .main-input {
        padding: 0 8px;
        font-size: 15px;
        min-width: 0;
    }

    .input-icon-btn {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }

    .input-right-actions {
        gap: 4px;
        flex-shrink: 0;
    }

    .input-dropdown {
        padding: 8px 10px;
        gap: 4px;
        font-size: 13px;
    }

    .input-dropdown span {
        display: none;
    }

    .input-dropdown svg:first-of-type {
        width: 16px;
        height: 16px;
    }

    .input-dropdown svg:last-of-type {
        width: 12px;
        height: 12px;
    }

    /* Fix dropdown menu positioning on mobile */
    .dropdown-menu {
        max-width: calc(100vw - 32px);
    }

    /* Fix history-item-dropdown positioning on mobile */
    .history-item-dropdown {
        /* Ensure dropdown is visible on mobile - position from right edge */
        right: 16px !important;
        left: auto !important;
        /* Ensure it doesn't overflow the viewport */
        max-width: calc(100vw - 32px) !important;
        /* Ensure it's positioned correctly */
        transform: none !important;
    }

    .attach-dropdown-menu {
        /* Remove fixed positioning on mobile to allow JS positioning to work */
        /* Ensure it doesn't overflow the viewport */
        max-width: calc(100vw - 32px) !important;
        /* Ensure it's positioned correctly */
        transform: none !important;
    }

    /* Make tools modal mobile-friendly */
    .settings-modal-overlay {
        padding: 12px;
    }

    #toolsModal .settings-modal {
        min-width: 0 !important;
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 24px);
        height: auto;
        margin: 0;
    }

    #toolsModal .settings-modal-container {
        padding: 16px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    .tools-modal-header {
        margin-bottom: 16px;
    }

    .tools-modal-header h2 {
        font-size: 20px;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tool-card {
        padding: 16px;
    }

    .tool-name {
        font-size: 16px;
    }

    .tool-description {
        font-size: 13px;
    }

    .tools-section {
        margin-bottom: 24px;
    }

    .settings-modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    .tools-section-heading {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .coming-soon-section {
        margin-top: 24px;
        padding-top: 24px;
    }

    /* Make learner report modal mobile-friendly */
    #learnerReportModal .settings-modal {
        min-width: 0 !important;
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 24px);
        height: auto;
        margin: 0;
    }

    #learnerReportModal .settings-modal-container {
        max-height: calc(100vh - 100px);
        padding: 0;
    }

    #learnerReportModal .settings-modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    /* Make settings modal mobile-friendly */
    #settingsModal .settings-modal {
        min-width: 0 !important;
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 24px);
        height: auto;
        margin: 0;
    }


    #settingsModal .settings-modal-container {
        flex-direction: column;
        max-height: calc(100vh - 100px);
        overflow: hidden;
    }

    .settings-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        max-height: none;
        border-bottom: 1px solid var(--border-color);
        overflow-y: visible;
        display: block !important;
    }

    /* Hide sidebar when showing content on mobile */
    #settingsModal.showing-content .settings-sidebar {
        display: none !important;
    }

    /* Hide content initially on mobile, show menu first */
    .settings-content {
        display: none !important;
    }

    /* Show content when section is selected on mobile */
    #settingsModal.showing-content .settings-content {
        display: flex !important;
        flex-direction: column;
    }

    .settings-title {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .settings-nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 0;
    }

    .settings-nav-item {
        padding: 10px 8px;
        font-size: 13px;
        gap: 8px;
    }

    .settings-nav-item svg {
        width: 18px;
        height: 18px;
    }

    .settings-content {
        flex: 1;
        overflow-y: auto;
        max-height: calc(100vh - 200px);
        padding: 0;
        position: relative;
    }

    .settings-back-btn {
        display: none;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        background: transparent;
        border: none;
        color: var(--text-primary);
        font-size: 15px;
        font-weight: 500;
        cursor: pointer;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
        justify-content: flex-start;
        transition: background-color 0.2s;
    }

    .settings-back-btn:hover {
        background-color: var(--nav-active-bg);
    }

    .settings-back-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Show back button on mobile when content is shown */
    #settingsModal.showing-content .settings-back-btn {
        display: flex !important;
    }

    .settings-section {
        padding: 16px !important;
        min-height: auto !important;
        max-height: none !important;
    }

    .settings-section-header {
        margin-bottom: 16px;
    }

    .settings-section-header h3 {
        font-size: 20px;
    }

    .settings-section-body {
        gap: 16px;
    }

    .settings-account-info {
        flex-wrap: wrap;
        padding-bottom: 16px;
        gap: 12px;
    }

    .settings-account-avatar {
        width: 56px;
        height: 56px;
    }

    .settings-account-details h4 {
        font-size: 16px;
    }

    .settings-account-details p {
        font-size: 13px;
    }

    .settings-account-section {
        gap: 12px;
    }

    .settings-account-item {
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 0;
    }

    .settings-account-item-left {
        flex: 1;
        min-width: 0;
        width: 100%;
    }

    .settings-btn {
        flex-shrink: 0;
        width: auto;
        min-width: 100px;
    }

    /* Statistics grid on mobile */
    .settings-section-body>div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Tool interface as popup on mobile */

    /* Hide tool panel from split-screen on mobile */
    .tool-interface-panel {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        z-index: 10003 !important;
        border-radius: 0 !important;
        background-color: var(--sidebar-bg) !important;
    }

    /* Show tool panel as popup on mobile */
    .tool-interface-panel.show {
        display: flex !important;
    }

    /* Tool popup overlay */
    .tool-popup-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(2px);
        z-index: 10002;
        display: none;
    }

    .tool-popup-overlay.show {
        display: block;
    }

    .tool-interface-header {
        padding: 12px 16px !important;
        border-bottom: 1px solid var(--border-color);
    }

    .tool-interface-header h2 {
        font-size: 20px !important;
    }

    .tool-interface-content {
        padding: 16px !important;
    }

    /* Tool indicator button to open popup on mobile */
    #toolMobileIndicator {
        position: fixed !important;
        bottom: 80px !important;
        right: 16px !important;
        background-color: var(--accent) !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        width: 56px !important;
        height: 56px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
        z-index: 10001 !important;
        transition: transform 0.2s !important;
    }

    #toolMobileIndicator:hover {
        transform: scale(1.1);
    }

    #toolMobileIndicator svg {
        width: 24px;
        height: 24px;
    }

    /* Fix body and page height on mobile - prevent keyboard scroll-to-focus shift */
    /* position:fixed + inset:0 locks the element so the browser's native
       scroll-to-focus mechanism CANNOT shift the page when the keyboard opens.
       overflow:hidden alone is insufficient — browsers bypass it for focus events. */
    html {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        overscroll-behavior: none !important;
    }

    body {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100vw !important;
        overflow: hidden !important;
        overscroll-behavior: none !important;
    }

    .app-container {
        height: 100% !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow: hidden !important;
        position: relative;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Add padding-top to app-container on mobile when session-checked to account for header bar (56px) */
    body:not(.user-logged-in).session-checked .app-container {
        padding-top: 56px !important;
    }

    /* Fix centering for logged-in users on mobile */
    body.user-logged-in .app-container {
        margin-left: 0 !important;
    }

    /* Ensure main-header-bar is visible and properly positioned on mobile for not logged in users */
    body:not(.user-logged-in).session-checked .main-header-bar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        padding: 0 16px !important;
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: 56px !important;
    }

    /* Ensure main-content doesn't get affected by session-checked padding */
    body:not(.user-logged-in).session-checked .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* Ensure centered-content is not affected by session-checked on mobile */
    body:not(.user-logged-in).session-checked .main-content:not(.has-chat) .centered-content {
        margin: 0 auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }

    .main-content {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        width: 100% !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    .main-header {
        padding-top: 0 !important;
        margin-top: 0 !important;
        padding: 0 15px !important;
    }

    /* Hide main-header completely when user is not logged in */
    body:not(.user-logged-in) .main-header {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Fix header visibility on mobile when no chat (same as has-chat) - only for logged in users */
    /* Use fixed positioning so it stays visible even when keyboard opens */
    body.user-logged-in .main-content:not(.has-chat) .main-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        background-color: var(--main-bg) !important;
        border-bottom: none !important;
        width: 100% !important;
        padding: 10px 15px !important;
        justify-content: flex-end !important;
    }

    /* Add padding-top to main-content:not(.has-chat) to account for fixed header - only for logged in users */
    body.user-logged-in .main-content:not(.has-chat) {
        padding-top: 56px !important;
    }


    /* Prevent horizontal scrolling on common elements */
    .main-input-container,
    .chat-messages-container,
    .main-header,
    .header-right-section {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1500;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        box-shadow: none;
        will-change: transform;
        width: 250px;
        /* Override base sidebar transitions */
        transition-property: transform, box-shadow;
    }

    .sidebar.show {
        transform: translateX(0) !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    /* Swipe indicator area on left edge */
    .swipe-indicator {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 20px;
        z-index: 1000;
        touch-action: pan-y;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1400;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.show {
        display: block;
        pointer-events: all;
        opacity: 1;
    }

    /* Ensure overlay doesn't cover header area */
    .sidebar-overlay.show {
        top: 56px;
        /* Start below header on mobile (10px padding + ~36px content) */
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {

    .logo-text {
        font-size: 48px;
    }

    .main-logo img,
    .main-logo-img {
        width: 80px;
        height: 80px;
    }

    .upgrade-card {
        position: relative;
        bottom: auto;
        right: auto;
        margin-top: 24px;
        max-width: 100%;
    }
}

/* Login Prompt Modal */
.login-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.login-prompt-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.login-prompt-modal {
    background-color: var(--sidebar-bg);
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.close-prompt-x {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.close-prompt-x:hover {
    background-color: var(--input-bg);
}

.login-prompt-overlay.show .login-prompt-modal {
    transform: scale(1);
}

.login-prompt-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-prompt-header h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.login-prompt-header p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
}

.login-prompt-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--avatar-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.close-prompt-btn {
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.login-prompt-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.continue-btn:hover {
    background-color: var(--nav-active-bg);
}

.continue-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.continue-btn:disabled:hover {
    background-color: var(--input-bg);
}

.continue-email {
    background-color: var(--avatar-blue);
    color: white;
}

.continue-email:hover {
    opacity: 0.9;
}

.or-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 8px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.or-separator::before,
.or-separator::after {
    content: '';
    flex: 1;
}

.or-separator span {
    padding: 0 12px;
}

.login-email-input {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    border: none;
    font-family: inherit;
}

.login-email-input::placeholder {
    color: var(--text-faded);
}

.login-email-input:focus {
    background-color: var(--nav-active-bg);
}

/* Disable input when limit reached */
.main-input-box:has(.main-input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

.main-input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Loading Overlay */
/* Scoped to main-content by parent */
.main-content {
    position: relative;
    /* Ensure overlay is absolute relative to this */
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--main-bg);
    display: none !important;
    /* Forces hidden */
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
    /* Lower z-index so it doesn't cover sidebar (usually 1400+) */
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
    border-radius: inherit;
    /* Inherit border radius from main-content if any */
}

.loading-overlay.show {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.3s ease;
}

.loading-logo {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-logo img {
    width: 80px;
    height: 80px;
    animation: pulse 2s ease-in-out infinite;
}

.loading-logo-text {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner .spinner-circle {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 15px;
    animation: fadeInOut 2s ease-in-out infinite;
}

/* Rename Modal */
.rename-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
}

.rename-modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.rename-modal {
    background-color: var(--input-bg);

    border-radius: 12px;
    padding: 0;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.rename-modal-overlay.show .rename-modal {
    transform: scale(1);
}

.rename-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
}

.rename-modal-header h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.rename-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
}

.rename-modal-close:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.rename-modal-close svg {
    width: 20px;
    height: 20px;
}

.rename-modal-body {
    padding: 24px;
}

.rename-modal-input {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--sidebar-bg);
    color: var(--text-primary);

    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.rename-modal-input:focus {
    background-color: var(--nav-active-bg);
}

.rename-modal-input::placeholder {
    color: var(--text-faded);
}

.rename-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
}

.rename-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.rename-modal-cancel {
    background: transparent;
    color: var(--text-secondary);
}

.rename-modal-cancel:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.rename-modal-save {
    background-color: var(--avatar-blue);
    color: white;
}

.rename-modal-save:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Delete Modal */
.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.delete-modal-overlay.show {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.2s ease;
}

.delete-modal {
    background-color: var(--input-bg);

    border-radius: 12px;
    padding: 0;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.delete-modal-overlay.show .delete-modal {
    transform: scale(1);
}

.delete-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
}

.delete-modal-header h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.delete-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
}

.delete-modal-close:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.delete-modal-close svg {
    width: 20px;
    height: 20px;
}

.delete-modal-body {
    padding: 24px;
}

.delete-modal-body p {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
}

.delete-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
}

.delete-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.delete-modal-cancel {
    background: transparent;
    color: var(--text-secondary);
}

.delete-modal-cancel:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.delete-modal-confirm {
    background-color: #ef4444;
    color: white;
}

.delete-modal-confirm:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Monitor Child Tabs */
.monitor-tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.monitor-tab-btn:hover {
    color: var(--text-primary);
    background-color: var(--nav-active-bg);
}

.monitor-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.stat-period-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.stat-period-btn:hover {
    color: var(--text-primary);
}

.stat-period-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Settings Modal */
.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    backdrop-filter: blur(4px);
}

.settings-modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.settings-modal {
    background-color: var(--sidebar-bg);
    border-radius: 16px;
    padding: 0;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    height: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-modal-overlay.show .settings-modal {
    transform: scale(1);
}

.settings-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
    z-index: 10;
}

.settings-modal-close:hover {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.settings-modal-close svg {
    width: 20px;
    height: 20px;
}

.settings-modal-container {
    display: flex;
    height: auto;
    max-height: 85vh;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Tools modal specific styling */
#toolsModal .settings-modal {
    min-width: 600px;
    max-width: 1000px;
}

#toolsModal .settings-modal-container {
    display: block;
    padding: 24px;
    min-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
}


/* Learner Report modal specific styling */
#learnerReportModal .settings-modal {
    min-width: 840px;
    max-width: 1280px;
    max-height: 95vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#learnerReportModal .learner-report-content-wrapper {
    display: block;
    padding: 0;
    flex: 1;
    overflow: hidden;
}

#learnerReportModal .settings-content {
    padding: 32px;
    overflow-y: auto;
    background: var(--main-bg);
    max-height: calc(95vh - 64px);
}

@media (max-width: 1024px) {
    #learnerReportModal .settings-modal {
        min-width: 0;
        width: 95vw;
        max-height: 92vh;
    }

    #learnerReportModal .settings-content {
        padding: 20px;
    }
}

/* Tools Grid Styles */
.tools-modal-header {
    margin-bottom: 24px;
}

.tools-modal-header h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--text-faded);
}

.tool-card.available {
    border-color: var(--accent);
}

.tool-card.coming-soon {
    opacity: 0.7;
    cursor: not-allowed;
}

.tool-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
}

.tool-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.tool-card.available .tool-status-badge {
    background-color: rgba(74, 116, 232, 0.1);
    color: var(--accent);
}

.tool-card.coming-soon .tool-status-badge {
    background-color: rgba(119, 119, 119, 0.1);
    color: var(--text-faded);
}

.tool-name {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.tool-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.tools-section {
    margin-bottom: 32px;
}

.tools-section:last-child {
    margin-bottom: 0;
}

.coming-soon-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.tools-section-heading {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px 0;
}

.settings-sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    padding: 24px 0;
    overflow-y: auto;
    flex-shrink: 0;
    max-height: 85vh;
}

.settings-sidebar::-webkit-scrollbar {
    width: 8px;
}

.settings-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.settings-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.settings-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-faded);
}

.settings-title {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    padding: 0 24px;
    margin-bottom: 24px;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
}

.settings-nav-item:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background-color: var(--input-bg);
    color: var(--text-primary);

}

.settings-nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.settings-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background-color: var(--main-bg);
    max-height: 85vh;
    min-height: 0;
}

.settings-content::-webkit-scrollbar {
    width: 8px;
}

.settings-content::-webkit-scrollbar-track {
    background: transparent;
}

.settings-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.settings-content::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-faded);
}

.settings-section {
    flex: 1;
    padding: 24px;
    min-height: 450px;
    max-height: 450px;
}

.settings-section-header {
    margin-bottom: 24px;
}

.settings-section-header h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.settings-section-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-account-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 24px;
}

.settings-account-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 24px;
    flex-shrink: 0;
}

.settings-account-details {
    flex: 1;
}

.settings-account-details h4 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.settings-account-details p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.settings-account-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background-color: var(--input-bg);

    border-radius: 12px;
    margin-bottom: 12px;
}

.settings-account-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.settings-account-item-left svg {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

/* Billing payment modern cards */
.billing-pay-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.billing-pay-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.billing-pay-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.billing-pay-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.billing-pay-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.billing-pay-sub {
    color: var(--text-secondary);
    font-size: 12px;
}

.billing-pay-badge {
    background: rgba(79, 70, 229, 0.12);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.billing-pay-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.billing-pay-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
}

.billing-pay-add {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.billing-pay-add-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.billing-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.billing-back-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}

.billing-back-btn:hover {
    background: var(--border-color);
}

.billing-subtitle-title {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.billing-subtitle-text {
    color: var(--text-secondary);
    font-size: 12px;
}

.billing-section-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.billing-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
}

.billing-stat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.billing-stat-value {
    color: var(--text-secondary);
    font-size: 12px;
}

.billing-stat-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
}

.billing-stat-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
}

.billing-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
}

.billing-history-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.billing-history-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.billing-history-sub {
    color: var(--text-secondary);
    font-size: 12px;
}

.billing-history-right {
    text-align: right;
}

.billing-history-amount {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 16px;
}

.billing-history-status {
    font-size: 12px;
    margin-top: 2px;
}

.billing-upgrade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.billing-upgrade-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.billing-upgrade-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.billing-upgrade-title {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.billing-upgrade-price {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
}

.billing-upgrade-badge {
    background: rgba(79, 70, 229, 0.12);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.billing-upgrade-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 13px;
}

.billing-upgrade-list li+li {
    margin-top: 4px;
}

.billing-upgrade-card .settings-btn {
    width: 100%;
}

.settings-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.settings-btn-primary {
    background-color: var(--accent);
    color: white;
}

.settings-btn-primary:hover {
    opacity: 0.9;
}

.settings-btn-secondary {
    background-color: var(--input-bg);
    color: var(--text-primary);

}

.settings-btn-secondary:hover {
    background-color: var(--nav-active-bg);
}

.settings-btn-white {
    background-color: white;
    color: black;
}

.settings-btn-white:hover {
    opacity: 0.9;
}

/* Profile Input Styles */
.profile-input {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.profile-input:focus {
    background-color: var(--nav-active-bg);
    border-color: var(--border-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.profile-input::placeholder {
    color: var(--text-secondary);
}

.profile-input option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--input-bg);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--avatar-blue);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(24px);
    background-color: white;
}

.toggle-switch input:focus+.toggle-slider {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.settings-footer {
    padding: 24px;
    background-color: var(--sidebar-bg);
}

.settings-build-id {
    color: var(--text-faded);
    font-size: 12px;
    margin-bottom: 16px;
}

.settings-supergrok-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);

    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
}

.settings-supergrok-banner svg {
    width: 24px;
    height: 24px;
    color: var(--avatar-blue);
}

/* Appearance Mode Selection */
.appearance-modes {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    width: 100%;
}

.appearance-mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background-color: var(--input-bg);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    color: var(--text-primary);
}

.appearance-mode-btn:hover {
    background-color: var(--nav-active-bg);
}

.appearance-mode-btn.active {
    background-color: var(--nav-active-bg);
}

.appearance-mode-btn svg {
    width: 48px;
    height: 48px;
    color: var(--text-primary);
}

.appearance-mode-btn span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Dark Theme Variants */
.dark-theme-variants {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.theme-variant-card {
    position: relative;
    padding: 16px;
    background-color: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-variant-card:hover {
    border-color: var(--accent);
    background-color: var(--nav-active-bg);
}

.theme-variant-card.active {
    border-color: var(--accent);
    background-color: var(--nav-active-bg);
}

.theme-preview {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
}

.preview-sidebar {
    flex: 0 0 30%;
    background-color: #121212;
}

.preview-main {
    flex: 1;
    background-color: #121212;
}

.default-theme-preview .preview-sidebar,
.default-theme-preview .preview-main {
    background-color: #121212;
}

.charcoal-theme-preview .preview-sidebar {
    background-color: #1E1E1E;
}

.charcoal-theme-preview .preview-main {
    background-color: #252525;
}

.theme-info {
    margin-bottom: 8px;
}

.theme-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.theme-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.theme-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent);
    border-radius: 50%;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
}

.theme-variant-card.active .theme-check {
    opacity: 1;
}

.theme-check svg {
    width: 14px;
    height: 14px;
}

/* Font Size Section */
.font-size-section {
    margin-top: 24px;
}

.settings-section-subheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.settings-section-subheader h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.font-size-value {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.font-size-options {
    display: flex;
    gap: 12px;
    width: 100%;
}

.font-size-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background-color: var(--input-bg);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    color: var(--text-primary);
}

.font-size-btn:hover {
    background-color: var(--nav-active-bg);
}

.font-size-btn.active {
    background-color: var(--nav-active-bg);
}

.font-size-btn span:first-child {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.font-size-btn[data-size="small"] span:first-child {
    font-size: 12px;
}

.font-size-btn[data-size="medium"] span:first-child {
    font-size: 16px;
}

.font-size-btn[data-size="large"] span:first-child {
    font-size: 20px;
}

.font-size-btn[data-size="xlarge"] span:first-child {
    font-size: 24px;
}

.font-size-btn span:last-child {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Font Size Application */
body[data-font-size="small"] {
    font-size: 12px;
    --font-size-base: 12px;
    --font-size-message: 14px;
    --font-size-title: 11px;
    --font-size-conversation: 13px;
    --font-size-sidebar: 14px;
    --font-size-small: 10px;
    --font-size-large: 15px;
    --font-size-xlarge: 17px;
}

body[data-font-size="medium"] {
    font-size: 13.5px;
    --font-size-base: 13.5px;
    --font-size-message: 15px;
    --font-size-title: 13px;
    --font-size-conversation: 14px;
    --font-size-sidebar: 15px;
    --font-size-small: 10px;
    --font-size-large: 16px;
    --font-size-xlarge: 18px;
}

body[data-font-size="large"] {
    font-size: 16px;
    --font-size-base: 16px;
    --font-size-message: 18px;
    --font-size-title: 15px;
    --font-size-conversation: 17px;
    --font-size-sidebar: 18px;
    --font-size-small: 13px;
    --font-size-large: 19px;
    --font-size-xlarge: 21px;
}

body[data-font-size="xlarge"] {
    font-size: 18px;
    --font-size-base: 18px;
    --font-size-message: 20px;
    --font-size-title: 17px;
    --font-size-conversation: 19px;
    --font-size-sidebar: 20px;
    --font-size-small: 15px;
    --font-size-large: 21px;
    --font-size-xlarge: 23px;
}

.spinner-circle {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Notification Popup */
.notification-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 320px;
    max-width: 500px;
    background: var(--sidebar-bg, #FFFFFF);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 20px 24px;
    z-index: 10001;
    display: none;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color, #D9D9D9);
    animation: slideInRight 0.3s ease-out;
    transform: translateX(400px);
    opacity: 0;
}

.notification-popup.show {
    display: flex;
    transform: translateX(0);
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-popup.success {
    border-left: 4px solid #34c759;
}

.notification-popup.error {
    border-left: 4px solid #ff3b30;
}

.notification-popup-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-popup.success .notification-popup-icon {
    color: #34c759;
}

.notification-popup.error .notification-popup-icon {
    color: #ff3b30;
}

.notification-popup-content {
    flex: 1;
}

.notification-popup-title {
    font-size: var(--font-size-base, 15px);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.notification-popup-message {
    font-size: var(--font-size-base, 15px);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.notification-popup-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.notification-popup-close:hover {
    background-color: var(--input-bg, #FFFFFF);
    color: var(--text-primary);
}

.notification-popup-close svg {
    width: 18px;
    height: 18px;
}

/* Curriculum insights modal adjustments */
#curriculumInsightsModal .curriculum-insights-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.curriculum-insights-covered {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.curriculum-insights-covered li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.curriculum-covered-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Voice Cards */
.voice-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .voice-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
}

.voice-card {
    position: relative;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 160px;
}

.voice-card:hover {
    border-color: var(--accent);
    background: var(--nav-active-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.voice-card.selected {
    border-color: var(--accent);
    background: var(--nav-active-bg);
    box-shadow: 0 0 0 3px rgba(74, 116, 232, 0.15);
}

.voice-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

.voice-card-info {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.voice-card-name {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.voice-card-region {
    color: var(--text-secondary);
    font-size: 13px;
}

.voice-card-play {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.voice-card-play:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.1);
}

.voice-card-play:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.voice-card-play svg {
    width: 16px;
    height: 16px;
}

.voice-card-check {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 2;
}

.voice-card-check svg {
    width: 16px;
    height: 16px;
}

/* Practice Test Options Refined Styles */
.practice-test-options {
    margin-bottom: 24px;
    animation: fadeInSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.practice-test-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 0 8px;
}

.back-to-input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-to-input:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
    transform: translateX(-2px);
    border-color: var(--text-faded);
}

.practice-test-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.practice-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    padding: 4px;
}

/* Premium Practice Tool Card */
.practice-card.tool-card {
    flex: 1;
    min-width: 280px;
    display: flex !important;
    align-items: center !important;
    gap: 20px !important;
    padding: 24px !important;
    background: var(--input-main-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: left;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.practice-card.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.practice-card.tool-card:hover,
.practice-card.tool-card.active {
    border-color: var(--accent);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 196, 0, 0.2);
    background: var(--nav-active-bg);
}

.practice-card.tool-card:hover::before {
    opacity: 1;
}

.practice-card.tool-card:active {
    transform: translateY(-2px) scale(0.98);
}

.practice-card .tool-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.practice-card.tool-card:hover .tool-card-icon {
    transform: rotate(-5deg) scale(1.1);
}

/* Icon specific styles with premium gradients */
.quiz-icon {
    background: linear-gradient(135deg, rgba(255, 196, 0, 0.15) 0%, rgba(255, 196, 0, 0.05) 100%);
    color: #FFC400;
    border: 1px solid rgba(255, 196, 0, 0.2);
}

.paper-icon {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.15) 0%, rgba(46, 204, 113, 0.05) 100%);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.practice-card .tool-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.practice-card .tool-card-info h3 {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.practice-card.tool-card:hover .tool-card-info h3 {
    color: var(--accent);
}

.practice-card .tool-card-info p {
    margin: 0 !important;
    font-size: 13px !important;
    color: var(--text-secondary) !important;
    line-height: 1.5 !important;
}

@media (max-width: 600px) {
    .practice-cards-container {
        flex-direction: column;
    }

    .practice-card.tool-card {
        min-width: 100%;
        padding: 20px !important;
    }

}

/* Study Plan and Memorize Options Styles */
.study-plan-options,
.memorize-options {
    margin-top: -2rem;
    margin-bottom: 24px;
    animation: fadeInSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
}

.study-plan-header,
.memorize-header {
    margin-bottom: 16px;
    padding: 0 8px;
}

.study-plan-header h3,
.memorize-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Study Plan Cards Container */
.study-plan-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    padding: 4px;
}

/* Memorize Cards Container */
.memorize-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    padding: 4px;
}

/* Study Plan Card - Inherits from tool-card */
.study-plan-card.tool-card {
    flex: 1;
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--input-main-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: left;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.study-plan-card.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.study-plan-card.tool-card:hover,
.study-plan-card.tool-card.active {
    border-color: var(--accent);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 196, 0, 0.2);
    background: var(--nav-active-bg);
}

.study-plan-card.tool-card:hover::before {
    opacity: 1;
}

.study-plan-card.tool-card:active {
    transform: translateY(-2px) scale(0.98);
}

.study-plan-card .tool-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.study-plan-card.tool-card:hover .tool-card-icon {
    transform: rotate(-5deg) scale(1.1);
}

/* Study Plan Icon Styles */
.curriculum-icon {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.15) 0%, rgba(52, 152, 219, 0.05) 100%);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.upload-plan-icon {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.15) 0%, rgba(155, 89, 182, 0.05) 100%);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.2);
}

.study-plan-card .tool-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.study-plan-card .tool-card-info h3 {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.study-plan-card.tool-card:hover .tool-card-info h3 {
    color: var(--accent);
}

.study-plan-card .tool-card-info p {
    margin: 0 !important;
    font-size: 13px !important;
    color: var(--text-secondary) !important;
    line-height: 1.5 !important;
}

/* Memorize Card - Inherits from tool-card */
.memorize-card.tool-card {
    flex: 1;
    min-width: 280px;
    display: flex !important;
    align-items: center !important;
    gap: 20px !important;
    padding: 24px !important;
    background: var(--input-main-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: left;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.memorize-card.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 196, 0, 0.05) 0%, rgba(255, 196, 0, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.memorize-card.tool-card:hover,
.memorize-card.tool-card.active {
    border-color: var(--accent);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 196, 0, 0.2);
    background: var(--nav-active-bg);
}

.memorize-card.tool-card:hover::before {
    opacity: 1;
}

.memorize-card.tool-card:active {
    transform: translateY(-2px) scale(0.98);
}

.memorize-card .tool-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.memorize-card.tool-card:hover .tool-card-icon {
    transform: rotate(-5deg) scale(1.1);
}

/* Memorize Icon Styles */
.memory-palace-icon {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.15) 0%, rgba(52, 152, 219, 0.05) 100%);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.acronym-icon {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.15) 0%, rgba(231, 76, 60, 0.05) 100%);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.rhyme-icon {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.15) 0%, rgba(46, 204, 113, 0.05) 100%);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.number-icon {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.15) 0%, rgba(155, 89, 182, 0.05) 100%);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.2);
}

.story-icon {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.15) 0%, rgba(241, 196, 15, 0.05) 100%);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.2);
}

.peg-icon {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.15) 0%, rgba(230, 126, 34, 0.05) 100%);
    color: #e67e22;
    border: 1px solid rgba(230, 126, 34, 0.2);
}

.memorize-card .tool-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.memorize-card .tool-card-info h3 {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.memorize-card.tool-card:hover .tool-card-info h3 {
    color: var(--accent);
}

.memorize-card .tool-card-info p {
    margin: 0 !important;
    font-size: 13px !important;
    color: var(--text-secondary) !important;
    line-height: 1.5 !important;
}

/* Memorize Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    background-color: var(--surface-card) !important;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: var(--nav-active-bg);
    color: var(--text-primary);
}

.selected-method-display {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.method-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.method-info h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.method-info p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.modal-body {
    padding: 24px;
}

.selection-section {
    margin-bottom: 20px;
}

.selection-section:last-child {
    margin-bottom: 0;
}

.selection-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-main-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.1);
}

.form-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--nav-hover-bg);
}

.modal-footer {
    padding: 20px 24px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-secondary {
    background: var(--nav-hover-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--nav-active-bg);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #e6b800;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 196, 0, 0.3);
}

@media (max-width: 600px) {
    .practice-cards-container {
        flex-direction: column;
    }

    .practice-card.tool-card {
        min-width: 100%;
        padding: 20px !important;
    }

    .study-plan-cards-container {
        flex-direction: column;
    }

    .study-plan-card.tool-card {
        min-width: 100%;
        padding: 20px !important;
    }

    .memorize-cards-container {
        flex-direction: column;
    }

    .memorize-card.tool-card {
        min-width: 100%;
        padding: 20px !important;
    }

    /* Modal mobile styles */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 20px;
    }

    .modal-header {
        padding: 20px 20px 16px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 16px 20px 20px;
        flex-direction: column-reverse;
    }

    .btn {
        width: 100%;
        margin-bottom: 8px;
    }

    .btn:last-child {
        margin-bottom: 0;
    }

    .selected-method-display {
        gap: 12px;
    }

    .method-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

.study-plan-upload-zone {
    background: var(--input-main-bg);
    border: 2px dashed var(--border-color);
    border-radius: 24px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.study-plan-upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 196, 0, 0.05) 0%, rgba(255, 196, 0, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.study-plan-upload-zone:hover,
.study-plan-upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--nav-active-bg);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.study-plan-upload-zone:hover::before,
.study-plan-upload-zone.drag-over::before {
    opacity: 1;
}

.upload-zone-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.upload-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(255, 196, 0, 0.1) 0%, rgba(255, 196, 0, 0.05) 100%);
    color: var(--accent);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
}

.study-plan-upload-zone:hover .upload-icon {
    transform: scale(1.1) rotate(5deg);
}

.upload-text h4 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-text p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 300px;
    line-height: 1.5;
}

.upload-btn-main {
    margin-top: 8px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(255, 196, 0, 0.2);
}

.upload-btn-main:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 196, 0, 0.3);
    background: #FFD033;
    /* Slightly lighter than --accent */
}

.upload-btn-main:active {
    transform: scale(0.98);
}

/* Active Curriculum Display */
.active-curriculum-container {
    margin-top: 12px;
    animation: fadeInSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 210px;
    overflow-y: auto;
    padding-right: 6px;
    margin-right: -6px;
}

/* Custom Scrollbar for Curricula List */
.active-curriculum-container::-webkit-scrollbar {
    width: 5px;
}

.active-curriculum-container::-webkit-scrollbar-track {
    background: transparent;
}

.active-curriculum-container::-webkit-scrollbar-thumb {
    background: rgba(255, 196, 0, 0.2);
    border-radius: 10px;
}

.active-curriculum-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 196, 0, 0.4);
}

.curriculum-card {
    background: var(--nav-active-bg);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
    width: 100%;
    cursor: pointer;
}

.curriculum-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 196, 0, 0.1);
}

.curriculum-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

.curriculum-details {
    flex: 1;
    text-align: left;
}

.curriculum-details h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.curriculum-details p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-faded);
}

.curriculum-badge {
    margin-left: auto;
    background: rgba(255, 196, 0, 0.1);
    color: var(--accent);
    padding: 4px 10px;

    /* Sidebar History Popup */
    .history-popup {
        position: absolute;
        background-color: var(--sidebar-bg);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        width: 280px;
        max-height: 400px;
        z-index: 10000;
        overflow: hidden;
        display: none;
        opacity: 0;
        transform: translateX(-10px);
        transition: opacity 0.2s ease, transform 0.2s ease;
        padding: 8px 0;
    }

    .history-popup.visible {
        opacity: 1;
        transform: translateX(0);
    }

    .history-popup-header {
        padding: 8px 16px;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .history-popup-list {
        max-height: 300px;
        overflow-y: auto;

        /* Sidebar History Popup */
        .history-popup {
            position: fixed;
            /* Forced fixed */
            background-color: var(--sidebar-bg, #1e1e1e);
            border: 1px solid var(--border-color, #333);
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
            width: 280px;
            max-height: 400px;
            z-index: 999999 !important;
            /* Ensure on top */
            overflow: hidden;
            display: none;
            opacity: 0;
            padding: 8px 0;
            transition: opacity 0.2s ease;
            color: var(--text-primary, #fff);
        }

        .history-popup.visible {
            opacity: 1;
        }

        .history-popup-header {
            padding: 12px 16px 8px;
            font-size: 11px;
            font-weight: 600;
            color: var(--text-secondary, #808080);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            border-bottom: 1px solid var(--border-color, #333);
            margin-bottom: 4px;
        }

        .history-popup-list {
            max-height: 300px;
            overflow-y: auto;
            padding: 0;
        }

        /* Custom Scrollbar for popup */
        .history-popup-list::-webkit-scrollbar {
            width: 6px;
        }

        .history-popup-list::-webkit-scrollbar-track {
            background: transparent;
        }

        .history-popup-list::-webkit-scrollbar-thumb {
            background: var(--bg-tertiary, #444);
            border-radius: 3px;
        }

        .history-popup-list::-webkit-scrollbar-thumb:hover {
            background: var(--text-faded, #666);
        }

        .history-popup-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 16px;
            cursor: pointer;
            transition: background-color 0.2s ease;
            color: var(--text-primary, #fff);
            text-decoration: none;
        }

        .history-popup-item:hover {
            background-color: var(--nav-active-bg, #333);
        }

        .history-popup-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 20px;
            height: 20px;
            color: var(--text-secondary, #808080);
            flex-shrink: 0;
        }

        .history-popup-icon svg {
            width: 16px;
            height: 16px;
        }

        .history-popup-title {
            font-size: 14px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1;
            font-weight: 400;
        }

        .history-popup-footer {
            padding: 12px 16px;
            border-top: 1px solid var(--border-color, #333);
            margin-top: 4px;
            text-align: center;
        }

        .history-popup-see-all {
            font-size: 12px;
            color: var(--accent, #ffc107);
            cursor: pointer;
            transition: opacity 0.2s;
            font-weight: 600;
            text-decoration: none;
            display: block;
            width: 100%;
        }

        .history-popup-see-all:hover {
            opacity: 0.8;
            text-decoration: none;
        }

        .history-popup-empty {
            padding: 24px;
            text-align: center;
            color: var(--text-faded, #666);
            font-size: 14px;
        }

        /* TeachMe Curriculum Cards */
        .teachme-cards-section {
            width: 100%;
            max-width: 700px;
            margin: 32px auto 0;
            padding: 0 16px;
        }

        .teachme-cards-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 20px;
        }

        .teachme-header-icon {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            background: linear-gradient(135deg, var(--accent) 0%, #ff9500 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            color: #000;
        }

        .teachme-header-icon svg {
            width: 28px;
            height: 28px;
        }

        .teachme-header-text h3 {
            font-size: 18px;
            font-weight: 600;
            color: var(--text-primary);
            margin: 0;
        }

        .teachme-header-text p {
            font-size: 14px;
            color: var(--text-secondary);
            margin: 4px 0 0;
        }

        .teachme-cards-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            gap: 12px;
            padding: 14px 16px;
            background: var(--input-bg);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .teachme-curriculum-card:hover {
            border-color: var(--accent);
            background: var(--nav-active-bg);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .curriculum-card-icon {
            font-size: 28px;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(255, 196, 0, 0.1);
            border-radius: 10px;
            flex-shrink: 0;
        }

        .curriculum-card-content {
            flex: 1;
            min-width: 0;
        }

        .curriculum-card-content h4 {
            font-size: 14px;
            font-weight: 600;
            color: var(--text-primary);
            margin: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .curriculum-card-meta {
            font-size: 12px;
            color: var(--text-secondary);
            margin: 2px 0 0;
        }

        .start-learning-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 8px 14px;
            background: var(--accent);
            color: #000;
            border: none;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            flex-shrink: 0;
        }

        .start-learning-btn:hover {
            background: #ffd740;
            transform: scale(1.02);
        }

        .start-learning-btn svg {
            width: 14px;
            height: 14px;
        }
    }
}

/* Beta Badge Styles - Cleaner Display */
.beta-badge {
    background-color: #ffffff;
    color: #2563eb;
    /* Blue text */
    padding: 11px 10px;
    border-radius: 99px;
    /* Pill shape */
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    /* Added for interactivity */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    line-height: 1;
    vertical-align: middle;
    height: 18px;
    user-select: none;
    -webkit-user-select: none;
}

@media (max-width: 768px) {
    .beta-badge {
        margin-left: 4px !important;
    }
}

/* Ensure proper vertical alignment in logos */
.header-logo-link {
    display: flex;
    align-items: center;
}


.header-logo-text {
    display: inline-block;
}

/* =========================================
   Wishlist Feature Styles
   ========================================= */

/* Join Wishlist Button */
/* Join Wishlist Button */
.join-wishlist-btn {
    background: #FFFFFF;
    color: #2563eb;
    /* Gold text */
    font-weight: 700;
    padding: 12px 16px;
    border-radius: 99px;
    /* Pill shape */
    /* Gold border */
    cursor: pointer;
    font-size: 12px;
    /* Match Beta badge size */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.join-wishlist-btn:hover {
    transform: translateY(-1px);
    background: var(--accent);
    color: #000000;
    /* Black text on hover for contrast */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.join-wishlist-btn:active {
    transform: translateY(1px);
}

/* Modal Overlay */
.wishlist-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out forwards;
}

/* Modal Content */
.wishlist-modal-content {
    background: var(--surface-card);
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.wishlist-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.wishlist-close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.wishlist-header-icon {
    font-size: 40px;
    margin-bottom: 16px;
    display: inline-block;
}

.wishlist-modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.wishlist-modal-content p {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
    font-size: 14px;
}

.wishlist-form-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wishlist-input {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.wishlist-input:focus {
    border-color: var(--accent);
    background: var(--input-main-bg);
    box-shadow: 0 0 0 1px var(--accent);
}

.wishlist-submit-btn {
    background: var(--accent);
    color: #000000;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.wishlist-submit-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.wishlist-message {
    margin-top: 12px;
    font-size: 13px;
    min-height: 20px;
}

.wishlist-message.success {
    color: #10b981;
}

.wishlist-message.error {
    color: #ef4444;
}

/* Success Popup */
.wishlist-success-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface-card);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border: 1px solid var(--border-color);
}

.wishlist-success-popup .success-icon {
    font-size: 20px;
}

.wishlist-success-popup h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.wishlist-success-popup p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Sparkles Animation Container */
.sparkles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10001;
    overflow: hidden;
}

.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #FFD700;
    border-radius: 50%;
    animation: sparkleFloat 1s linear forwards;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sparkleFloat {
    0% {
        transform: translate(0, 0) scale(0);
        opacity: 0;
    }

    20% {
        opacity: 1;
        transform: translate(var(--tx), var(--ty)) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--end-tx), var(--end-ty)) scale(0);
    }
}

/* Did You Know Popup */
.did-you-know-popup {
    position: absolute;
    bottom: 32px;
    right: 32px;
    /* Changed from left to right */
    background: #FFFFFF;
    /* Changed to White */
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 16px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    z-index: 50;
    transition: all 0.3s ease;
    animation: slideUpFade 0.5s ease-out forwards;
}

.did-you-know-popup .dyk-icon {
    font-size: 24px;
    background: rgba(255, 196, 0, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.did-you-know-popup .dyk-content {
    transition: opacity 0.3s ease;
}

.did-you-know-popup h4 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.did-you-know-popup p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Hide on mobile */
@media (max-width: 1024px) {
    .did-you-know-popup {
        display: none !important;
    }
}

/* Chat Message Font Size Enforcement */
.message-content,
.message-text,
.assistant-message-text,
.user-message-text,
.formatted-content {
    font-size: var(--font-size-message) !important;
    line-height: 1.5;
}

/* Input Icon Button with Text */
.input-icon-btn.with-text {
    width: auto !important;
    border-radius: 20px !important;
    padding: 0 12px 0 10px !important;
    gap: 8px !important;
    border: 1px solid var(--border-color) !important;
    /* Add visible border */
}

.input-icon-btn.with-text span {
    font-size: 13px;
    font-weight: 500;
    display: inline-block !important;
    /* Ensure text is visible */
}

/* Ensure SVG spacing and visibility */
.input-icon-btn.with-text svg {
    margin: 0;
    width: 20px !important;
    /* Force 20px to match attribute and fix clipping */
    height: 20px !important;
    flex-shrink: 0;
}

/* STRICT Sidebar Collapse Rules - Retry 3 */
.sidebar.collapsed .sidebar-search-trigger span,
.sidebar.collapsed .sidebar-search-trigger .shortcut,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .history-item span,
.sidebar.collapsed .section-header span,
.sidebar.collapsed .user-name {
    display: none !important;
}

.sidebar.collapsed .toggle-icon {
    display: none !important;
}

.sidebar.collapsed .sidebar-search-trigger,
.sidebar.collapsed .nav-item,
.sidebar.collapsed .history-item {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.sidebar.collapsed .sidebar-search-trigger i,
.sidebar.collapsed .nav-item i,
.sidebar.collapsed .nav-item svg,
.sidebar.collapsed .history-item svg {
    margin: 0 !important;
}

/* History Item Tooltip */
.history-item {
    position: relative;
    overflow: visible !important;
    /* Allow tooltip to overflow */
}

.history-item:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 20px;
    top: auto;
    bottom: 100%;
    transform: none;
    margin-bottom: 8px;
    background-color: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: normal;
    max-width: 200px;
    word-wrap: break-word;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    opacity: 0;
    animation: tooltipFadeIn 0.2s forwards;
    animation-delay: 0.3s;
    /* Slight delay */
}

@keyframes tooltipFadeIn {
    to {
        opacity: 1;
    }
}

/* Adjust for expanded sidebar if needed */
.sidebar:not(.collapsed) .history-item:hover::after {
    left: 20px;
    top: auto;
    bottom: 100%;
    transform: none;
    margin-left: 0;
    margin-bottom: 5px;
    margin-top: 0;
}

/* Header Buttons Redesign - Final Attempt */
.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color-primary, #fff);
}

.header-btn.icon-only {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--text-color-secondary, #aaa);
}

.header-btn.icon-only:hover {
    background-color: var(--bg-hover, rgba(255, 255, 255, 0.1));
    color: var(--text-color-primary, #fff);
}

.header-btn.pill-btn {
    background-color: #fff;
    color: #000;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    gap: 8px;
    height: 32px;
}

.header-btn.pill-btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

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

.header-btn.circle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-btn.circle-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.header-right-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Refined Collapsed Sidebar Styles - User Request */
.sidebar.collapsed .nav-item {
    margin: 4px auto !important;
    /* Reduced padding */
}

.sidebar.collapsed .sidebar-search-trigger {
    background: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    margin: 4px auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sidebar.collapsed .nav-item:hover,
.sidebar.collapsed .sidebar-search-trigger:hover,
.sidebar.collapsed .sidebar-logo:hover {
    background-color: var(--nav-active-bg) !important;
    border-radius: 50% !important;
}


/* Light Mode Header Button Overrides */
[data-theme="light"] .header-btn.pill-btn,
body.light-mode .header-btn.pill-btn {
    background-color: #000 !important;
    color: #fff !important;
}

[data-theme="light"] .header-btn.pill-btn:hover,
body.light-mode .header-btn.pill-btn:hover {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

/* Study Plan Card UI - Apple Design Language */

.study-plan-card-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
}

.study-card {
    background: rgba(28, 28, 30, 0.98);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    width: 100%;
    animation: slideInUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.study-card-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}

.study-card-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.study-back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    font-size: 18px;
    color: #007aff;
    cursor: pointer;
    padding: 6px 10px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.study-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.study-card-body {
    padding: 8px 0;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for study card */
.study-card-body::-webkit-scrollbar {
    width: 8px;
}

.study-card-body::-webkit-scrollbar-track {
    background: transparent;
}

.study-card-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.study-card-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* List Items - Apple Style */
.study-list {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
}

.study-list-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    margin: 0 8px;
    transition: background 0.15s ease;
    border-radius: 10px;
    min-height: 54px;
}

.study-list-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.study-list-item:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.98);
}

.study-item-number {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-right: 14px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.12);
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.study-item-label {
    flex: 1;
    font-size: 17px;
    color: #ffffff;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.study-item-arrow {
    color: rgba(255, 255, 255, 0.3);
    font-size: 22px;
    font-weight: 400;
    margin-left: 8px;
}

/* Generate Card Summary */
.study-generate-summary {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 16px;
    margin: 20px;
}

.study-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

.study-summary-label {
    color: #8e8e93;
    font-size: 14px;
}

.study-summary-value {
    color: #1a1a1a;
    font-weight: 600;
    font-size: 14px;
}

.study-generate-btn {
    background: #007aff;
    color: white;
    border: none;
    width: calc(100% - 40px);
    margin: 0 20px 20px;
    padding: 16px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.1s, background 0.2s;
}

.study-generate-btn:active {
    transform: scale(0.96);
}

/* Loading and Empty States */
.study-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    min-height: 300px;
}

.study-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #007aff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.study-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
}

.study-error {
    text-align: center;
    padding: 40px 20px;
    color: #ff3b30;
    font-size: 15px;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .study-card {
    background: rgba(28, 28, 30, 0.98);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .study-card-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .study-card-header h3 {
    color: #ffffff;
}

[data-theme="dark"] .study-item-label {
    color: #ffffff;
}

[data-theme="dark"] .study-generate-summary {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .study-summary-label {
    color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .study-summary-value {
    color: white;
}

.study-generate-btn:active {
    transform: scale(0.98);
}

.study-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.study-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #007aff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.study-error {
    text-align: center;
    padding: 60px 40px;
    color: #ff3b30;
    font-size: 16px;
}

/* Header Help Dropdown */
.header-help-container {
    position: relative;
    display: flex;
    align-items: center;
}

.header-help-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 260px;
    background-color: var(--input-bg);
    /* Fallback */
    background-color: color-mix(in srgb, var(--input-bg), transparent 15%);
    /* Glass effect */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    /* Responsive Border */
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 1050;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.header-help-dropdown.show {
    display: flex !important;
    animation: fadeIn 0.2s ease-out;
}

.help-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-primary) !important;
    text-decoration: none !important;
    font-size: 14px;
    transition: background 0.2s;
    white-space: nowrap;
    border-radius: 6px;
    cursor: pointer;
}

/* Featured item (Plans & Pricing) */
.help-dropdown-item.featured-item {
    background-color: transparent;
    margin-bottom: 8px;
    border-radius: 8px;
    justify-content: space-between;
    height: 44px;
}

.help-dropdown-item.featured-item:hover {
    background-color: var(--nav-active-bg);
    /* Responsive Hover */
}

.help-dropdown-item .item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-dropdown-item:hover {
    background-color: var(--bg-active);
    /* Responsive Hover */
    color: var(--text-primary) !important;
}

.help-dropdown-item svg {
    opacity: 0.8;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: inherit;
}

.help-dropdown-item.featured-item .arrow-icon {
    width: 14px;
    height: 14px;
    opacity: 0.5;
    margin-left: auto;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    /* Responsive Divider */
    margin: 4px 0 8px 0;
    width: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Version Popup (Apple Style) */
/* Override header logo relative positioning if not already set */
.header-logo {
    position: relative !important;
}

.version-popup {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 12px;
    width: 280px;
    background-color: var(--input-bg);
    /* Fallback */
    background-color: color-mix(in srgb, var(--input-bg), transparent 15%);
    /* Glass effect */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 20px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 12px 32px rgba(0, 0, 0, 0.15);
    /* Reduced shadow opacity for compatibility */
    z-index: 1100;
    display: none;
    flex-direction: column;
    gap: 16px;
    transform-origin: top left;
}

.version-popup.show {
    display: flex !important;
    animation: popupScale 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes popupScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.version-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.version-info h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.version-info .version-badge {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-active);
    /* Responsive badge bg */
    padding: 2px 8px;
    border-radius: 100px;
    display: inline-block;
}

.version-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.version-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

.version-row span:first-child {
    font-weight: 500;
}

.version-row span:last-child {
    color: var(--text-primary);
    font-family: 'SF Mono', 'Menlo', monospace;
}

.version-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.check-updates-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    /* Responsive Accent */
    color: white;
    /* Keep white text for accent button usually */
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
}

.check-updates-btn:hover {
    opacity: 0.9;
}

.check-updates-btn:active {
    transform: scale(0.98);
}

.changelog-link {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.changelog-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Sidebar Interactions CSS - Redesigned in sidebar-redesign.css */
/* 
.history-popup {
    position: fixed;
    background: var(--input-bg);
    ...
}
...
*/

/* Legacy styles commented out to prefer sidebar-redesign.css */

/* Collapsed Search Button */
.collapsed-search-btn {
    display: none !important;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent !important;
    border: none;
    color: var(--text-secondary, #808080);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    margin: 12px auto 0 auto;
}

.collapsed-search-btn:hover {
    background-color: var(--nav-active-bg, rgba(255, 255, 255, 0.05)) !important;
    color: var(--text-primary, #fff);
}

.collapsed-search-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.sidebar.collapsed .collapsed-search-btn {
    display: flex !important;
}

/* Sidebar Skeleton Loader */
.history-skeleton-loader {
    padding: 12px;
}

.history-skeleton-item {
    display: flex;
    align-items: center;
    padding: 8px;
    gap: 10px;
    margin-bottom: 8px;
    animation: skeletonPulse 1.5s infinite ease-in-out;
    opacity: 0.6;
}

.history-skeleton-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.history-skeleton-text {
    height: 12px;
    flex: 1;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.history-skeleton-text.short {
    width: 60%;
}

/* Scroll sentinel (invisible trigger for IntersectionObserver) */
.conversations-scroll-sentinel {
    height: 1px;
    width: 100%;
    pointer-events: none;
}

/* Load-more skeleton — appended below existing list items */
.history-load-more-skeleton {
    padding: 4px 0;
}

.history-load-more-skeleton .history-skeleton-item {
    animation-delay: calc(var(--i, 0) * 0.1s);
}

.history-load-more-skeleton .history-skeleton-item:nth-child(1) {
    --i: 0;
}

.history-load-more-skeleton .history-skeleton-item:nth-child(2) {
    --i: 1;
}

.history-load-more-skeleton .history-skeleton-item:nth-child(3) {
    --i: 2;
}

.history-load-more-skeleton .history-skeleton-item:nth-child(4) {
    --i: 3;
}

.history-load-more-skeleton .history-skeleton-item:nth-child(5) {
    --i: 4;
}

@keyframes skeletonPulse {
    0% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 0.4;
    }
}

/* Sidebar Redesign Styles */

:root {
    --sidebar-width: 260px;
    --sidebar-padding: 12px;
    --nav-item-radius: 8px;
    --nav-item-padding: 10px 14px;
    --font-size-nav: 14px;
}

body[data-theme="dark"] {
    --text-color-primary: #f5f5f5;
    --text-color-secondary: #aaa;
    --bg-hover: rgba(255, 255, 255, 0.08);
    --bg-active: rgba(255, 255, 255, 0.12);
}

.sidebar {
    width: var(--sidebar-width) !important;
    padding: var(--sidebar-padding) !important;
    height: 100vh !important;
    /* Modern keyboard-safe fallback */
    height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Header & Search */
.sidebar-header {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    padding: 0 4px 8px;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
}

.sidebar-logo img {
    height: 24px;
}

.collapse-btn {
    background: transparent;
    border: none;
    color: var(--text-color-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.collapse-btn:hover {
    background: var(--bg-hover);
}

/* Redesigned Search Bar Button Style */
.sidebar-search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background-color: var(--input-bg);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    color: var(--text-color-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin-bottom: 8px;
}

.sidebar-search-trigger:hover {
    background-color: var(--bg-hover);
}

.sidebar-search-trigger i {
    font-size: 14px;
}

.sidebar-search-trigger .shortcut {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.6;
}

/* Navigation Items */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    /* Ensure nested submenus aren't clipped */
    padding-right: 4px;
    margin-right: -4px;
}

/* Custom subtle scrollbar for sidebar nav */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-nav:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.nav-item {
    display: flex;
    flex-direction: row;
    /* Default to row for icon + text */
    align-items: center;
    gap: 12px;
    padding: var(--nav-item-padding) !important;
    border-radius: var(--nav-item-radius) !important;
    color: var(--text-color-primary) !important;
    font-size: var(--font-size-nav) !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: background 0.2s;
}

/* Items with submenus must stack header and submenu vertically */
.nav-item.has-submenu {
    flex-direction: column;
    align-items: stretch;
    padding: 0 !important;
    gap: 0;
}

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

.nav-item.active {
    background-color: var(--bg-active);
}

/* Internal header part of nav items (for toggles) */
.nav-item-main,
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: var(--nav-item-padding) !important;
}

/* Left part of the header (icon + text) */
.nav-item-main>div,
.section-header>div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-item i:not(.toggle-icon),
.nav-item svg {
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    color: var(--text-color-primary) !important;
    flex-shrink: 0;
}

/* Generalized Toggle Icon (Chevrons) */
.toggle-icon {
    font-size: 12px !important;
    /* Standardize size slightly smaller than history icon */
    opacity: 0.6;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.expanded .toggle-icon,
#mainHistorySection .toggle-icon.rotated {
    transform: rotate(180deg);
}

/* Sidebar Section Headers */
.sidebar-section {
    margin-top: 20px;
}

.section-header {
    color: var(--text-color-primary);
    font-size: var(--font-size-nav);
    font-weight: 500 !important;
    /* Solidly match nav-item weight */
    cursor: pointer;
}

/* Nested Containers */
.sidebar-nested-container {
    margin-left: 23px;
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

/* Submenu Toggling */
.nav-submenu {
    display: none;
}

.nav-item.expanded .nav-submenu {
    display: block;
}

.nested-item,
.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-color-primary);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
    font-weight: 400;
    /* Sub-items should be normal weight */
}

.nested-item:hover,
.history-item:hover {
    background-color: var(--bg-hover);
}

.nested-item.faded,
.history-item.faded {
    color: var(--text-color-secondary);
}

/* History and Nested Section Subheaders */
.history-subheader,
.history-date {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

/* User Menu Styling */
.user-menu-container {
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

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

.upgrade-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: var(--text-color-primary);
    border: 1px solid var(--accent);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.upgrade-btn i {
    font-size: 10px;
}

/* Hide upgrade button when sidebar is collapsed */
.sidebar.collapsed .upgrade-btn {
    display: none !important;
}

.user-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    right: 0;
    background: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1200;
}

.user-menu.visible {
    display: block !important;
}

/* User Menu Profile Section */
.user-menu-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 4px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-menu-profile:hover {
    background: var(--bg-hover);
}

.user-menu-profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.user-menu-profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.user-menu-profile-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-profile-username {
    font-size: 13px;
    color: var(--text-color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-color-primary);
    cursor: pointer;
    transition: background 0.2s;
}

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

/* User Submenu Styling */
.user-menu-item.has-submenu {
    position: relative;
    display: flex;
    justify-content: space-between;
}

.user-submenu {
    position: absolute;
    left: calc(100% + 8px);
    top: 0;
    background: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
    min-width: 160px;
    z-index: 1300;
}

.user-menu-item.has-submenu:hover .user-submenu {
    display: block;
}

.user-submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-color-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.user-submenu-item:hover {
    background: var(--bg-hover);
}

/* Chat History Item Dropdown Styling */
.history-item-dropdown {
    position: fixed;
    background: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 10000;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-color-primary);
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item-danger {
    color: #ef4444 !important;
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

.dropdown-item i,
.dropdown-item svg {
    font-size: 14px;
    opacity: 0.8;
}

.user-menu-header {
    padding: 12px 14px 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.user-menu-separator {
    height: 1px;
    background-color: var(--border-color);
    margin: 6px 12px;
    opacity: 0.3;
}

/* Generic Dropdown Menu Redesign */
.dropdown-menu {
    background: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 10000;
}

/* Attach Dropdown (Add menu) Redesign */
.attach-dropdown-menu {
    min-width: 220px;
}

/* Recent Files Sub-menu Redesign */
.recent-files-preview {
    background: var(--input-bg) !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    padding: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2) !important;
    min-width: 320px;
}

.recent-files-loading {
    color: var(--text-color-secondary);
    font-size: 14px;
    padding: 20px;
    text-align: center;
}

.recent-file-item {
    background: var(--bg-hover);
    border-radius: 8px;
    padding: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.recent-file-item:hover {
    background: var(--bg-active);
    border-color: var(--accent);
}

.recent-file-name {
    color: var(--text-color-primary);
    font-size: 13px;
    font-weight: 500;
}

.recent-file-meta {
    color: var(--text-color-secondary);
    font-size: 11px;
}

/* Collapsed Sidebar Popups (History, Archive, Pin) */
.history-popup {
    background: var(--input-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 220px;
    z-index: 10000;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
    overflow: hidden;
}

.history-popup.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.history-popup-title-bar {
    padding: 8px 12px 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.history-popup-date {
    padding: 12px 12px 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    opacity: 0.5;
    letter-spacing: 0.3px;
}

.history-popup-item,
.history-popup-see-all {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-color-primary);
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.history-popup-item:hover,
.history-popup-see-all:hover {
    background: var(--bg-hover);
}

.history-popup-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.history-popup-footer {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
}

.history-popup-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-color-secondary);
    font-size: 13px;
    opacity: 0.6;
}

/* Sidebar Footer Adjustments */
.sidebar .sidebar-footer {
    border-top: 1px solid transparent !important;
    /* Effectively hidden but keeps layout */
    margin-top: auto;
    padding: 12px 0;
    flex-shrink: 0;
}

/* Remove border line in profile section */
.sidebar-footer {
    border-top: none !important;
}

/* Hide legacy elements */
.search-bar i,
.search-bar input {
    display: none !important;
}

/**
 * No Chat State CSS Module
 * 
 * This module ONLY handles styling for the "no chat" / "new chat" state.
 * It is completely isolated and will NOT affect the "has chat" state.
 * 
 * This state is active when:
 * - .main-content does NOT have .has-chat class
 * - .centered-content is visible
 */

/* ============================================
   NO CHAT STATE - Centered Content
   ============================================ */

/* Ensure wrapper fills space and centers content */
.main-content:not(.has-chat) .main-content-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* TODO: Re-enable mode segment selector next time
.main-content:not(.has-chat) .header-segmented-switch {
    display: none !important;
}
*/

/* Hide autoDropdown in main input section on desktop for no-chat state */
@media (min-width: 1200px) {
    .main-content:not(.has-chat) #autoDropdown {
        display: none !important;
    }
}

/* Show autoDropdown in main input section on mobile for no-chat state */
@media (max-width: 1199px) {
    .main-content:not(.has-chat) #autoDropdown {
        display: flex !important;
    }
}

/* Only apply when main-content does NOT have has-chat class */
.main-content:not(.has-chat) .centered-content {
    flex: 1;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 900px !important;
    margin: 0 auto !important;
    width: 100%;
    max-height: 100vh;
    overflow-y: auto;
    padding: 24px;
    height: auto !important;
}

/* Welcome Section */
.main-content:not(.has-chat) .welcome-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: 800px;
    margin-bottom: 48px;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content:not(.has-chat) .welcome-icon {
    margin-bottom: 16px;
}

.main-content:not(.has-chat) .welcome-greeting {
    font-size: 32px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    opacity: 0.9;
}

.main-content:not(.has-chat) .welcome-heading {
    font-size: 56px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.1;
    letter-spacing: -1px;
}

.main-content:not(.has-chat) .welcome-hint {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 16px;
    opacity: 0.8;
    max-width: 600px;
    line-height: 1.5;
}

/* Input container in no-chat state */
.main-content:not(.has-chat) .main-input-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    padding: 0;
    border-top: none;
}

.main-content:not(.has-chat) .input-surface {
    background: var(--input-main-bg);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    transition: box-shadow 0.2s, border-color 0.2s;
    min-height: 100px;
}

.main-content:not(.has-chat) .input-surface:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.main-content:not(.has-chat) .main-input-box {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 16px 20px;
    display: grid !important;
    grid-template-areas: "input input" "left right" !important;
    grid-template-columns: 1fr auto !important;
    gap: 12px !important;
    align-items: stretch !important;
}

.main-content:not(.has-chat) .input-left-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    grid-area: left !important;
}

.main-content:not(.has-chat) .input-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    grid-area: right !important;
    justify-self: end;
}

.main-content:not(.has-chat) .input-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.main-content:not(.has-chat) .input-icon-btn:hover {
    background: var(--nav-active-bg);
    color: var(--text-primary);
}

.main-content:not(.has-chat) .input-tools-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 40px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.main-content:not(.has-chat) .input-tools-btn:hover {
    background: var(--nav-active-bg);
    border-color: var(--text-faded);
    color: var(--text-primary);
}

.main-content:not(.has-chat) .main-input {
    grid-area: input !important;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    padding: 8px 0;
    outline: none;
    resize: none;
    line-height: 1.5;
    min-height: 40px;
}

.main-content:not(.has-chat) .input-speed-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    height: 32px;
    border-radius: 16px;
    background: var(--nav-active-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.main-content:not(.has-chat) .send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.main-content:not(.has-chat) .send-button:hover {
    background: var(--nav-active-bg);
}

.main-content:not(.has-chat) .send-button svg {
    position: absolute;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content:not(.has-chat) .send-button .voice-icon {
    opacity: 1;
    transform: scale(1);
}

.main-content:not(.has-chat) .send-button .send-icon {
    opacity: 0;
    transform: scale(0.8) translateY(8px);
}

.main-content:not(.has-chat) .send-button.has-text .voice-icon {
    opacity: 0;
    transform: scale(0.8) translateY(-8px);
    pointer-events: none;
}

.main-content:not(.has-chat) .send-button.has-text .send-icon {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Action Pills */
.main-content:not(.has-chat) .action-pills-container {
    display: flex;
    gap: 8px;
    margin-top: 32px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 800px;
}

.main-content:not(.has-chat) .action-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.main-content:not(.has-chat) .action-pill:hover,
.main-content:not(.has-chat) .action-pill.active {
    background: var(--input-main-bg);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.main-content:not(.has-chat) .pill-icon {
    font-size: 18px;
}

/* AI disclaimer in no-chat state */
.main-content:not(.has-chat) .centered-content .ai-disclaimer {
    display: none !important;
}

/* Login Disclaimer - Default hidden */
.login-disclaimer {
    display: none;
}

/* Show Login Disclaimer ONLY in no-chat state for logged-out users */
body:not(.user-logged-in) .main-content:not(.has-chat) .login-disclaimer {
    display: block !important;
    position: fixed;
    bottom: 12px;
    left: 0;
    width: 100%;
    font-size: 14px;
    color: var(--text-primary);
    text-align: center;
    opacity: 0.7;
    z-index: 100;
    padding: 10px;
    background: transparent;
}

@media (max-width: 768px) {

    body:not(.user-logged-in) .main-content:not(.has-chat) .login-disclaimer,
    body:not(.user-logged-in) .main-content:not(.has-chat) .login-disclaimer * {
        display: none !important;
    }
}

@media (max-width: 768px) {

    body:not(.user-logged-in) .main-content:not(.has-chat) .login-disclaimer,
    body:not(.user-logged-in) .main-content:not(.has-chat) .login-disclaimer * {
        display: none !important;
    }
}

body:not(.user-logged-in) .main-content:not(.has-chat) .login-disclaimer a {
    color: var(--text-primary);
    text-decoration: underline;
    transition: color 0.2s;
}

body:not(.user-logged-in) .main-content:not(.has-chat) .login-disclaimer a:hover {
    color: var(--text-primary);
}

/* Ensure extended text and close button are hidden in no-chat state */
.main-content:not(.has-chat) .extended-disclaimer-text,
.main-content:not(.has-chat) .disclaimer-close-btn {
    display: none !important;
}

/* Hide chat messages container in no-chat state */
.main-content:not(.has-chat) .chat-messages-container {
    display: none !important;
}

/* Main header in no-chat state */
.main-content:not(.has-chat) .main-header {
    justify-content: flex-end;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Hide curriculum button specifically in "You Teach" mode (override general flex) */
body[data-active-mode="learn"] .main-content:not(.has-chat) #curriculumBtn {
    display: none !important;
}

.main-content:not(.has-chat) .main-header-logo {
    display: none !important;
}

/* Hide tools button in no-chat state */
.main-content:not(.has-chat) #toolsBtn {
    display: none !important;
}

/* Show curriculum button only in no-chat state - now allowed for guests too */
.main-content:not(.has-chat) #curriculumBtn.allow-guest,
.user-logged-in .main-content:not(.has-chat) #curriculumBtn {
    display: flex !important;
}

/* Hide curriculum button in has-chat state */
.main-content.has-chat #curriculumBtn {
    display: none !important;
}

/* Hide profile button in no-chat state */
.main-content:not(.has-chat) #profileBtn {
    display: none !important;
}

.main-content:not(.has-chat) #settingsBtn {
    display: none !important;
}

/* Note: Profile and settings buttons are hidden in has-chat state via has-chat-state.css */

/* Hide agent control in no-chat state */
.main-content:not(.has-chat) #agentControl {
    display: none !important;
}

/* Show agent control only when chats exist */
.main-content.has-chat #agentControl {
    display: inline-flex !important;
}

/* Hide curriculum insights button in no-chat state */
.main-content:not(.has-chat) #curriculumInsightsBtn {
    display: none !important;
}

/* Show curriculum insights button only when chats exist */
.main-content.has-chat #curriculumInsightsBtn {
    display: inline-flex !important;
}

/* Ensure no tool-related elements are visible in no-chat state */
.main-content:not(.has-chat) .tool-interface-panel,
.main-content:not(.has-chat) .chat-section-wrapper {
    display: none !important;
}

/* Mobile-specific styles for no-chat state */
@media (max-width: 1199px) {

    /* Ensure main-content itself is properly aligned on mobile */
    .main-content:not(.has-chat) {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: center !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
        padding-top: 56px !important;
        /* Account for fixed header */
        position: relative !important;
    }

    /* Fix header visibility on mobile when no chat - use fixed positioning */
    .main-content:not(.has-chat) .main-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        background-color: var(--main-bg) !important;
        border-bottom: none !important;
        width: 100% !important;
        padding: 10px 15px !important;
        justify-content: flex-end !important;
    }

    /* Ensure centered content is properly centered on mobile - account for header */
    .main-content:not(.has-chat) .centered-content {
        align-items: flex-start !important;
        justify-content: center !important;
        text-align: left !important;
        padding: 16px !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }

    /* Ensure main logo is centered on mobile */
    .main-content:not(.has-chat) .welcome-section {
        align-items: flex-start !important;
        text-align: left;
        margin-bottom: 32px;
        padding-left: 16px !important;
        box-sizing: border-box !important;
    }

    .main-content:not(.has-chat) .welcome-heading {
        font-size: 32px !important;
    }

    .main-content:not(.has-chat) .welcome-greeting {
        font-size: 20px !important;
    }

    /* Ensure input container is centered on mobile */
    .main-content:not(.has-chat) .main-input-container {
        padding: 0 16px !important;
    }

    /* Ensure all child elements are centered and input box mimics has-chat layout */
    .main-content:not(.has-chat) .main-input-box {
        border-radius: 0 !important;
        border: none !important;
        background: transparent !important;
        padding: 8px 12px !important;
        display: grid !important;
        grid-template-areas: "input input" "left right" !important;
        grid-template-columns: 1fr auto !important;
        gap: 8px !important;
        align-items: center !important;
    }

    .main-content:not(.has-chat) .main-input {
        font-size: 16px;
        order: -1;
        width: 100%;
        min-width: 100%;
        padding: 4px 8px;
    }

    .main-content:not(.has-chat) .main-input::placeholder {
        font-size: 13px !important;
    }

    .main-content:not(.has-chat) .input-left-actions {
        flex: 1;
    }

    .main-content:not(.has-chat) .action-pills-container {
        gap: 8px;
        margin-top: 24px;
        justify-content: center !important;
    }

    .main-content:not(.has-chat) .action-pill {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/**
 * Has Chat State CSS Module
 * 
 * This module ONLY handles styling for the "has chat" state.
 * It is completely isolated and will NOT affect the "no chat" state.
 * 
 * This state is active when:
 * - .main-content has .has-chat class
 * - .chat-messages-container is visible
 */

/* ============================================
   HAS CHAT STATE - Chat Messages Container
   ============================================ */

/* Main content when chat is active */
.main-content.has-chat {
    padding-bottom: 0;
    padding-top: 0;
    margin-top: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    height: 100vh;
    /* Use dvh for keyboard-safe height on mobile */
    height: 100dvh;
    flex-direction: column;
}

/* RESET padding from app-container for anonymous users in has-chat state */
/* This prevents the 100vh content from being pushed down by the container padding in style.css */
body:not(.user-logged-in).session-checked .main-content.has-chat {
    margin-top: 0 !important;
    flex: 1 !important;
    height: auto !important;
    min-height: 0 !important;
}

/* Removed padding-top: 0 override to maintain header clearance */

body:not(.user-logged-in).session-checked[data-has-conversation="true"] .main-content.has-chat {
    margin-top: 0 !important;
    flex: 1 !important;
    height: auto !important;
    min-height: 0 !important;
}

@media (max-width: 1199px) {
    body:not(.user-logged-in).session-checked .main-content.has-chat {
        margin-top: 0 !important;
        flex: 1 !important;
        height: auto !important;
        min-height: 0 !important;
    }

    /* Removed padding-top: 0 override to maintain header clearance on mobile */
}

/* Hide centered content when chat is active (unless tool is open) */
.main-content.has-chat:not(.has-tool-open) .centered-content {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Chat messages container in has-chat state (without tool) */
.main-content.has-chat:not(.has-tool-open) .chat-messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 8px 24px;
    display: flex !important;
    flex-direction: column;
    gap: 6px;
    /* Ensure scrolling works on mobile */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Input container in has-chat state (without tool) */
.main-content.has-chat:not(.has-tool-open) .main-input-container {
    position: sticky;
    bottom: 0;
    background-color: var(--main-bg);
    padding: 10px 24px;
    border-top: none;
    z-index: 1010;
    /* Ensure it stays above loading overlay (z-index 1000) */
    max-width: 100%;
    margin: 0;
    width: 100%;
    flex-shrink: 0;
}

/* Attached files + input should feel like one surface */
.main-content.has-chat .main-input-container .input-surface {
    background-color: var(--input-main-bg, #2a2a2a) !important;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1)) !important;
    border-radius: 16px !important;
    overflow: hidden !important;
}

.main-content.has-chat .main-input-container .input-surface:focus-within {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 1px var(--accent) !important;
}

.main-content.has-chat .file-preview-container:not([style*="display: none"]) {
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 12px !important;
    margin-bottom: 0 !important;
    display: flex !important;
    gap: 8px !important;
}

.main-content.has-chat .file-error-message {
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 8px 12px !important;
}

.main-content.has-chat .main-input-container .main-input-box {
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
}

/* Hide resize handle on textarea for all screen sizes in has-chat state */
.main-content.has-chat:not(.has-tool-open) .main-input {
    resize: none !important;
    overflow-y: auto !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: pre-wrap !important;
    line-height: 1.5 !important;
    min-height: 24px !important;
    max-height: 200px !important;
}

/* Hide "no chat" elements in has-chat state */
.main-content.has-chat .welcome-section,
.main-content.has-chat .action-buttons,
.main-content.has-chat .action-pills-container,
.main-content.has-chat #practiceTestOptions,
.main-content.has-chat #studyPlanOptions,
.main-content.has-chat #memorizeOptions {
    display: none !important;
}

/* Ensure main input box is always shown in has-chat state */
.main-content.has-chat .main-input-box {
    display: flex !important;
}

/* Show AI disclaimer in has-chat state */
.main-content.has-chat .ai-disclaimer {
    display: block !important;
    text-align: center;
    margin-top: 12px;
    padding: 0 16px;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Ensure AI disclaimer is visible for anonymous users */
body:not(.user-logged-in) .main-content.has-chat .ai-disclaimer {
    display: block !important;
    visibility: visible !important;
    opacity: 0.7 !important;
}

/* Main header in has-chat state */
.main-content.has-chat .main-header {
    justify-content: space-between;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 0;
    margin-bottom: 0;
}

/* Hide main-header completely for anonymous users in has-chat state */
/* The main-header-bar (with login/signup) will act as the header instead */
body:not(.user-logged-in) .main-content.has-chat .main-header {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Ensure main-header-bar is visible and acts as header for anonymous users in has-chat state */
body:not(.user-logged-in) .main-content.has-chat~.main-header-bar,
body:not(.user-logged-in) .main-content.has-chat .main-header-bar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: 64px !important;
}

/* On mobile, header bar is 56px */
@media (max-width: 1199px) {

    body:not(.user-logged-in) .main-content.has-chat~.main-header-bar,
    body:not(.user-logged-in) .main-content.has-chat .main-header-bar {
        height: 56px !important;
    }
}

.main-content.has-chat .main-header-logo {
    display: flex !important;
    align-items: center;
    gap: 12px;
    margin-right: auto;
}

/* Hide logo on mobile/tablet screens */
@media (max-width: 1199px) {
    .main-content.has-chat .main-header-logo {
        display: none !important;
    }

    .main-content.has-chat .main-header {
        justify-content: space-between;
        /* Use fixed positioning on mobile so header stays visible when keyboard opens */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        background-color: var(--main-bg) !important;
        border-bottom: none !important;
        width: 100% !important;
        padding: 16px 10px !important;
    }

    /* Add padding-top to main-content to account for fixed header */
    /* Use higher specificity to override style.css padding-top: 0 rule */
    /* Main content layout on mobile - flex column with chat scrolling */
    body .main-content.has-chat {
        padding-top: 0 !important;
        margin-top: 0 !important;
        flex: 1 !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        box-sizing: border-box !important;
        /* Ensure flexbox properly distributes space so input stays visible */
        align-items: stretch !important;
        justify-content: flex-start !important;
        position: relative !important;
    }

    /* Ensure chat messages container scrolls properly on mobile */
    /* Let flexbox handle the height naturally - no explicit height needed */
    .main-content.has-chat:not(.has-tool-open) .chat-messages-container {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        padding-top: 65px !important;
        overscroll-behavior: contain !important;
        padding-bottom: 16px !important;
        box-sizing: border-box !important;
        position: relative !important;
    }

    .main-content.has-chat:not(.has-tool-open) .main-input-container {
        padding: 12px 16px calc(16px + env(safe-area-inset-bottom)) 16px !important;
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        flex-basis: auto !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 1010 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0 !important;
        background-color: var(--main-bg) !important;
    }

    /* Compact layout for smaller screens to show more messages */
    @media (max-width: 767px) {
        .main-content.has-chat:not(.has-tool-open) .chat-messages-container {
            padding: 56px 12px 16px 12px !important;
            gap: 10px !important;
        }

        .main-content.has-chat:not(.has-tool-open) .main-input-container {
            padding: 10px 12px calc(12px + env(safe-area-inset-bottom)) 12px !important;
        }

        .main-content.has-chat:not(.has-tool-open) .main-input-box {
            padding: 10px !important;
            gap: 10px !important;
            border: none !important;
            border-radius: 0 !important;
            background: transparent !important;
        }

        .main-content.has-chat:not(.has-tool-open) .main-input {
            font-size: 15px !important;
            max-height: 100px !important;
            line-height: 1.4 !important;
        }
    }

    /* When tool is open on mobile - stack vertically */
    .main-content.has-chat.has-tool-open .centered-content {
        flex-direction: column !important;
    }

    .main-content.has-chat.has-tool-open .chat-section-wrapper {
        width: 100% !important;
        flex: 1 !important;
        border-right: none !important;
    }

    /* ============================================
       MOBILE INPUT STYLING FOR HAS-CHAT STATE
       ============================================ */

    /* Main input box - transparent inside the input-surface wrapper */
    .main-content.has-chat:not(.has-tool-open) .main-input-box {
        background-color: transparent !important;
        border-radius: 0 !important;
        border: none !important;
        padding: 12px !important;
        margin-bottom: 0 !important;
        display: grid !important;
        grid-template-areas: "input input" "left right" !important;
        grid-template-columns: 1fr auto !important;
        gap: 12px !important;
        align-items: center !important;
        position: relative !important;
    }

    /* Main input field - on top, full width, supports multi-line text wrapping */
    .main-content.has-chat:not(.has-tool-open) .main-input {
        grid-area: input !important;
        width: 100% !important;
        background: transparent !important;
        border: none !important;
        color: var(--text-primary, #ffffff) !important;
        font-size: 16px !important;
        padding: 0 !important;
        outline: none !important;
        resize: none !important;
        overflow-y: auto !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: pre-wrap !important;
        line-height: 1.5 !important;
        min-height: 24px !important;
        max-height: 120px !important;
    }

    .main-content.has-chat:not(.has-tool-open) .main-input::placeholder {
        color: rgba(255, 255, 255, 0.5) !important;
        font-size: 13px !important;
    }

    /* Paperclip button - in buttons row on the left */
    .main-content.has-chat:not(.has-tool-open) .attach-btn {
        grid-area: left !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        background: transparent !important;
        border: none !important;
        color: #ffffff !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        transition: background-color 0.2s !important;
        justify-self: start !important;
        align-self: center !important;
    }

    .main-content.has-chat:not(.has-tool-open) .attach-btn:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
    }

    .main-content.has-chat:not(.has-tool-open) .attach-btn i {
        font-size: 18px !important;
        color: #ffffff !important;
    }

    /* Buttons row container - below input, contains Auto and Send buttons, positioned on the right */
    .main-content.has-chat:not(.has-tool-open) .input-right-actions {
        grid-area: right !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        justify-self: end !important;
        align-self: center !important;
        flex-shrink: 0 !important;
    }

    /* Hide autoDropdown (mode selector) completely in has-chat state */
    .main-content.has-chat:not(.has-tool-open) #autoDropdown {
        display: none !important;
    }

    /* Send button - single button that transitions between live chat and send icons */
    .main-content.has-chat:not(.has-tool-open) .send-button {
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        background: var(--bg-tertiary) !important;
        border: none !important;
        color: var(--text-primary) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        transition: background-color 0.2s, opacity 0.2s !important;
        cursor: pointer !important;
        position: relative !important;
    }

    .main-content.has-chat:not(.has-tool-open) .send-button:hover {
        background: var(--nav-active-bg) !important;
    }

    .main-content.has-chat:not(.has-tool-open) .send-button svg {
        position: absolute !important;
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .main-content.has-chat:not(.has-tool-open) .send-button .voice-icon {
        opacity: 1 !important;
        transform: scale(1) translateY(0) !important;
        width: 18px !important;
        height: 18px !important;
    }

    .main-content.has-chat:not(.has-tool-open) .send-button .send-icon {
        opacity: 0 !important;
        transform: scale(0.8) translateY(8px) !important;
        width: 16px !important;
        height: 16px !important;
        display: block !important;
    }

    .main-content.has-chat:not(.has-tool-open) .send-button.has-text .voice-icon {
        opacity: 0 !important;
        transform: scale(0.8) translateY(-8px) !important;
        pointer-events: none !important;
    }

    .main-content.has-chat:not(.has-tool-open) .send-button.has-text .send-icon {
        opacity: 1 !important;
        transform: scale(1) translateY(0) !important;
    }

    /* Voice icon - commented out for now */
    /*
    .main-content.has-chat:not(.has-tool-open) .send-button .voice-icon {
        display: block !important;
        width: 20px !important;
        height: 20px !important;
        color: #1a1a1a !important;
    }
    */

    /* Hide memorize tools dropdown on mobile in has-chat state */
    .main-content.has-chat:not(.has-tool-open) #memorizeToolsDropdown {
        display: none !important;
    }

}

/* ============================================
   DESKTOP/TABLET - Hide mode text in has-chat state
   ============================================ */

@media (min-width: 1200px) {

    /* Hide autoDropdown completely in has-chat state */
    .main-content.has-chat:not(.has-tool-open) #autoDropdown {
        display: none !important;
    }

    /* Hide resize handle and set higher max-height for desktop/tablet in has-chat state */
    .main-content.has-chat:not(.has-tool-open) .main-input {
        resize: none !important;
        max-height: 200px !important;
    }

    /* Redesign input box to stacked layout on desktop - transparent wrapper */
    .main-content.has-chat:not(.has-tool-open) .main-input-box {
        display: grid !important;
        grid-template-areas: "input input" "left right" !important;
        grid-template-columns: 1fr auto !important;
        gap: 12px !important;
        padding: 16px 20px !important;
        border-radius: 0 !important;
        border: none !important;
        background: transparent !important;
        align-items: stretch !important;
    }

    .main-content.has-chat:not(.has-tool-open) .main-input {
        grid-area: input !important;
        resize: none !important;
        max-height: 200px !important;
        min-height: 40px !important;
    }

    .main-content.has-chat:not(.has-tool-open) .input-left-actions {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        grid-area: left !important;
    }

    .main-content.has-chat:not(.has-tool-open) .input-right-actions {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        grid-area: right !important;
        justify-self: end !important;
    }

    .main-content.has-chat:not(.has-tool-open) .attach-btn {
        align-self: center !important;
    }
}

/* TODO: Re-enable mode segment selector next time */
/* Completely hide header segmented switch for now */
.main-content.has-chat .header-segmented-switch,
.main-content:not(.has-chat) .header-segmented-switch {
    display: none !important;
}

/*
Header segmented switch - show only in has-chat state
.main-content.has-chat .header-segmented-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

Hide extra modes on mobile - show only first 3 (Teach Me, You Teach, Chat)
@media (max-width: 1199px) {
    .main-content.has-chat .header-segment.header-mode-mobile-hidden {
        display: none !important;
    }
}

Hide header mode selector on desktop
@media (min-width: 1200px) {
    .main-content.has-chat .header-segmented-switch {
        display: none !important;
    }
    
    Hide autoDropdown in main input section on desktop
    .main-content.has-chat:not(.has-tool-open) #autoDropdown {
        display: none !important;
    }
}
*/

/* Hide autoDropdown in main input section on mobile too */
@media (max-width: 1199px) {
    .main-content.has-chat:not(.has-tool-open) #autoDropdown {
        display: none !important;
    }

    /* Reduce gap between icons in header right section on mobile */
    .main-content.has-chat .header-right-section {
        gap: 6px !important;
    }
}

/* Show profile, settings, and tools buttons on all screens - has-chat state */
/* Profile, settings, and tools buttons - only show if preloaded curriculum */
/* Profile button - only show if preloaded curriculum (legacy/specific logic) */
.main-content.has-chat #profileBtn {
    display: none !important;
}

.main-content.has-chat #profileBtn.is-preloaded-curriculum {
    display: inline-flex !important;
}

/* Always show Insights, Agent Mode, Settings, and Tools buttons in chat */
.main-content.has-chat #curriculumInsightsBtn,
.main-content.has-chat #agentControl,
.main-content.has-chat #settingsBtn,
.main-content.has-chat #toolsBtn {
    display: inline-flex !important;
}

/* Main logo image in has-chat state - keep visible */
.main-content.has-chat .main-header-logo .main-logo-image {
    display: inline-block !important;
}

/* Require chat button visibility */
.main-content.has-chat .require-chat {
    display: inline-flex !important;
}

/* Centered content in has-chat state */
.main-content.has-chat .centered-content {
    max-width: 100%;
}

/* ============================================
   BACK TO BOTTOM BUTTON
   ============================================ */

.back-to-bottom-btn {
    position: fixed;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--input-main-bg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--input-border-color);
    cursor: pointer;
    z-index: 1020;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Only allow visibility when in has-chat state */
.main-content.has-chat~.back-to-bottom-btn.visible,
.main-content.has-chat .back-to-bottom-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.back-to-bottom-btn:hover {
    transform: translateX(-50%) translateY(-2px);
}

.back-to-bottom-btn:active {
    transform: translateX(-50%) translateY(0);
}

.back-to-bottom-btn svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 1199px) {
    .back-to-bottom-btn {
        bottom: 140px;
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   HAS CHAT WITH TOOL STATE
   ============================================ */

/* When tool is open - split view layout */
.main-content.has-chat.has-tool-open {
    overflow: hidden;
}

/* Centered content when tool is open - becomes flex row */
.main-content.has-chat.has-tool-open .centered-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    height: calc(100vh - 56px) !important;
    /* Full viewport minus header */
    min-height: calc(100vh - 56px) !important;
    overflow: hidden !important;
    flex: 1 !important;
    padding: 0 !important;
}

/* Chat section wrapper - fixed width when tool is open */
.main-content.has-chat.has-tool-open .chat-section-wrapper {
    display: flex;
    flex-direction: column;
    width: 550px;
    flex: 0 0 550px;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
    background-color: var(--main-bg);
}


/* Chat messages container in tool state */
.main-content.has-chat.has-tool-open .chat-section-wrapper .chat-messages-container {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 16px 24px;
    display: flex !important;
    flex-direction: column;
    gap: 12px;
}

/* Input container in tool state */
.main-content.has-chat.has-tool-open .chat-section-wrapper .main-input-container {
    width: 100%;
    flex: 0 0 auto;
    border-top: none;
    padding: 12px 24px;
    resize: none !important;
    overflow: hidden !important;
}

/* Prevent resize on input when tool is open */
.main-content.has-chat.has-tool-open .chat-section-wrapper .main-input {
    resize: none !important;
    overflow-y: auto !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: pre-wrap !important;
    line-height: 1.5 !important;
    min-height: 24px !important;
    max-height: 200px !important;
}

/* Hide autoDropdown (select mode) in main input section when tool is open */
.main-content.has-chat.has-tool-open #autoDropdown {
    display: none !important;
}

/* Tool interface panel */
.main-content.has-chat.has-tool-open .tool-interface-panel {
    display: flex;
    flex: 1;
    background-color: var(--tool-bg, var(--input-bg));
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* Remove border-right when tool is open */
.main-content.has-chat.has-tool-open .chat-section-wrapper {
    border-right: none;
}

/* Hide main logo when tool is open */
.main-content.has-chat.has-tool-open .main-logo {
    display: none !important;
}

/* ============================================
   LOGIN DISCLAIMER BANNER (HAS CHAT STATE)
   ============================================ */

/* Base style for the banner in has-chat state */
body:not(.user-logged-in) .main-content.has-chat .login-disclaimer {
    position: absolute;
    bottom: 100%;
    /* Sits exactly on top of the input container */
    margin-bottom: 20px;
    /* Add visual spacing */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    background-color: var(--input-main-bg, #2a2a2a);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    padding: 12px 16px;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 1020;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideUpFade 0.3s ease-out;
    pointer-events: auto;
    /* Ensure clickable */
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Content wrapper */
body:not(.user-logged-in) .main-content.has-chat .login-disclaimer .disclaimer-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

/* Links style */
body:not(.user-logged-in) .main-content.has-chat .login-disclaimer a {
    color: var(--text-primary);
    text-decoration: underline;
    opacity: 0.9;
}

body:not(.user-logged-in) .main-content.has-chat .login-disclaimer a:hover {
    opacity: 1;
}

/* Extended text visibility */
body:not(.user-logged-in) .main-content.has-chat .extended-disclaimer-text {
    display: inline !important;
    margin-left: 4px;
}

/* Close button style */
body:not(.user-logged-in) .main-content.has-chat .disclaimer-close-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

body:not(.user-logged-in) .main-content.has-chat .disclaimer-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Hidden state (when closed by user) */
body:not(.user-logged-in) .main-content.has-chat .login-disclaimer.hidden {
    display: none !important;
}

/* Mobile adjustments */
@media (max-width: 767px) {

    body:not(.user-logged-in) .main-content.has-chat .login-disclaimer,
    body:not(.user-logged-in) .main-content.has-chat .login-disclaimer * {
        display: none !important;
    }
}

/* ========================================
   FLASHCARDS - CLEAN MODERN DESIGN
   ======================================== */

/* Main Container */
.flashcards-interface {
    display: flex;
    height: 100%;
    width: 100%;
    justify-content: center;
    align-items: center;
}

.flashcards-content {
    position: relative;
    width: 100%;
}

.flashcards-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px;
}

.flashcards-action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    padding: 20px;
}

.flashcards-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.flashcards-progress {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #86868b;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
}

.flashcards-card-container {
    perspective: 2000px;
    margin-bottom: 32px;
}

.flashcards-card {
    width: 100%;
    height: 520px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.flashcards-card.flipped {
    transform: rotateY(180deg);
}

.flashcards-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    border-radius: 28px;
    background: #ffffff;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.flashcards-card-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.flashcards-card-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1d1d1f;
}

.flashcards-card-action-btn:hover {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.flashcards-card-action-btn:active {
    transform: scale(0.95);
}

.flashcards-card-edit-btn:hover {
    color: #0071e3;
}

.flashcards-card-delete-btn:hover {
    color: #ff3b30;
    background: rgba(255, 59, 48, 0.1);
}

.flashcards-card-action-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.flashcards-card:hover .flashcards-card-face {
    box-shadow: 0 8px 60px rgba(0, 0, 0, 0.12);
}

.flashcards-card-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 24px;
    color: #86868b;
}

.flashcards-card-content {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: #1d1d1f;
}

.flashcards-card-front {
    background: #ffffff;
}

.flashcards-card-front .flashcards-card-label {
    color: #0071e3;
}

.flashcards-card-back {
    background: #ffffff;
    transform: rotateY(180deg);
}

.flashcards-card-back .flashcards-card-content {
    font-size: 24px;
    font-weight: 500;
}

.flashcards-card-back .flashcards-card-label {
    color: #06c;
}

.flashcards-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.flashcards-center-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.flashcards-btn {
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border: none;
    border-radius: 980px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.flashcards-btn-nav {
    background: #ffffff;
    color: #1d1d1f;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.flashcards-btn-nav:hover:not(:disabled) {
    background: #f5f5f7;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.flashcards-btn-nav:active:not(:disabled) {
    transform: scale(0.98);
}

.flashcards-btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.flashcards-btn-flip {
    background: #0071e3;
    color: #ffffff;
    padding: 14px 36px;
    box-shadow: 0 2px 12px rgba(0, 113, 227, 0.3);
}

.flashcards-btn-flip:hover {
    background: #0077ed;
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.4);
    transform: translateY(-1px);
}

.flashcards-btn-flip:active {
    transform: scale(0.98);
}

.flashcards-rating-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.flashcards-controls .flashcards-rating-buttons {
    margin: 0;
}

.flashcards-btn-correct {
    background: #34c759;
    color: #ffffff;
    padding: 12px 24px;
    box-shadow: 0 2px 12px rgba(52, 199, 89, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.flashcards-btn-correct:hover {
    background: #30d158;
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.4);
    transform: translateY(-1px);
}

.flashcards-btn-correct:active {
    transform: scale(0.98);
}

.flashcards-btn-incorrect {
    background: #ff3b30;
    color: #ffffff;
    padding: 12px 24px;
    box-shadow: 0 2px 12px rgba(255, 59, 48, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.flashcards-btn-incorrect:hover {
    background: #ff453a;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.4);
    transform: translateY(-1px);
}

.flashcards-btn-incorrect:active {
    transform: scale(0.98);
}

.flashcards-btn-correct svg,
.flashcards-btn-incorrect svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* Create Flashcard Modal - Inspired by Action Not Available Popup */
.modal#flashcardsCreateModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
    align-items: center;
    justify-content: center;
}

.modal#flashcardsCreateModal[style*="display: flex"] {
    display: flex !important;
}

.modal-content.create-modal {
    position: relative;
    background: var(--sidebar-bg, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    min-width: 400px;
    max-width: 500px;
    width: 90%;
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--border-color, #D9D9D9);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-content.create-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.modal-body {
    padding: 24px;
}

.modal-title {
    margin: 0 0 20px 0;
}

.modal-title h3 {
    margin: 0;
    font-size: var(--font-size-xlarge, 20px);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.flashcards-form-group {
    margin-bottom: 20px;
}

.flashcards-form-group:last-of-type {
    margin-bottom: 24px;
}

.flashcards-form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-base, 15px);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.flashcards-label-icon {
    font-size: 16px;
}

.flashcards-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--input-border, #CCCCCC);
    border-radius: 12px;
    font-size: var(--font-size-base, 15px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--input-bg, #FFFFFF);
    transition: all 0.2s ease;
    resize: vertical;
    line-height: 1.5;
    box-sizing: border-box;
}

.flashcards-form-input:focus {
    outline: none;
    border-color: var(--accent, #4A74E8);
    box-shadow: 0 0 0 2px rgba(74, 116, 232, 0.1);
}

.flashcards-form-input::placeholder {
    color: var(--text-faded, #777777);
}

.flashcards-difficulty-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.flashcards-difficulty-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-primary, #e5e5e7);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1d1d1f);
    background: var(--background, #ffffff);
}

.flashcards-difficulty-option:hover {
    border-color: var(--primary, #0071e3);
    background: var(--background-secondary, #f5f5f7);
}

.flashcards-difficulty-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary, #0071e3);
}

.flashcards-difficulty-option input[type="radio"]:checked+span {
    color: var(--primary, #0071e3);
    font-weight: 600;
}

.flashcards-difficulty-option:has(input[type="radio"]:checked) {
    border-color: var(--primary, #0071e3);
    background: var(--background-secondary, rgba(0, 113, 227, 0.05));
}

.flashcards-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.flashcards-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border-primary, #e5e5e7);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1d1d1f);
    background: var(--background, #ffffff);
}

.flashcards-radio-label:hover {
    border-color: var(--primary, #0071e3);
    background: var(--background-secondary, #f5f5f7);
}

.flashcards-radio-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary, #0071e3);
}

.flashcards-radio-label:has(input[type="radio"]:checked) {
    border-color: var(--primary, #0071e3);
    background: var(--background-secondary, rgba(0, 113, 227, 0.05));
}

.flashcards-radio-label:has(input[type="radio"]:checked) span {
    color: var(--primary, #0071e3);
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color, #D9D9D9);
    width: 100%;
}

.btn {
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: var(--font-size-base, 15px);
    flex: 1;
    width: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-cancel {
    background: var(--nav-active-bg, #F2F2F2);
    color: var(--text-secondary, #444444);
    border: 1px solid var(--border-color, #D9D9D9);
}

.btn-cancel:hover {
    background: var(--input-bg, #FFFFFF);
    color: var(--text-primary);
}

.btn-create {
    background: var(--accent, #4A74E8);
    color: #ffffff;
    border: 1px solid var(--accent, #4A74E8);
}

.btn-create:hover {
    background: var(--accent-hover, #6C90FF);
    border-color: var(--accent-hover, #6C90FF);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 116, 232, 0.3);
}

.btn-create[style*="background: #ef4444"] {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
}

.btn-create[style*="background: #ef4444"]:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

/* Edit and Delete Modal Styles */
.modal#flashcardsEditModal,
.modal#flashcardsDeleteModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
    align-items: center;
    justify-content: center;
}

.modal#flashcardsEditModal[style*="display: flex"],
.modal#flashcardsDeleteModal[style*="display: flex"] {
    display: flex !important;
}

/* Bluey Generate Modal Styles */
.modal#blueyQuizModal,
.modal#blueyProcessingModal,
.modal#processingModal,
.modal#blueyGenerateModal,
.modal#flashcardsProcessingModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10003;
    animation: fadeIn 0.3s ease-out;
    align-items: center;
    justify-content: center;
}

.modal#blueyQuizModal[style*="display: flex"],
.modal#blueyProcessingModal[style*="display: flex"],
.modal#processingModal[style*="display: flex"],
.modal#blueyGenerateModal[style*="display: flex"],
.modal#flashcardsProcessingModal[style*="display: flex"] {
    display: flex !important;
}

/* Processing Modal Specific Styles - Matching Quiz Popup Exactly */
.modal#processingModal .modal-content.create-modal,
.modal#flashcardsProcessingModal .modal-content.create-modal {
    min-width: auto !important;
    max-width: 400px !important;
    width: auto !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

.modal#processingModal .modal-body,
.modal#flashcardsProcessingModal .modal-body {
    padding: 40px 28px !important;
    text-align: center !important;
}

.modal#processingModal img,
.modal#flashcardsProcessingModal img {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    border-radius: 50% !important;
    display: block !important;
    margin: 0 auto !important;
}

.modal#processingModal h3,
.modal#flashcardsProcessingModal h3 {
    margin: 0 0 12px 0 !important;
    color: var(--text-primary, #1d1d1f) !important;
    font-size: 20px !important;
    font-weight: 600 !important;
}

.modal#processingModal p,
.modal#flashcardsProcessingModal p {
    margin: 0 !important;
    color: var(--text-secondary, #6e6e73) !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}

.modal#processingModal>div>div>div[style*="margin-bottom"],
.modal#flashcardsProcessingModal>div>div>div[style*="margin-bottom"] {
    margin-bottom: 24px !important;
}

.modal#processingModal>div>div>div[style*="margin-top"],
.modal#flashcardsProcessingModal>div>div>div[style*="margin-top"] {
    margin-top: 20px !important;
}

.bluey-chapters-selection {
    margin-top: 10px;
}

.bluey-chapters-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--border-primary, #e5e5e7);
    border-radius: var(--radius-lg, 12px);
    background: var(--background, #ffffff);
}

.bluey-chapter-item {
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

.bluey-chapters-grid .bluey-chapter-checkbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 16px !important;
    border: 1px solid var(--border-primary, #e5e5e7) !important;
    border-radius: var(--radius-lg, 12px) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    background: var(--background, #ffffff) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--text-primary, #1d1d1f) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    transform: none !important;
}

.bluey-chapters-grid .bluey-chapter-checkbox-label::before {
    display: none !important;
}

.bluey-chapters-grid .bluey-chapter-checkbox-label:hover {
    border-color: var(--primary, #0071e3) !important;
    background: var(--background-secondary, #f5f5f7) !important;
    transform: none !important;
}

.bluey-chapters-grid .bluey-chapter-checkbox {
    margin: 0 !important;
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    accent-color: var(--primary, #0071e3) !important;
    flex-shrink: 0 !important;
}

.bluey-chapters-grid .bluey-chapter-name {
    flex: 1 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--text-primary, #1d1d1f) !important;
    line-height: 1.4 !important;
}

.bluey-chapters-grid .bluey-chapter-checkbox-label:has(input.bluey-chapter-checkbox:checked) {
    border-color: var(--primary, #0071e3) !important;
    background: var(--background-secondary, rgba(0, 113, 227, 0.05)) !important;
    transform: none !important;
}

.bluey-chapters-grid .bluey-chapter-checkbox-label:has(input.bluey-chapter-checkbox:checked)::before {
    display: none !important;
}

.bluey-chapters-grid .bluey-chapter-checkbox-label:has(input.bluey-chapter-checkbox:checked) .bluey-chapter-name {
    color: var(--primary, #0071e3) !important;
    font-weight: 600 !important;
}

.no-chapters {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary, #6e6e73);
    font-size: 14px;
}

select.flashcards-form-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23111111' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

/* Bluey button in generate modal */
.btn-create img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.bluey-loading-spinner {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.bluey-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn-create:has(.bluey-loading-spinner) {
    position: relative;
}

.btn-create .bluey-loading-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.btn-create .bluey-loading-spinner~span {
    opacity: 0;
}

.flashcards-hint {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: #86868b;
    font-weight: 500;
}

.flashcards-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.flashcards-action-btn:hover {
    background: #f5f5f7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.flashcards-action-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.flashcards-action-btn.active {
    background: var(--primary, #0071e3);
    box-shadow: 0 2px 12px rgba(0, 113, 227, 0.3);
}

.flashcards-action-btn.active:hover {
    background: var(--primary-hover, #0077ed);
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.4);
}

.flashcards-action-btn.active svg {
    color: #ffffff;
    stroke: #ffffff;
}

.flashcards-action-btn svg {
    color: #1d1d1f;
    transition: color 0.2s ease;
}

.flashcards-action-btn:hover svg {
    color: #0071e3;
}

.flashcards-action-btn img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 50%;
}

/* Adjust flashcards for tool interface panel */
.tool-interface-content .flashcards-card {
    height: 400px;
}

.tool-interface-content .flashcards-card-content {
    font-size: 24px;
}

.tool-interface-content .flashcards-card-back .flashcards-card-content {
    font-size: 18px;
}

@media (max-width: 600px) {
    .flashcards-card {
        height: 460px;
    }

    .flashcards-card-content {
        font-size: 28px;
    }

    .flashcards-card-back .flashcards-card-content {
        font-size: 20px;
    }
}

.leitner-interface {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.leitner-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Leitner top header section */
.leitner-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px;
}

.leitner-header {
    flex: 1;
}

.leitner-header h2 {
    white-space: nowrap;
    margin: 0;
}

.leitner-title {
    font-size: 40px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 12px;
    letter-spacing: -0.03em;
}

.leitner-subtitle {
    font-size: 17px;
    font-weight: 500;
    color: #86868b;
    letter-spacing: -0.01em;
}

.leitner-boxes-grid {
    display: grid;
    margin-top: 10%;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 48px;
}

.leitner-box-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 40vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.leitner-box-card:hover {
    box-shadow: 0 8px 60px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
}

.leitner-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px;
}

.leitner-action-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.leitner-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1d1d1f;
}

.leitner-action-btn:hover {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.leitner-action-btn:active {
    transform: scale(0.95);
}

.leitner-action-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.leitner-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.leitner-box-title {
    font-size: 24px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.02em;
    margin: 0;
}

.leitner-box-count {
    background: #f5f5f7;
    color: #1d1d1f;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
}

.leitner-box-schedule {
    font-size: 15px;
    color: #86868b;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.leitner-study-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.leitner-study-btn.active {
    background: #0071e3;
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 113, 227, 0.3);
}

.leitner-study-btn.active:hover {
    background: #0077ed;
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.4);
    transform: translateY(-2px);
}

.leitner-study-btn.inactive {
    background: #f5f5f7;
    color: #86868b;
    cursor: not-allowed;
}

.leitner-study-view {
    display: none;
}

.leitner-study-view.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.leitner-study-container {
    width: 100%;
    max-width: 480px;
    padding: 0;
    margin: 0;
}

.leitner-study-progress {
    text-align: center;
    margin-bottom: 24px;
    margin-top: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    color: #86868b;
    letter-spacing: -0.01em;
}

.leitner-card-container {
    perspective: 1500px;
    margin-bottom: 32px;
}

.leitner-card {
    width: 100%;
    max-width: 480px;
    height: 520px;
    margin: 0 auto;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.leitner-card.flipped {
    transform: rotateY(180deg);
}

.leitner-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    border-radius: 28px;
    background: #ffffff;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.leitner-card:hover .leitner-card-face {
    box-shadow: 0 8px 60px rgba(0, 0, 0, 0.12);
}

.leitner-card-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 24px;
    color: #0071e3;
}

.leitner-card-content {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: #1d1d1f;
}

.leitner-card-back {
    transform: rotateY(180deg);
}

.leitner-card-back .leitner-card-content {
    font-size: 24px;
    font-weight: 500;
}

.leitner-card-back .leitner-card-label {
    color: #06c;
}

.leitner-action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.leitner-card-action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.leitner-btn {
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border: none;
    border-radius: 980px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.leitner-btn-wrong {
    background: #ff3b30;
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(255, 59, 48, 0.3);
}

.leitner-btn-wrong:hover {
    background: #ff4d42;
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.4);
    transform: translateY(-1px);
}

.leitner-btn-correct {
    background: #34c759;
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(52, 199, 89, 0.3);
}

.leitner-btn-correct:hover {
    background: #3dd662;
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.4);
    transform: translateY(-1px);
}

.leitner-btn:active {
    transform: scale(0.98);
}

.leitner-hint {
    text-align: center;
    color: #86868b;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.leitner-complete-message {
    background: #ffffff;
    border-radius: 24px;
    padding: 60px 40px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}

.leitner-complete-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.leitner-complete-title {
    font-size: 32px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.leitner-complete-text {
    font-size: 17px;
    font-weight: 500;
    color: #86868b;
    margin-bottom: 32px;
    letter-spacing: -0.01em;
}

@media (max-width: 768px) {
    .leitner-top {
        padding: 0;
        margin-bottom: 20px;
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .leitner-action-buttons {
        width: 100%;
        justify-content: flex-start;
    }

    .leitner-boxes-grid {
        margin-top: 20px;
        margin-bottom: 30px;
    }

    .leitner-box-card {
        height: auto;
        min-height: 250px;
        padding: 24px 20px;
    }
}

@media (max-width: 600px) {
    .leitner-title {
        font-size: 32px;
    }

    .leitner-boxes-grid {
        grid-template-columns: 1fr;
    }

    .leitner-card {
        height: 60vh;
        max-height: 500px;
    }

    .leitner-card-face {
        padding: 30px 20px;
    }

    .leitner-card-content {
        font-size: 24px;
    }

    .leitner-card-back .leitner-card-content {
        font-size: 18px;
    }

    .leitner-complete-message {
        padding: 40px 20px;
    }
}

.quiz-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 20px 20px 0;
    margin-bottom: 20px;
}

.quiz-header {
    flex: 1;
}

.quiz-header h2 {
    white-space: nowrap;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.quiz-action-buttons {
    display: flex;
    gap: 10px;
}

.quiz-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1d1d1f;
}

.quiz-action-btn:hover {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.quiz-action-btn:active {
    transform: scale(0.95);
}

.quiz-action-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.quiz-action-btn img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 50%;
}

.quiz-container {
    width: 100%;
    margin: 0 auto;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.quiz-progress-bar {
    background: #e8e8ed;
    height: 6px;
    border-radius: 980px;
    margin-bottom: 40px;
    overflow: hidden;
}

.quiz-progress-fill {
    background: #0071e3;
    height: 100%;
    border-radius: 980px;
    transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-progress-text {
    text-align: center;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 600;
    color: #86868b;
    letter-spacing: -0.01em;
}

.quiz-quiz-card {
    background: var(--input-bg, #ffffff);
    border-radius: 28px;
    padding: 45px 40px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
    transition: box-shadow 0.3s ease;
}

.quiz-card {
    background: var(--input-bg, #ffffff);
    border-radius: 28px;
    padding: 30px 24px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
    margin-bottom: 32px;
    transition: box-shadow 0.3s ease;
}

.quiz-card-modern {
    padding: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.quiz-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 60px rgba(0, 0, 0, 0.12);
}

.quiz-card-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.quiz-card-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.quiz-card-modern:hover .quiz-card-actions {
    opacity: 1;
}

.quiz-action-btn-delete:hover {
    background: #ff3b30 !important;
    color: white !important;
}

.quiz-action-btn-delete:hover svg {
    stroke: white;
}

.quiz-card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #1d1d1f);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.quiz-card-topic {
    font-size: 14px;
    color: #86868b;
    line-height: 1.4;
}

.quiz-card-body {
    padding: 20px 24px;
}

.quiz-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.quiz-card-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--input-main-bg, #f5f5f7);
    border-radius: 12px;
    transition: background 0.2s ease;
}

.quiz-card-modern:hover .quiz-card-stat {
    background: var(--nav-active-bg, #e8e8ed);
}

.quiz-card-stat-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quiz-card-stat-content {
    flex: 1;
    min-width: 0;
}

.quiz-card-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #1d1d1f);
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}

.quiz-card-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quiz-card-footer {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quiz-card-difficulty {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quiz-card-last-attempt {
    font-size: 12px;
    color: #86868b;
    font-weight: 500;
}

#welcomeView {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.quiz-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 40px;
    color: #86868b;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.quiz-welcome-card {
    text-align: center;
}

.quiz-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: inline-block;
}

.quiz-welcome-title {
    font-size: 28px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.quiz-welcome-subtitle {
    font-size: 15px;
    color: #86868b;
    margin-bottom: 24px;
    line-height: 1.5;
}

.quiz-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.quiz-stat-item {
    background: #f5f5f7;
    border-radius: 16px;
    padding: 20px 16px;
    text-align: center;
}

.quiz-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #0071e3;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.quiz-stat-label {
    font-size: 13px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.quiz-question-number {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 24px;
    color: #0071e3;
}

.quiz-question-text {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 48px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option {
    background: #f5f5f7;
    border: 2px solid #f5f5f7;
    border-radius: 16px;
    padding: 20px 24px;
    font-size: 17px;
    font-weight: 500;
    color: #1d1d1f;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.quiz-option:hover:not(.quiz-selected) {
    background: #e8e8ed;
    border-color: #e8e8ed;
    transform: translateX(4px);
}

.quiz-option.quiz-selected {
    background: #ffffff;
    border-color: #0071e3;
}

.quiz-option:active {
    transform: scale(0.98);
}

.quiz-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.quiz-btn {
    padding: 14px 36px;
    font-size: 15px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border: none;
    border-radius: 980px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.01em;
}

.quiz-btn-primary {
    background: #0071e3;
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 113, 227, 0.3);
}

.quiz-btn-primary:hover:not(:disabled) {
    background: #0077ed;
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.4);
    transform: translateY(-1px);
}

.quiz-btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.quiz-btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.quiz-btn-secondary {
    background: #ffffff;
    color: #1d1d1f;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.quiz-btn-secondary:hover {
    background: #f5f5f7;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.quiz-btn-secondary:active {
    transform: scale(0.98);
}

.quiz-results-card {
    text-align: center;
}

.quiz-results-score {
    font-size: 72px;
    font-weight: 700;
    color: #0071e3;
    margin-bottom: 16px;
    letter-spacing: -0.03em;
}

.quiz-results-label {
    font-size: 24px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.quiz-results-message {
    font-size: 17px;
    font-weight: 500;
    color: #86868b;
    margin-bottom: 48px;
    line-height: 1.5;
}

.quiz-review-section {
    margin-top: 48px;
}

.quiz-review-title {
    font-size: 24px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 32px;
    letter-spacing: -0.02em;
    text-align: center;
}

.quiz-review-item {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px 40px;
    margin-bottom: 20px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

.quiz-review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.quiz-review-status {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.quiz-review-status.quiz-correct {
    background: #34c759;
    color: #ffffff;
}

.quiz-review-status.quiz-incorrect {
    background: #ff3b30;
    color: #ffffff;
}

.quiz-review-question-num {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #86868b;
}

.quiz-review-question-text {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.quiz-review-answer {
    font-size: 16px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.quiz-review-answer.quiz-your-answer {
    background: #ffe5e5;
    color: #d70015;
}

.quiz-review-answer.quiz-correct-answer {
    background: #d1f4e0;
    color: #1d6f42;
}

.quiz-review-answer.quiz-both-correct {
    background: #d1f4e0;
    color: #1d6f42;
}

.quiz-review-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    opacity: 0.6;
}

/* Quiz Pill in Chat */
.quiz-pill-message {
    margin: 16px 0;
    padding: 0;
}

.quiz-pill-content {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 16px 20px;
    transition: all 0.2s ease;
}

.quiz-pill-content:hover {
    background: var(--nav-active-bg);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quiz-pill-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 12px;
    color: white;
}

.quiz-pill-text {
    flex: 1;
    min-width: 0;
}

.quiz-pill-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.quiz-pill-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.quiz-pill-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.quiz-pill-button:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(74, 116, 232, 0.3);
}

.quiz-pill-button:active {
    transform: scale(0.98);
}

.quiz-pill-button svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

@media (max-width: 768px) {
    .quiz-top {
        padding: 10px 0;
        margin-bottom: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .quiz-container {
        padding: 10px 0;
    }

    .quiz-quiz-card,
    .quiz-card {
        padding: 24px 20px;
        border-radius: 20px;
    }

    .quiz-card-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .quiz-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .quiz-card-actions {
        opacity: 1;
        align-self: flex-end;
        margin-top: -40px;
    }
}

@media (max-width: 600px) {
    .quiz-quiz-card {
        padding: 40px 30px;
    }

    .quiz-card {
        padding: 40px 30px;
    }

    .quiz-welcome-title {
        font-size: 28px;
    }

    .quiz-stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .quiz-question-text {
        font-size: 26px;
    }

    .quiz-option {
        padding: 18px 20px;
        font-size: 16px;
    }

    .quiz-results-score {
        font-size: 56px;
    }

    .quiz-review-item {
        padding: 24px 24px;
    }

    .quiz-pill-content {
        padding: 12px 16px;
        gap: 12px;
    }

    .quiz-pill-icon {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .quiz-pill-title {
        font-size: 15px;
    }

    .quiz-pill-subtitle {
        font-size: 12px;
    }

    .quiz-pill-button {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Cornell Notes List View Container */
.cornell-container {
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* When editor is open, use editor styles */
.cornell-container:has(.cornell-title-section) {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    position: relative;
    font-family: 'Georgia', 'Times New Roman', serif;
    box-sizing: border-box;
}

.cornell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.cornell-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cornell-btn-primary {
    background-color: var(--accent);
    color: white;
}

.cornell-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.cornell-btn-secondary {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.cornell-btn-secondary:hover {
    background-color: var(--nav-active-bg);
}

.cornell-notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.cornell-note-card {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.cornell-note-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.cornell-note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.cornell-note-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.cornell-note-actions {
    display: flex;
    gap: 8px;
}

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

.cornell-note-action-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.cornell-note-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.cornell-note-preview {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.cornell-note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.cornell-title-section {
    border-bottom: 3px solid #333;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.cornell-title-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.8rem;
    font-weight: bold;
    padding: 0.5rem 0;
    text-align: center;
    font-family: inherit;
    background: transparent;
}

.cornell-date-info {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.cornell-date-info input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    color: #666;
}

/* Main content area - contains keynotes and notes columns */
.cornell-content-wrapper {
    display: flex;
    gap: 0;
    min-height: 400px;
    max-height: 500px;
    border-bottom: 3px solid #333;
    margin-bottom: 1.5rem;
    position: relative;
    overflow-y: auto;
}

/* 
KEY ALIGNMENT TECHNIQUE:
- background-size: 100% 1.5rem creates lines spaced 1.5rem apart
- line-height: 1.5rem makes text height match line spacing exactly
- padding-top: 0.25rem offsets text to sit ON the lines (not between)
- This ensures text aligns with lines regardless of screen resolution
*/

/* Keynotes column (left side, 25% width) */
.cornell-keynotes {
    width: 25%;
    padding: 0.25rem 1rem 1rem 0.5rem;
    border-right: 2px solid #999;
    background:
        linear-gradient(transparent 1.4rem, #e3f2fd 1.4rem, #e3f2fd 1.5rem, transparent 1.5rem);
    background-size: 100% 1.5rem;
    line-height: 1.5rem;
    font-size: 0.95rem;
    color: #333;
    outline: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
}

/* Notes column (right side, 75% width) */
.cornell-notes {
    width: 75%;
    padding: 0.25rem 0.5rem 1rem 1rem;
    background:
        linear-gradient(transparent 1.4rem, #ddd 1.4rem, #ddd 1.5rem, transparent 1.5rem);
    background-size: 100% 1.5rem;
    line-height: 1.5rem;
    font-size: 1rem;
    color: #000;
    outline: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
}

/* Summary section at bottom */
.cornell-summary-section {
    margin-top: 1.5rem;
}

.cornell-summary-label {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.cornell-summary {
    width: 100%;
    min-height: 120px;
    padding: 0.25rem 0.5rem 1rem;
    background:
        linear-gradient(transparent 1.4rem, #fff9c4 1.4rem, #fff9c4 1.5rem, transparent 1.5rem);
    background-size: 100% 1.5rem;
    line-height: 1.5rem;
    font-size: 1rem;
    color: #000;
    outline: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Placeholder text styling */
[contenteditable]:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

/* Print styles - ensures clean printing on A4 paper */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .cornell-container {
        max-width: 100%;
        box-shadow: none;
        padding: 1rem;
        page-break-after: avoid;
    }

    /* Maintain line alignment in print */
    .cornell-keynotes,
    .cornell-notes,
    .cornell-summary {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .cornell-container {
        padding: 1.5rem;
    }

    .cornell-title-input {
        font-size: 1.5rem;
    }

    /* 
    Maintain line alignment on mobile:
    - Same background-size and line-height ensure consistency
    - Text remains aligned even when columns stack
    */
    .cornell-content-wrapper {
        flex-direction: column;
    }

    .cornell-keynotes,
    .cornell-notes {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #999;
    }

    .cornell-notes {
        border-bottom: none;
    }
}

/* Focus styling for better UX */
[contenteditable]:focus {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Cornell Action Button in Tool Header */
.cornell-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 500;
    gap: 6px;
}

.cornell-action-btn:hover {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.cornell-action-btn:active {
    transform: scale(0.95);
}

.cornell-action-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
}

.cornell-action-btn span {
    white-space: nowrap;
}

/* Cornell Modal Styles */
.cornell-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.cornell-modal {
    background-color: var(--main-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.cornell-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.cornell-modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.cornell-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.cornell-modal-close:hover {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.cornell-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.cornell-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

/* Curriculum Selection UI */
.cornell-curriculum-toggle {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    background: var(--input-bg);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.cornell-toggle-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.cornell-toggle-option input {
    margin: 0;
}

.cornell-toggle-option:hover {
    color: var(--text-primary);
}

.cornell-curriculum-selectors {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(var(--accent-rgb), 0.05);
    border-radius: 10px;
    border: 1px dashed var(--accent);
}

.cornell-selector-group {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cornell-selector-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cornell-select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--main-bg);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.cornell-select:focus {
    border-color: var(--accent);
}

.cornell-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Kanban Board Styles */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    height: 100%;
    min-height: 500px;
    padding: 10px;
    overflow-x: auto;
    /* Allow horizontal scrolling if columns don't fit */
}

.kanban-column {
    background: var(--nav-active-bg);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    min-width: 250px;
}

.kanban-column.drag-over {
    background: rgba(var(--accent-rgb, 59, 130, 246), 0.1);
    border-color: var(--accent);
    transform: scale(1.02);
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.kanban-column-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.kanban-task-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--input-bg);
    padding: 2px 8px;
    border-radius: 10px;
}

.kanban-task-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.kanban-task-card {
    background: #252525;
    /* Slightly lighter than column background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    border-left: 4px solid var(--accent);
    /* Default accent color */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Specific colors per column */
.kanban-column[data-status="todo"] .kanban-task-card {
    border-left-color: #ffcc00;
    /* To Do - Yellow */
    background: rgba(255, 204, 0, 0.08);
}

.kanban-column[data-status="doing"] .kanban-task-card {
    border-left-color: #3b82f6;
    /* Doing - Blue */
    background: rgba(59, 130, 246, 0.08);
}

.kanban-column[data-status="done"] .kanban-task-card {
    border-left-color: #10b981;
    /* Done - Green */
    background: rgba(16, 185, 129, 0.08);
}

.kanban-task-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.kanban-task-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.kanban-task-card-title {
    font-size: 14px;
    color: #ffffff;
    margin-top: 4px;
    padding-right: 45px;
    /* Leave space for buttons */
    word-break: break-word;
}

.kanban-task-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.kanban-task-card:hover .kanban-task-card-actions {
    opacity: 1;
}

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

.kanban-task-action-btn:hover {
    background: var(--nav-active-bg);
    color: #ef4444;
}

.kanban-add-task {
    margin-top: auto;
}

.kanban-add-input {
    width: 100%;
    background: var(--bg-hover);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.kanban-add-input:focus {
    background: var(--input-bg);
    border-color: var(--accent);
}

.kanban-task-edit-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 14px;
    padding: 0;
    margin-top: 4px;
    padding-right: 45px;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: inherit;
    min-height: auto;
    overflow: hidden;
}

@media (max-width: 768px) {
    .kanban-board {
        grid-template-columns: 1fr;
        overflow-x: auto;
    }
}

/* Eisenhower Matrix Styles */
.eisenhower-matrix {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    height: 100%;
    min-height: 600px;
    padding: 10px;
}

.eisenhower-quadrant {
    background: var(--nav-active-bg);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    min-height: 250px;
    position: relative;
    overflow: hidden;
}

.eisenhower-quadrant.drag-over {
    background: rgba(var(--accent-rgb, 59, 130, 246), 0.1);
    border-color: var(--accent);
    transform: scale(1.01);
}

.eisenhower-quadrant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.eisenhower-quadrant-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.eisenhower-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.eisenhower-quadrant-header h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin: 0;
}

.eisenhower-task-count {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--input-bg);
    padding: 2px 8px;
    border-radius: 10px;
}

.eisenhower-task-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 50px;
    overflow-y: auto;
}

.eisenhower-task-card {
    background: #252525;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.eisenhower-task-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.eisenhower-task-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.eisenhower-task-card-title {
    margin-top: 4px;
    padding-right: 45px;
    word-break: break-word;
}

.eisenhower-task-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.eisenhower-task-card:hover .eisenhower-task-card-actions {
    opacity: 1;
}

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

.eisenhower-task-action-btn:hover {
    background: var(--nav-active-bg);
}

.eisenhower-task-action-btn.delete-task:hover {
    color: #ef4444;
}

.eisenhower-add-task {
    margin-top: auto;
}

.eisenhower-add-input {
    width: 100%;
    background: var(--bg-hover);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.eisenhower-add-input:focus {
    background: var(--input-bg);
    border-color: var(--accent);
}

.eisenhower-task-edit-input {
    width: 100%;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 14px;
    padding: 0;
    margin-top: 4px;
    padding-right: 45px;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: inherit;
    min-height: auto;
    overflow: hidden;
}

/* Quadrant Specifics */
.eisenhower-quadrant[data-status="do"] {
    border-top: 4px solid #ff3b30;
}

.eisenhower-quadrant[data-status="schedule"] {
    border-top: 4px solid #0071e3;
}

.eisenhower-quadrant[data-status="delegate"] {
    border-top: 4px solid #ff9500;
}

.eisenhower-quadrant[data-status="eliminate"] {
    border-top: 4px solid #8e8e93;
}

.eisenhower-quadrant[data-status="do"] .eisenhower-task-card {
    background: rgba(255, 59, 48, 0.08);
    border-left: 4px solid #ff3b30;
}

.eisenhower-quadrant[data-status="schedule"] .eisenhower-task-card {
    background: rgba(0, 113, 227, 0.08);
    border-left: 4px solid #0071e3;
}

.eisenhower-quadrant[data-status="delegate"] .eisenhower-task-card {
    background: rgba(255, 149, 0, 0.08);
    border-left: 4px solid #ff9500;
}

.eisenhower-quadrant[data-status="eliminate"] .eisenhower-task-card {
    background: rgba(142, 142, 147, 0.08);
    border-left: 4px solid #8e8e93;
}

@media (max-width: 850px) {
    .eisenhower-matrix {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
}

/* Mind Map Styles */
.mindmap-container {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

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

.mindmap-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.mindmap-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.mindmap-btn-primary {
    background: var(--accent);
    color: white;
}

.mindmap-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.mindmap-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.mindmap-card {
    background: var(--nav-active-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.mindmap-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    background: var(--bg-hover);
}

.mindmap-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.mindmap-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.mindmap-card-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mindmap-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: auto;
}

.mindmap-card-date {
    font-size: 11px;
    color: var(--text-faded);
}

.mindmap-card-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mindmap-card:hover .mindmap-card-actions {
    opacity: 1;
}

.mindmap-action-btn {
    background: none;
    border: none;
    color: var(--text-faded);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mindmap-action-btn:hover {
    background: var(--bg-faded);
    color: var(--text-secondary);
}

.mindmap-empty-state {
    text-align: center;
    padding: 80px 20px;
    max-width: 400px;
    margin: 0 auto;
}

.mindmap-empty-icon {
    font-size: 48px;
    color: var(--text-faded);
    margin-bottom: 24px;
}

.mindmap-empty-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.mindmap-empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

/* Header Action Button Styles */
.tool-custom-action-btn.mindmap-header-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.tool-custom-action-btn.mindmap-header-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
    background: var(--accent-hover, var(--accent));
}

.tool-custom-action-btn.mindmap-header-btn svg {
    width: 14px;
    height: 14px;
}

.tool-custom-action-btn.mindmap-back-btn {
    background: var(--nav-active-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.tool-custom-action-btn.mindmap-back-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.tool-custom-action-btn.mindmap-back-btn svg {
    width: 14px;
    height: 14px;
}

/* Modal Styles */
.mindmap-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.mindmap-modal {
    background: var(--nav-active-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: modalAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalAppear {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.mindmap-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mindmap-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.mindmap-modal-close {
    background: none;
    border: none;
    color: var(--text-faded);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mindmap-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mindmap-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.mindmap-step-container {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.mindmap-step {
    flex: 1;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-faded);
    padding: 8px;
    border-radius: 8px;
    background: var(--bg-faded);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mindmap-step.active {
    background: var(--accent);
    color: white;
}

.mindmap-step.completed {
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--accent);
}

.mindmap-step-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.mindmap-selection-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mindmap-selection-item {
    background: var(--main-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.mindmap-selection-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.mindmap-selection-item.selected {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.1);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.mindmap-selection-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.mindmap-selection-meta {
    font-size: 12px;
    color: var(--text-faded);
}

.mindmap-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.mindmap-loading,
.mindmap-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.mindmap-generating {
    text-align: center;
    padding: 60px 20px;
}

.mindmap-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

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

/* Visualization Styles - High Fidelity SVG */
.mindmap-viz-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.mindmap-viz-header {
    padding: 32px 32px 0;
    z-index: 10;
    pointer-events: none;
}

.mindmap-viz-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #ffffff;
}

.mindmap-viz-desc {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.mindmap-viewport {
    flex: 1;
    cursor: grab;
    background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 40px 40px;
    touch-action: none;
    /* Prevent browser scrolling */
}

.mindmap-viewport:active {
    cursor: grabbing;
}

#mindmapCanvas {
    width: 100%;
    height: 100%;
}

/* SVG Node Styles */
.mindmap-node-rect {
    fill: var(--bg-hover);
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1px;
    filter: url(#nodeShadow);
    transition: all 0.2s ease;
}

.mindmap-node-group:hover .mindmap-node-rect {
    stroke: var(--accent);
    fill: var(--nav-active-bg);
    transform: translateY(-1px);
}

.mindmap-node-group.depth-0 .mindmap-node-rect {
    fill: var(--nav-active-bg);
    stroke: var(--accent);
    stroke-width: 2px;
    width: 240px;
}

.mindmap-node-text {
    fill: #ffffff;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    user-select: none;
}

.mindmap-node-group.depth-0 .mindmap-node-text {
    font-size: 16px;
    font-weight: 700;
}

/* Connections */
.mindmap-link {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1.5px;
    transition: stroke 0.3s ease;
}

.mindmap-node-group:hover+.mindmap-link,
.mindmap-link:hover {
    stroke: var(--accent);
    stroke-width: 2px;
}

/* Toggle Switch */
.mindmap-node-toggle circle {
    fill: rgba(255, 255, 255, 0.1);
    stroke: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.mindmap-node-group:hover .mindmap-node-toggle circle {
    fill: var(--accent);
    stroke: var(--accent);
}

.mindmap-toggle-icon {
    fill: #ffffff;
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
}

/* Controls Overlay */
.mindmap-controls {
    position: absolute;
    bottom: 32px;
    right: 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.mindmap-control-btn {
    width: 44px;
    height: 44px;
    background: rgba(43, 45, 49, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mindmap-control-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.3);
}

.mindmap-control-btn svg {
    width: 20px;
    height: 20px;
}

.past-papers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.past-paper-card {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color, rgba(99, 102, 241, 0.15));
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.past-paper-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
}

.past-paper-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.past-paper-year {
    font-size: 13px;
    color: var(--text-secondary);
}

.past-paper-thumbnail {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(15, 23, 42, 0.08));
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--accent, #6366f1) 18%, transparent),
            color-mix(in srgb, var(--accent-hover, #8b5cf6) 18%, transparent));
    position: relative;
}

.past-paper-thumbnail iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    filter: grayscale(0.1) contrast(0.9);
    background: #fff;
}

.past-paper-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-secondary);
    background: repeating-linear-gradient(45deg,
            color-mix(in srgb, var(--accent, #6366f1) 14%, transparent),
            color-mix(in srgb, var(--accent, #6366f1) 14%, transparent) 10px,
            color-mix(in srgb, var(--accent-hover, #8b5cf6) 14%, transparent) 10px,
            color-mix(in srgb, var(--accent-hover, #8b5cf6) 14%, transparent) 20px);
}

.past-paper-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.past-paper-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

.past-paper-pill.type {
    background: var(--accent);
}

.past-paper-pill.source {
    background: var(--nav-active-bg, rgba(15, 23, 42, 0.65));
    color: var(--text-primary);
}

.past-paper-actions {
    display: flex;
    justify-content: flex-end;
}

.past-paper-open-btn {
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.past-paper-open-btn svg {
    width: 16px;
    height: 16px;
}

.past-paper-open-btn:hover {
    transform: translateY(-1px);
}

.past-papers-empty {
    padding: 80px 20px;
    text-align: center;
    border-radius: 16px;
}

.past-papers-empty h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.past-papers-empty p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.past-paper-viewer {
    flex: 1;
    border: none;
    border-radius: 14px;
    margin-top: 12px;
    min-height: 480px;
    width: 100%;
    box-shadow: 0 24px 45px rgba(15, 23, 42, 0.12);
    background: #fff;
}

@media (max-width: 768px) {

    .past-papers-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .past-paper-viewer {
        min-height: 360px;
    }
}

/**
 * Study Mode View CSS
 * Split-screen layout: Study plan in the middle, chat on the right
 * Matches test-mode-past-paper.css design language
 */

/* CSS Variables for Study Mode */
.study-mode-view {
    --sm-bg: #020408;
    --sm-surface: rgba(255, 255, 255, 0.03);
    --sm-border: rgba(255, 255, 255, 0.08);
    --sm-accent: #f4c542;
    --sm-accent-glow: rgba(244, 197, 66, 0.4);
    --sm-text: #f8fafc;
    --sm-text-dim: #64748b;
    --sm-glass: blur(12px);

    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--main-bg);
    color: var(--sm-text);
    z-index: 50;
    display: grid;
    grid-template-columns: 1fr 420px;
}

.study-mode-view.active:not(.study-animated) {
    display: grid;
}

.study-mode-view.active.study-animated {
    display: grid;
    animation: none;
}

/* Fade-in animation for consistency with other modes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ambient Orbs */
.sm-orb {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(150px);
    pointer-events: none;
    z-index: 0;
}

/* Back Button */
.sm-back-btn {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 2000;
    background: var(--sm-surface);
    border: 1px solid var(--sm-border);
    padding: 10px 18px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sm-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-2px);
}

/* Study Plan Zone (Middle) */
.sm-plan-zone {
    padding: 80px 40px 40px;
    overflow-y: auto;
    scroll-behavior: smooth;
    background: radial-gradient(circle at top left, rgba(244, 197, 66, 0.02), transparent);
    position: relative;
    height: 100%;
    z-index: 1;
}

.sm-plan-sheet {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    min-height: 500px;
}

.sm-plan-header {
    margin-bottom: 32px;
}

.sm-plan-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--sm-text);
    margin: 0 0 8px 0;
}

.sm-plan-header p {
    font-size: 15px;
    color: var(--sm-text-dim);
    margin: 0;
}

/* Study Plan Content */
.sm-plan-content {
    background: var(--sm-surface);
    border: 1px solid var(--sm-border);
    border-radius: 20px;
    padding: 32px;
    backdrop-filter: var(--sm-glass);
    min-height: 300px;
}

/* Loading State */
.sm-plan-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    gap: 16px;
    color: var(--sm-text-dim);
}

.sm-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--sm-border);
    border-top-color: var(--sm-accent);
    border-radius: 50%;
    animation: sm-spin 1s linear infinite;
}

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

/* Markdown Content */
.sm-plan-markdown {
    color: var(--sm-text);
    line-height: 1.7;
}

.sm-plan-markdown h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 24px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sm-border);
    color: var(--sm-accent);
}

.sm-plan-markdown h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 16px 0 8px 0;
    color: var(--sm-text);
}

.sm-plan-markdown p {
    margin: 12px 0;
    color: var(--sm-text-dim);
}

.sm-plan-markdown ul,
.sm-plan-markdown ol {
    padding-left: 24px;
    margin: 12px 0;
}

.sm-plan-markdown li {
    margin-bottom: 8px;
    color: var(--sm-text-dim);
}

.sm-plan-markdown strong {
    color: var(--sm-accent);
    font-weight: 600;
}

.sm-plan-markdown code {
    background: rgba(244, 197, 66, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--sm-accent);
}

/* Action Buttons */
.sm-plan-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
}

.sm-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--sm-border);
}

.sm-action-btn.primary {
    background: var(--sm-accent);
    color: #1a1a1a;
    border-color: var(--sm-accent);
}

.sm-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--sm-accent-glow);
}

/* AI Chat Sidebar (Right) */
.sm-ai-sidebar {
    background: rgba(2, 4, 8, 0.8);
    backdrop-filter: blur(40px);
    border-left: 1px solid var(--sm-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sm-ai-nav {
    padding: 25px;
    border-bottom: 1px solid var(--sm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sm-chat-stream {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sm-bubble {
    padding: 16px;
    border-radius: 20px;
    font-size: 14px;
    max-width: 85%;
    line-height: 1.6;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.sm-ai-bubble {
    background: var(--sm-surface);
    border: 1px solid var(--sm-border);
    border-bottom-left-radius: 4px;
}

.sm-ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sm-bubble-content {
    flex: 1;
}

.sm-user-bubble {
    background: var(--sm-accent);
    color: #1a1a1a;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Chat Input */
.sm-input-box {
    padding: 25px;
    background: rgba(0, 0, 0, 0.2);
}

.sm-input-inner {
    background: var(--sm-surface);
    border: 1px solid var(--sm-border);
    padding: 12px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sm-input-inner input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    outline: none;
    font-size: 14px;
}

.sm-input-inner input::placeholder {
    color: var(--sm-text-dim);
}

.sm-send-btn {
    background: var(--sm-accent);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1a1a1a;
}

.sm-send-btn:hover {
    transform: scale(1.1);
}

/* Global Study Mode Active State */
body.study-mode-active .main-header {
    display: none !important;
}

body.study-mode-active .main-content {
    height: 100vh;
    padding-top: 0 !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .study-mode-view {
        grid-template-columns: 1fr;
    }

    .sm-ai-sidebar {
        display: none;
    }

    .sm-plan-zone {
        padding: 80px 20px 40px;
    }

    .sm-back-btn {
        top: 20px;
        left: 20px;
    }
}

/* Test Mode Past Paper View Styles */
.test-mode-past-paper-view {
    --tm-bg: #020408;
    --tm-surface: rgba(255, 255, 255, 0.03);
    --tm-border: rgba(255, 255, 255, 0.08);
    --tm-accent: #3b82f6;
    --tm-accent-glow: rgba(59, 130, 246, 0.4);
    --tm-warning: #f59e0b;
    --tm-text: #f8fafc;
    --tm-text-dim: #64748b;
    --tm-glass: blur(12px);

    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--main-bg);
    color: var(--tm-text);
    z-index: 50;
    /* Standard content level, below sidebar overlay if any */
    display: none;
    /* Hidden by default */
    grid-template-columns: 1fr 420px;
}

.test-mode-past-paper-view.active {
    display: grid;
}

/* Paper Area (Middle) */
.tm-paper-zone {
    padding: 10px;
    overflow-y: scroll;
    scroll-behavior: smooth;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.02), transparent);
    position: relative;
    height: 100%;
}

/* Bento Stats Header */
.tm-bento-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 15px;
    max-width: 900px;
    margin: 0 auto 30px auto;
}

.tm-bento-item {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: var(--tm-glass);
}

.tm-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--tm-text-dim);
    font-weight: 700;
    letter-spacing: 1px;
}

.tm-stat-val {
    font-size: 1.2rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: block;
    margin-top: 5px;
}

.tm-progress-mini {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.tm-progress-bar {
    height: 100%;
    background: var(--tm-accent);
    box-shadow: 0 0 10px var(--tm-accent);
}

/* Paper Sheet / List Container */
.tm-paper-sheet {
    width: 100%;
    max-width: none;
    /* Allow full width as requested */
    min-height: 500px;
}

/* AI Sidebar (Right) */
.tm-ai-sidebar {
    background: rgba(2, 4, 8, 0.8);
    backdrop-filter: blur(40px);
    border-left: 1px solid var(--tm-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.tm-ai-nav {
    padding: 25px;
    border-bottom: 1px solid var(--tm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tm-chat-stream {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tm-bubble {
    padding: 16px;
    border-radius: 20px;
    font-size: 14px;
    max-width: 85%;
    line-height: 1.6;
}

.tm-ai-bubble {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-bottom-left-radius: 4px;
}

.tm-user-bubble {
    background: var(--tm-accent);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.tm-input-box {
    padding: 25px;
    background: rgba(0, 0, 0, 0.2);
}

.tm-input-inner {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    padding: 12px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
}

.tm-input-inner input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    outline: none;
    margin-left: 10px;
}

/* Floating Formula Dock */
.tm-formula-dock {
    position: fixed;
    bottom: 30px;
    left: calc(50% - 210px);
    transform: translateX(-50%);
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    padding: 12px 30px;
    border-radius: 100px;
    border: 1px solid var(--tm-border);
    display: flex;
    gap: 25px;
    align-items: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.tm-formula-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--tm-accent);
    font-weight: 500;
}

/* Navigation Back Button override for this view */
.tm-back-btn {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 2000;
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    padding: 10px 18px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    gap: 8px;
    align-items: center;
}

.tm-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Past Paper Grid overrides for this view */
.test-mode-past-paper-view .past-papers-container {
    background: transparent !important;
    padding: 0 !important;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Full Height Fixes */
.tm-paper-sheet {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.test-mode-past-paper-view .past-paper-viewer {
    height: 100% !important;
    min-height: 0 !important;
    flex: 1;
}

/* Global Test Mode Active State, but only if no specific conversation is loaded */
body.test-mode-active:not(:has(.main-content.has-chat)) .main-header {
    display: none !important;
}

/* Also hide header on initial page load for testmode URL, but not if there's a conversation */
body[data-special-mode="testmode"][data-has-conversation="false"] .main-header {
    display: none !important;
}

body.test-mode-active .main-content {
    height: 100vh;
    padding-top: 0 !important;
    /* Remove header offset */
}

/* Ensure container takes full height */
body.test-mode-active .tm-paper-zone {
    height: 100vh;
    padding-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .test-mode-past-paper-view {
        grid-template-columns: 1fr;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tm-ai-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 0;
        max-height: 60vh;
        border-radius: 20px 20px 0 0;
        border-left: none;
        border-top: 1px solid var(--tm-border);
        z-index: 1000;
        transition: height 0.3s ease;
    }

    .tm-ai-sidebar.open {
        height: 60vh;
    }

    .tm-paper-zone {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    .tm-bento-header {
        grid-template-columns: 1fr;
    }

    .tm-formula-dock {
        width: 90%;
        left: 50%;
        transform: translateX(-50%);
        justify-content: center;
        padding: 10px 15px;
        gap: 15px;
    }
}

/* Ensure dynamic viewer container supports scrolling */
.pdf-viewer-container {
    overflow-y: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
}

.pdf-page-wrapper,
.pdf-page-wrapper canvas {
    touch-action: pan-y !important;
}

/* Floating Page Indicator */
.pp-page-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 100px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    pointer-events: none;
    /* Let touches pass through to content */
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.3s;
}

/* Learning Profile Styles */
.learning-profile-container {
    display: none;
    /* Initial state, will be toggled by JS */
}

/**
 * Mastery Tracker Styles
 * Styles for the Mystery Process mastery tracking UI
 */

.mastery-tracker-graph {
    display: flex;
    flex-direction: column;
}

.mastery-tracker-container {
    padding: 20px;
    background: var(--tool-bg, var(--main-bg));
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.mastery-progress-section {
    margin-bottom: 24px;
}

.mastery-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.mastery-progress-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.mastery-progress-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent, #6366f1);
}

.mastery-progress-bar-container {
    width: 100%;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.mastery-progress-bar {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 12px;
}

.mastery-components {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.mastery-component {
    padding: 16px;
    background: var(--main-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.mastery-component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mastery-component-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.mastery-component-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.mastery-component-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.mastery-component-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent, #6366f1), var(--accent-hover, #8b5cf6));
    transition: width 0.3s ease;
}

.mastery-component-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.mastery-practice-graph {
    margin-bottom: 24px;
}

.mastery-graph-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.mastery-graph-container {
    padding: 16px;
    background: var(--main-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.mastery-practice-svg {
    width: 100%;
    height: auto;
    max-height: 250px;
}

.mastery-graph-point {
    cursor: pointer;
    transition: r 0.2s ease;
}

.mastery-graph-point:hover {
    r: 6;
}

.mastery-no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    margin: 0;
}

.mastery-mystery-card {
    margin-top: 24px;
    padding: 16px;
    background: var(--main-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.mastery-mystery-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.mastery-mystery-toggle:hover {
    background: var(--tool-bg, var(--main-bg));
    border-radius: 6px;
}

.mastery-mystery-toggle.active {
    background: var(--tool-bg, var(--main-bg));
}

.mastery-mystery-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent, #6366f1);
    color: white;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
}

.mastery-mystery-label {
    flex: 1;
    text-align: left;
}

.mastery-mystery-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.mastery-mystery-content p {
    margin: 0 0 12px 0;
}

.mastery-mystery-content p:last-child {
    margin-bottom: 0;
}

.mastery-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .mastery-tracker-container {
        padding: 16px;
    }

    .mastery-progress-value {
        font-size: 20px;
    }

    .mastery-component {
        padding: 12px;
    }

    .mastery-graph-container {
        padding: 12px;
    }
}

/**
 * Quiz Performance Over Time Styles
 */

.quiz-performance-section {
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.quiz-performance-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
}

.quiz-performance-chart {
    margin: 20px 0;
    width: 100%;
    max-width: 600px;
}

.quiz-performance-svg {
    width: 100%;
    height: auto;
    display: block;
}

.quiz-performance-point {
    cursor: pointer;
    transition: r 0.2s ease;
}

.quiz-performance-point:hover {
    r: 6;
}

.quiz-performance-smoothed-line {
    stroke-dasharray: none;
}

.quiz-performance-smoothed-point {
    pointer-events: none;
}

.quiz-performance-insight {
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-secondary, #f5f7fa);
    border-radius: 8px;
    border-left: 4px solid var(--accent, #3b82f6);
}

.quiz-performance-insight p {
    margin: 0;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.6;
    font-size: 14px;
}

.quiz-performance-explanation {
    margin-top: 20px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding-top: 16px;
}

.quiz-performance-explanation-toggle {
    background: none;
    border: none;
    padding: 8px 0;
    cursor: pointer;
    color: var(--accent, #3b82f6);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s ease;
    width: 100%;
    text-align: left;
}

.quiz-performance-explanation-toggle:hover {
    color: var(--accent-hover, #2563eb);
}

.quiz-performance-explanation-toggle i {
    font-size: 14px;
}

.explanation-chevron {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.quiz-performance-explanation-content {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-secondary, #f5f7fa);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary, #6b7280);
}

.quiz-performance-explanation-content h3 {
    font-size: 16px;
    margin: 0 0 12px 0;
    color: var(--text-primary, #1a1a1a);
}

.quiz-performance-explanation-content p {
    margin: 0 0 12px 0;
}

.quiz-performance-explanation-content ul,
.quiz-performance-explanation-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.quiz-performance-explanation-content li {
    margin: 6px 0;
}

.quiz-performance-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary, #6b7280);
}

.quiz-performance-empty p {
    margin: 8px 0;
    font-size: 14px;
}

.quiz-performance-empty-hint {
    font-size: 12px;
    color: var(--text-tertiary, #9ca3af);
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .quiz-performance-section {
        padding: 16px;
    }

    .quiz-performance-chart {
        max-width: 100%;
    }

    .quiz-performance-svg {
        max-height: 200px;
    }
}

@media (max-width: 1199px) {
    /**
     * Mobile-specific theme overrides
     * These values tweak the CSS variables defined in style.css so the UI
     * feels lighter and more breathable on smaller screens.
     */

    body[data-theme="light"] {
        --sidebar-bg: #FFFFFF;
        /* Crisp white sidebar */
        --main-bg: #FFFFFF;
        /* Slightly off-white for better separation */

        /* Text colors */
        --text-primary: #111111;
        /* Deep neutral black for strong contrast */
        --text-secondary: #333333;
        /* Softer dark gray for subtitles */
        --text-faded: #555555;
        /* Dimmed gray for placeholder or muted text */
        --text-tertiary: #999999;
        /* Tertiary text color for less important text */

        /* Borders & dividers */
        --border-color: #D9D9D9;
        /* Light neutral gray for soft boundaries */
        --nav-active-bg: #F2F2F2;
        /* Gentle highlight for active areas */
        --bg-active: #E8E8E8;
        /* Background for active items */
        --bg-tertiary: #E0E0E0;
        /* Tertiary background for scrollbars */

        /* Inputs */
        --input-main-bg: #FFFFFF;
        --input-bg: #F7F7F7;
        /* Keep inputs clean and white */
        --input-border: #CCCCCC;
        /* Subtle but visible border */
        --tool-bg: #F5F5F5;
        /* Slightly darker grey for tool section */
        --dropdown-bg: #FFFFFF;
        /* Dedicated dropdown surface */

        /* Accent color (use same family as dark mode for consistency) */
        --accent: #FFC400;
        /* Muted blue for links/buttons */
        --accent-hover: #6C90FF;
        /* Slightly lighter hover tone */
    }


    /* Dark Theme (Default) */
    body[data-theme="dark"] {
        --sidebar-bg: #121212;
        --main-bg: #121212;

        /* Text colors with higher contrast */
        --text-primary: #F5F5F5;
        /* Brighter white, but still soft */
        --text-secondary: #B5B5B5;
        /* More distinct gray */
        --text-faded: #7A7A7A;
        /* Slightly brighter for legibility */
        --text-tertiary: #8A8A8A;
        /* Tertiary text color for less important text */

        /* UI elements */
        --border-color: #1E1E1E;
        --nav-active-bg: #3A3A3A;
        --bg-active: #4A4A4A;
        /* Background for active items */
        --bg-tertiary: #2D2D2D;
        /* Tertiary background for scrollbars */
        --input-main-bg: #303030;
        --input-bg: #2A2A2A;
        --input-border: #3C3C3C;
        --tool-bg: #1F1F1F;
        /* Darker charcoal grey for tool section */
        --dropdown-bg: #1F1F1F;

        /* Accent */
        --accent: #FFC400;
        --accent-hover: #7DA3FF;
    }

    /* Dark Charcoal Theme */
    body[data-theme="dark"][data-dark-variant="charcoal"] {
        --sidebar-bg: #1E1E1E;
        --main-bg: #212121;

        /* Text colors */
        --text-primary: #E5E5E5;
        --text-secondary: #B0B0B0;
        --text-faded: #808080;
        --text-tertiary: #909090;
        /* Tertiary text color for less important text */

        /* UI elements */
        --border-color: #2D2D2D;
        --nav-active-bg: #2D2D2D;
        --bg-active: #3D3D3D;
        /* Background for active items */
        --bg-tertiary: #353535;
        /* Tertiary background for scrollbars */
        --input-main-bg: #303030;
        --input-bg: #2D2D2D;
        --input-border: #3A3A3A;
        --tool-bg: #252525;
        /* Darker charcoal grey for tool section */
        --dropdown-bg: #1F1F1F;

        /* Accent */
        --accent: #FFC400;
        --accent-hover: #7DA3FF;
    }
}

/* Live Chat Overlay Styles - Exact Match to live.html */

.live-chat-overlay {
    position: absolute;
    top: var(--live-overlay-offset, 0);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    background: var(--main-bg, #0a0a0a);
    z-index: 900;
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: clamp(16px, 4vw, 40px);
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.live-chat-container {
    width: 100%;
    max-width: 1100px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: clamp(24px, 4vw, 48px);
    position: relative;
    z-index: 1;
    margin: 0 auto;
}

.live-chat-header {
    padding: 40px 20px 30px;
    text-align: center;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.live-chat-time {
    font-size: 15px;
    color: var(--text-faded, #888);
    font-weight: 400;
}

.live-chat-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--input-bg, rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(20px);
    border-radius: 25px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
    font-size: 15px;
    font-weight: 500;
}

.live-chat-dot {
    width: 8px;
    height: 8px;
    background: #ff4757;
    border-radius: 50%;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 8px rgba(255, 71, 87, 0);
    }
}

.live-chat-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 20;
}

.live-chat-close:hover {
    background: var(--nav-active-bg, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
}

.live-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Messages Container - Shown when messages exist */
.live-chat-messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-height: 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.live-chat-messages-container::-webkit-scrollbar {
    width: 8px;
}

.live-chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.live-chat-messages-container::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.2));
    border-radius: 4px;
}

.live-chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--bg-active, rgba(255, 255, 255, 0.3));
}

/* Voice Interface - Shown by default */
.live-chat-voice-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
}

.live-chat-waveform-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 60px;
    width: 100%;
}

.live-chat-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 200px;
    position: relative;
    z-index: 2;
}

.live-chat-wave {
    width: 5px;
    background: linear-gradient(180deg, #00d4ff 0%, #7b2ff7 100%);
    border-radius: 10px;
    transition: height 0.1s ease;
}

.live-chat-glow-orb {
    display: none;
}

@keyframes orbPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }
}

.live-chat-status-container {
    text-align: center;
    padding: 0 30px;
}

.live-chat-status-text {
    font-size: 24px;
    color: var(--text-primary, #ffffff);
    font-weight: 500;
    margin-bottom: 12px;
    opacity: 0.95;
    display: none !important;
    /* Hidden for clean UI */
}

.live-chat-status-subtext {
    font-size: 15px;
    color: var(--text-faded, #888);
    line-height: 1.6;
    display: none !important;
    /* Hidden for clean UI */
}

.live-chat-listening-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 8px 18px;
    background: var(--input-bg, rgba(0, 212, 255, 0.1));
    border-radius: 20px;
    border: 1px solid var(--border-color, rgba(0, 212, 255, 0.3));
}

.live-chat-listening-text {
    font-size: 13px;
    color: var(--accent, #00d4ff);
    font-weight: 500;
}

.live-chat-controls {
    margin-top: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.live-chat-control-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    background: var(--input-main-bg, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #fff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.live-chat-control-button:hover {
    transform: translateY(-2px);
    border-color: var(--accent, rgba(255, 255, 255, 0.4));
}

.live-chat-control-button.danger {
    background: rgba(255, 77, 79, 0.15);
    border-color: rgba(255, 77, 79, 0.5);
    color: #ff6b6f;
}

.live-chat-control-button.danger:hover {
    background: rgba(255, 77, 79, 0.25);
}

.live-chat-control-button.responding,
.live-chat-control-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.live-chat-control-button.responding .live-chat-control-label {
    color: var(--text-tertiary, #aaa);
}

.live-chat-control-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.live-chat-control-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.live-chat-control-icon .icon-play {
    display: none;
}

.live-chat-control-button.paused .icon-pause {
    display: none;
}

.live-chat-control-button.paused .icon-play {
    display: block;
}

.live-chat-control-label {
    font-size: 11px;
    letter-spacing: 0.02em;
}

.live-chat-control-button.paused .live-chat-control-icon svg {
    transition: transform 0.2s ease;
}

.live-chat-control-button.paused .live-chat-control-label {
    color: var(--accent, #ffc400);
}

.live-chat-listening-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 8px 18px;
    background: var(--input-bg, rgba(0, 212, 255, 0.1));
    border-radius: 20px;
    border: 1px solid var(--border-color, rgba(0, 212, 255, 0.3));
}

.live-chat-listening-dot {
    width: 6px;
    height: 6px;
    background: var(--accent, #00d4ff);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.8);
    }
}

.live-chat-listening-text {
    font-size: 13px;
    color: var(--accent, #00d4ff);
    font-weight: 500;
}

/* Message Styles */
.live-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.live-chat-message-user {
    align-self: flex-end;
    align-items: flex-end;
}

.live-chat-message-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.live-chat-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 14px;
}

.live-chat-message-user .live-chat-message-content {
    background: var(--input-main-bg, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
    border-bottom-right-radius: 4px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.live-chat-message-assistant .live-chat-message-content {
    background: var(--input-bg, rgba(255, 255, 255, 0.05));
    color: var(--text-primary, #ffffff);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.live-typing-indicator {
    display: inline-block;
    animation: typing 1.4s infinite;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

@keyframes typing {

    0%,
    60%,
    100% {
        opacity: 0.3;
    }

    30% {
        opacity: 1;
    }
}

/* Live Chat Button in Input Container */
.live-chat-button {
    background: transparent;
    border: none;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.live-chat-button:hover {
    background: var(--nav-active-bg, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
}

.live-chat-button svg {
    width: 18px;
    height: 18px;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .live-chat-container {
        max-width: 1200px;
        padding: 48px;
    }

    .live-chat-waveform {
        height: 250px;
        gap: 6px;
    }

    .live-chat-wave {
        width: 6px;
    }

    .live-chat-status-text {
        font-size: 28px;
    }

    .live-chat-status-subtext {
        font-size: 16px;
    }

}

@media (min-width: 1024px) {
    .live-chat-container {
        max-width: 1300px;
        border-radius: 32px;
        background: var(--main-bg, rgba(10, 10, 10, 0.85));
        backdrop-filter: blur(20px);
    }

    .live-chat-waveform {
        height: 280px;
        gap: 7px;
    }

    .live-chat-wave {
        width: 7px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .live-chat-container {
        padding: 20px;
    }

    .live-chat-header {
        padding: 30px 20px 20px;
    }

    .live-chat-messages-container {
        padding: 16px;
        padding-top: 60px;
        padding-bottom: calc(140px + env(safe-area-inset-bottom));
    }

    .live-chat-message {
        max-width: 85%;
    }
}

/* PDF Viewer Styles */
.pdf-viewer-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

/* Standalone Data Management modals (no settings dependencies) */
.dm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 16px;
}

.dm-overlay.show {
    display: flex;
}

.dm-dialog {
    width: 100%;
    max-width: 520px;
    background: var(--sidebar-bg);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.dm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
}

.dm-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.dm-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

.dm-close:hover {
    color: var(--text-primary);
}

.dm-body {
    padding: 16px 18px 18px 18px;
}

.dm-danger {
    background: var(--input-bg);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dm-badge {
    display: inline-flex;
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.dm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.dm-copy {
    margin: 0;
    color: var(--text-secondary);
}

.dm-list {
    padding-left: 18px;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.dm-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.dm-label {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
}

.dm-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--sidebar-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
}

.dm-input::placeholder {
    color: var(--text-faded);
    font-weight: 400;
}

.dm-input:focus {
    border-color: #ef4444;
    background: var(--main-bg);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.dm-error {
    color: #ef4444;
    font-size: 13px;
}

.dm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.dm-btn {
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

.dm-btn-secondary {
    background: var(--input-bg);
    color: var(--text-primary);
}

.dm-btn-secondary:hover {
    background: var(--nav-active-bg);
}

.dm-btn-danger {
    background: #ef4444;
    color: #fff;
}

.dm-btn-danger:hover {
    opacity: 0.9;
}

.dm-body-scrollable {
    height: 450px;
    overflow-y: auto;
    padding: 20px;
}

.dm-body-scrollable::-webkit-scrollbar {
    width: 6px;
}

.dm-body-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.dm-body-scrollable::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.dm-section-header {
    margin-bottom: 12px;
}

.dm-section-header h4 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dm-section-header i {
    font-size: 13px;
    width: 16px;
    text-align: center;
}

/* Tabs */
.dm-tabs {
    display: flex;
    gap: 24px;
    padding: 0 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.dm-tab {
    padding: 12px 4px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    outline: none;
    position: relative;
    top: 1px;
    /* Align border with container border */
}

.dm-tab:hover {
    color: var(--text-primary);
}

.dm-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.dm-tab-content {
    display: none;
    animation: fadeIn 0.15s ease-out;
}

.dm-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0.6;
        transform: translateY(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/**
 * Vertical Message Timeline Navigation - Scrolling Ribbon Version
 */

.timeline-container {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    /* Increased for better hover zone */
    height: 75vh;
    /* Taller to show more ticks */
    max-height: 480px;
    /* Set maximum height as requested */
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    visibility: hidden;
    pointer-events: auto;
    /* Gradient mask to fade out ticks at top and bottom */
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
    overflow: hidden;
}

.main-content.has-chat .timeline-container {
    opacity: 1;
    visibility: visible !important;
}

/* Hide on narrow screens */
@media (max-width: 767px) {
    .timeline-container {
        display: none !important;
    }
}

.timeline-bar {
    display: none;
}

.timeline-scroller {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    z-index: 2;
}

.timeline-tick {
    position: absolute;
    right: 12px;
    width: 4px;
    height: 2px;
    background: var(--text-faded);
    border-radius: 1px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: right center;
    z-index: 5;
}

/* Invisible hit area to make hovering easier */
.timeline-tick::after {
    content: '';
    position: absolute;
    right: -8px;
    top: -6px;
    bottom: -6px;
    width: 40px;
    background: transparent;
}

/* User ticks are longer, as seen in the reference image */
.timeline-tick.user-tick {
    width: 10px;
    background: rgba(255, 255, 255, 0.4);
}

.timeline-tick:hover {
    background: var(--accent) !important;
    width: 18px !important;
    z-index: 10;
}

.timeline-tick.active {
    background: var(--accent);
    width: 14px;
    height: 2px;
    box-shadow: 0 0 8px var(--accent);
    opacity: 1 !important;
}

/* Tooltip for message preview - Fixed to avoid clipping */
.timeline-tooltip {
    position: fixed;
    right: 48px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    width: 260px;
    pointer-events: none;
    opacity: 0;
    transform: translateX(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    line-height: 1.5;
}

.timeline-tooltip.show {
    opacity: 1;
    transform: translateX(0);
}

.timeline-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--text-secondary, #999);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-tooltip-body {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.timeline-tooltip-image {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 4px;
    border: 1px solid var(--border-color);
}

/* Highlighted message effect */
.chat-message.timeline-highlight {
    animation: timeline-pulse 1.5s ease-out;
}

@keyframes timeline-pulse {
    0% {
        background-color: rgba(78, 204, 163, 0.1);
    }

    100% {
        background-color: transparent;
    }
}

/* Minimalist Share Modal Styling */
.minimalist-share-modal {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.share-card {
    background: var(--sidebar-bg);
    width: 100%;
    max-width: 520px;
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 32px;
}

.share-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.share-card-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.share-card-close {
    background: var(--nav-active-bg);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 10px;
    transition: all 0.2s;
    display: flex;
}

.share-card-close:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.share-card-body {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Chat Preview */
.share-chat-preview {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    max-height: 280px;
    overflow-y: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.share-chat-preview::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, var(--input-bg));
    pointer-events: none;
}

.preview-message {
    font-size: 14.5px;
    line-height: 1.5;
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 85%;
}

.preview-message.user {
    align-self: flex-end;
    background: var(--nav-active-bg);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.preview-message.assistant {
    align-self: flex-start;
    background: transparent;
    color: var(--text-secondary);
    padding-left: 0;
}

.preview-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* Actions Row */
.share-actions-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.share-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.share-action-item:hover {
    transform: translateY(-4px);
}

.action-icon {
    width: 56px;
    height: 56px;
    background: var(--nav-active-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.share-action-item:hover .action-icon,
.share-action-item.active .action-icon {
    background: var(--accent);
    color: white;
}

.share-action-item.active span {
    color: var(--accent);
}

.share-action-item span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Classroom Share Modal Specific Styles */
.share-classroom-preview {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.classroom-preview-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.classroom-preview-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.classroom-preview-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--nav-active-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.classroom-preview-info h3 {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.classroom-preview-info p {
    margin: 0 0 4px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.share-codes-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.code-item {
    background: var(--nav-active-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
}

.code-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.code-label i {
    color: var(--accent);
}

.code-copy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.code-value {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-all;
    flex: 1;
}

.copy-code-btn {
    background: var(--accent);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.copy-code-btn:hover {
    background: var(--accent-hover, #e6a100);
    transform: translateY(-2px);
}

.copy-code-btn.copied {
    background: #4CAF50;
}

.copy-code-btn.copied i {
    content: '\f00c';
    /* checkmark icon */
}

/* Student Question Modal Styles */
.student-question-modal {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.question-modal-card {
    background: var(--sidebar-bg);
    width: 100%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.question-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.question-modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.question-modal-close {
    background: var(--nav-active-bg);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 10px;
    transition: all 0.2s;
    display: flex;
}

.question-modal-close:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.question-modal-body {
    padding: 0 24px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    flex: 1;
}

.question-type-selector h3,
.privacy-settings h3,
.question-input-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

.question-type-options,
.privacy-options {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.question-type-option,
.privacy-option {
    flex: 1;
    cursor: pointer;
}

.question-type-option input,
.privacy-option input {
    display: none;
}

.question-type-option .option-content,
.privacy-option .option-content {
    background: var(--nav-active-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
}

.question-type-option input:checked+.option-content,
.privacy-option input:checked+.option-content {
    background: var(--accent);
    color: var(--text-primary);
    border-color: var(--accent);
}

.question-type-option i,
.privacy-option i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.question-type-option span,
.privacy-option span {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.question-type-option small,
.privacy-option small {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.question-input-section {
    display: flex;
    flex-direction: column;
}

#questionText {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    width: 100%;
    min-height: 120px;
}

#questionText:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

.input-footer {
    text-align: right;
    margin-top: 8px;
}

#charCount {
    color: var(--text-secondary);
    font-size: 12px;
}

.question-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--nav-active-bg);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--nav-active-bg);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    border: none;
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--accent-hover, #e6a100);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Curriculum Library Modern UI */

.header-titles h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.header-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.modal-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0 24px;
    opacity: 0.5;
}

.curriculum-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 4px;
}

.curriculum-section-header h3 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-faded);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.subject-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* Live Search Container */
.curriculum-search-container {
    padding: 0 4px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    margin-bottom: -10px;
    /* Pull list up slightly */
}

/* Search Input Wrapper */
.search-wrapper {
    position: relative;
    width: 100%;
}

/* Search Icon */
.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 14px;
    transition: color 0.2s ease;
}

/* Search Input Field */
.search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg, #f5f5f7);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.search-input:focus {
    background: var(--input-main-bg, #ffffff);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.search-input:focus+.search-icon {
    color: var(--accent);
}

.search-input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.8;
}

/* Curriculum Filters */
.curriculum-filters {
    display: flex;
    gap: 12px;
    padding: 0 4px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    margin-bottom: 8px;
}

.curriculum-filters::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.filter-chip {
    flex: 0 0 auto;
    padding: 10px 18px;
    background: var(--tool-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    max-width: 220px;
}

.filter-chip:hover {
    border-color: var(--accent);
    background: var(--input-bg);
    transform: translateY(-1px);
}

.filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.filter-chip .filter-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.filter-chip .filter-desc {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.filter-chip.active .filter-label,
.filter-chip.active .filter-desc {
    color: #ffffff;
}

.filter-chip.all-filter {
    min-width: 80px;
    justify-content: center;
    align-items: center;
}

.filter-chip.all-filter .filter-label {
    font-size: 14px;
}

.curricula-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
    padding-top: 10px;
}

.curriculum-card {
    background: var(--tool-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    min-height: 210px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.curriculum-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.card-content {
    flex: 1;
}

.card-header-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.badge-igcse {
    padding: 2px 10px;
    background: rgba(0, 122, 255, 0.1);
    color: #4a9eff;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-code {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.card-content h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.card-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer-meta {
    display: flex;
    gap: 20px;
    align-items: center;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.meta-item i {
    font-size: 14px;
}

.card-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
    min-width: 160px;
    margin-left: 24px;
}

.btn-start-learning {
    background: #ffc107;
    /* Vibrant Yellow/Gold */
    color: #1a1a1a;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-start-learning:hover {
    background: #ffca2c;
    transform: scale(1.02);
}

.btn-view-syllabus {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view-syllabus:hover {
    background: var(--nav-active-bg);
}

/* Modal sizing fix */
#curriculumModal .all-files-modal {
    width: 900px;
    max-width: 95vw;
    height: 80vh;
    min-height: 500px;
}

.all-files-modal {
    width: 900px;
    max-width: 95vw;
}

/* Syllabus View Specific Overrides */
.syllabus-modal {
    width: 1000px;
}

.syllabus-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 30px;
}

.meta-card {
    padding: 12px;
    background: var(--input-main-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.meta-card-label {
    font-size: 11px;
    color: var(--text-faded);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}

.meta-card-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.syllabus-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.syllabus-section-title i {
    color: var(--accent);
}

.topic-card {
    background: var(--tool-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    border-left: 4px solid var(--accent);
    transition: all 0.3s ease;
}

.topic-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.topic-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-faded);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    display: block;
}

.topic-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.objectives-section {
    margin: 16px 0 20px 0;
    background: var(--input-main-bg);
    padding: 16px;
    border-radius: 12px;
}

.objectives-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.objectives-list {
    margin: 0;
    padding-left: 20px;
}

.objectives-list li {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.subtopics-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subtopics-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.subtopic-item {
    padding: 12px 16px;
    background: var(--input-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.subtopic-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

.subtopic-number {
    font-weight: 700;
    color: var(--accent);
    font-size: 13px;
    min-width: 40px;
}

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

.syllabus-body-wrapper {
    padding: 24px;
}

.concepts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.concept-card {
    border-left-color: var(--avatar-blue) !important;
}

.difficulty-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    background: var(--input-main-bg);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.syllabus-modal .card-description {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    display: block;
    overflow: visible;
}

.syllabus-modal .card-footer-meta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .curriculum-card {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .card-actions {
        margin-left: 0;
        margin-top: 20px;
        flex-direction: row;
    }

    .btn-start-learning,
    .btn-view-syllabus {
        flex: 1;
    }
}

/* Onboarding Walkthrough - Apple-style Aesthetics */

:root {
    --onboarding-blur: blur(25px);
    --onboarding-card-bg: rgba(28, 28, 30, 0.7);
    --onboarding-accent: #007aff;
    --onboarding-text: #ffffff;
    --onboarding-text-muted: rgba(255, 255, 255, 0.6);
}

[data-theme="light"] {
    --onboarding-card-bg: rgba(255, 255, 255, 0.75);
    --onboarding-text: #000000;
    --onboarding-text-muted: rgba(0, 0, 0, 0.5);
}

/* Spotlight Overlay */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 20000;
    background: transparent;
    visibility: hidden;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding-overlay.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.onboarding-overlay svg {
    width: 100%;
    height: 100%;
}

.onboarding-mask-bg {
    fill: rgba(0, 0, 0, 0.82);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#spotlight-hole,
#spotlight-rect-hole {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Walkthrough Card */
.onboarding-card {
    position: fixed;
    z-index: 20001;
    width: 360px;
    padding: 32px;
    border-radius: 24px;
    background: var(--onboarding-card-bg);
    backdrop-filter: var(--onboarding-blur);
    -webkit-backdrop-filter: var(--onboarding-blur);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--onboarding-text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    pointer-events: auto;
    user-select: none;
}

.onboarding-card.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.onboarding-header {
    margin-bottom: 16px;
}

.onboarding-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.8px;
    margin: 0;
}

.onboarding-content {
    font-size: 16px;
    line-height: 1.6;
    color: var(--onboarding-text-muted);
    margin-bottom: 32px;
}

/* Steps Indicator */
.onboarding-steps {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    pointer-events: none;
}

.onboarding-step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--onboarding-text-muted);
    opacity: 0.2;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding-step-dot.active {
    background: var(--onboarding-accent);
    opacity: 1;
    width: 20px;
    border-radius: 4px;
}

/* Footer & Buttons */
.onboarding-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.onboarding-actions {
    display: flex;
    gap: 12px;
}

.onboarding-skip-btn {
    background: transparent;
    border: none;
    color: var(--onboarding-text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.onboarding-skip-btn:hover {
    color: var(--onboarding-text);
}

.onboarding-back-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--onboarding-text);
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.onboarding-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.onboarding-next-btn {
    background: var(--onboarding-accent);
    border: none;
    color: white;
    padding: 12px 28px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding-next-btn:hover {
    background: #0071e3;
    transform: scale(1.02);
}

.onboarding-next-btn:active {
    transform: scale(0.98);
}

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

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

canvas {
    display: block;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
}

/* ===== Control Panel ===== */
#control-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    width: 260px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

#control-panel h3 {
    color: #333;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

#function-input {
    flex: 1;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 10px;
    color: #333;
    font-size: 13px;
    font-family: monospace;
    outline: none;
}

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

#function-input::placeholder {
    color: #999;
}

.btn {
    background: #2563eb;
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.btn:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #eee;
}

#functions-list {
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.function-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 4px;
}

.function-item:hover {
    background: #f0f0f0;
}

.function-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.function-expr {
    flex: 1;
    color: #333;
    font-size: 12px;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.function-toggle {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 1.5px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
}

.function-toggle.active {
    background: #2563eb;
    border-color: #2563eb;
}

.function-toggle.active::after {
    content: '✓';
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.function-remove {
    width: 18px;
    height: 18px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    border-radius: 3px;
}

.function-remove:hover {
    color: #e53e3e;
    background: #fee;
}

.actions-row {
    display: flex;
    gap: 8px;
}

.actions-row .btn {
    flex: 1;
}

/* ===== Coordinate Display ===== */
#coord-display {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 50;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

#coord-display.visible {
    opacity: 1;
}

#coord-display .coords {
    color: #333;
    font-size: 11px;
    font-family: monospace;
}

#coord-display .fn-label {
    color: #2563eb;
    font-size: 10px;
    margin-top: 2px;
}

/* ===== Dropped Points ===== */
.point-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 40;
}

.point-marker .dot {
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.point-marker .label {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 3px 6px;
    color: #333;
    font-size: 10px;
    font-family: monospace;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===== Hint ===== */
#hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 6px 12px;
    color: #666;
    font-size: 11px;
    pointer-events: none;
}

/* ===== Floating AI Button ===== */
#ai-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 200;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

#ai-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#ai-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Chat Panel ===== */
#chat-panel {
    position: absolute;
    bottom: 90px;
    right: 20px;
    width: 450px;
    max-height: 500px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 150;
    overflow: hidden;
}

#chat-panel.open {
    display: flex;
}

#chat-header {
    padding: 12px 16px;
    background: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

#chat-header img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

#chat-header span {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

#chat-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

#chat-close:hover {
    background: #eee;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    max-height: 350px;
    min-height: 150px;
}

.chat-msg {
    margin-bottom: 12px;
    max-width: 90%;
}

.chat-msg.user {
    margin-left: auto;
    text-align: right;
}

.chat-msg .bubble {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
}

.chat-msg.user .bubble {
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg.ai .bubble {
    background: #f5f5f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chat-msg.ai .bubble.typing {
    color: #888;
}

/* Math and Markdown Styling in Chat */
.chat-msg.ai .bubble p {
    margin: 0 0 8px 0;
}

.chat-msg.ai .bubble p:last-child {
    margin-bottom: 0;
}

.chat-msg.ai .bubble ul,
.chat-msg.ai .bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-msg.ai .bubble li {
    margin-bottom: 4px;
}

.chat-msg.ai .bubble strong {
    font-weight: 600;
}

.chat-msg.ai .bubble code {
    background: #e8e8e8;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Monaco', 'Consolas', monospace;
}

.chat-msg.ai .bubble pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.chat-msg.ai .bubble pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* MathJax styling */
.chat-msg .bubble .MathJax {
    font-size: 105% !important;
}

.chat-msg .bubble mjx-container {
    margin: 4px 0;
}

.chat-msg .bubble mjx-container[display="true"] {
    display: block;
    text-align: center;
    margin: 12px 0;
    overflow-x: auto;
}

#chat-input-row {
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
}

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

#chat-send {
    background: #2563eb;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
}

#chat-send:hover {
    background: #1d4ed8;
}

#chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ===== Drawing Toolbar ===== */
#drawing-toolbar {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.tool-btn {
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.15s ease;
}

.tool-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.tool-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #1d4ed8;
}

.tool-btn.active:hover {
    background: #1d4ed8;
}

.tool-btn svg {
    width: 18px;
    height: 18px;
}

.tool-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    #drawing-toolbar {
        top: auto;
        bottom: 80px;
        right: 10px;
        transform: none;
        flex-direction: row;
        padding: 4px;
    }

    .tool-btn {
        width: 32px;
        height: 32px;
    }

    .tool-separator {
        width: 1px;
        height: auto;
        margin: 0 4px;
    }
}

/* Classroom Features Styles */

/* Hide main header when classroom mode is active, but only if no specific conversation is loaded */
main-content[data-classroom-mode="active"]:not(.has-chat)~.main-header,
main-content[data-classroom-mode="active"]:not(.has-chat) .main-header {
    display: none !important;
}

/* Also hide header on initial page load for classroom URL, but not if there's a conversation */
body[data-special-mode="classroom"][data-has-conversation="false"] .main-header {
    display: none !important;
}

/* Map Classroom variables to Global Theme Variables */
.classroom-content {
    /* Core colors */
    --classroom-primary: var(--accent);
    --classroom-accent: rgba(255, 196, 0, 0.1);

    /* Surfaces */
    --classroom-surface: var(--surface-card);
    --classroom-surface-elevated: var(--tool-bg);
    --classroom-card-bg: var(--input-bg);

    /* Text */
    --classroom-text-primary: var(--text-primary);
    --classroom-text-secondary: var(--text-secondary);
    --classroom-text-faded: var(--text-faded);

    /* Borders */
    --classroom-border: var(--border-color);

    /* Shadows */
    --classroom-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    --classroom-shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.1);

    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    background: var(--main-bg);
    padding: 2rem;
    color: var(--classroom-text-primary);
}

/* Header Section */
.classroom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.classroom-header h1 {
    font-size: 2rem;
    color: var(--classroom-text-primary);
    margin: 0;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--classroom-surface-elevated);
    border-radius: 12px;
    border: 1px solid var(--classroom-border);
    box-shadow: var(--classroom-shadow-sm);
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--classroom-primary), var(--classroom-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: bold;
}

/* Welcome Section */
.welcome-banner {
    background: var(--classroom-accent);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    border: 1px solid rgba(245, 158, 11, 0.12);
}

.welcome-banner h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: white;
}

.welcome-banner p {
    color: var(--classroom-text-secondary);
}

/* Action Cards */
.action-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-card-item {
    background: var(--classroom-surface);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--classroom-border);
}

.action-card-item:hover {
    transform: translateY(-4px);
    border-color: var(--classroom-primary);
    box-shadow: var(--classroom-shadow);
}

.action-card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--classroom-primary);
}

.action-card-item h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.action-card-item p {
    font-size: 0.9rem;
    color: var(--classroom-text-secondary);
}

/* Section Header */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Course Grid */
.course-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.course-card-modern {
    background: var(--classroom-card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--classroom-border);
    transition: all 0.22s ease;
    cursor: pointer;
}

.course-card-modern:hover {
    transform: translateY(-4px);
    border-color: var(--classroom-primary);
    box-shadow: var(--classroom-shadow);
}

.course-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.course-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--classroom-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.course-card-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--classroom-text-primary);
}

.course-card-desc {
    color: var(--classroom-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-card-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--classroom-text-secondary);
    margin-bottom: 1rem;
}

.course-code-badge {
    background: var(--classroom-surface);
    padding: 4px 12px;
    border-radius: 20px;
    font-family: monospace;
    font-weight: 600;
    color: var(--classroom-text-secondary);
    display: inline-block;
}

/* Modal Overrides for Classroom */
.classroom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.classroom-modal-overlay.show {
    display: flex;
}

.classroom-modal {
    background: var(--classroom-surface-elevated);
    border-radius: 20px;
    width: 90%;
    max-width: 520px;
    border: 1px solid var(--classroom-border);
    box-shadow: var(--classroom-shadow);
    padding: 0;
    color: var(--classroom-text-primary);
}

.classroom-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--classroom-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.classroom-modal-form {
    padding: 1.5rem;
}

/* FAB */
.classroom-fab-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--classroom-primary);
    color: #000;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--classroom-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    z-index: 100;
}

.classroom-fab-btn:hover {
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .classroom-content {
        padding: 1rem;
    }

    .course-grid-container {
        grid-template-columns: 1fr;
    }
}

/* --- Stream View / Course Detail Styles --- */

.course-header-detail {
    background: var(--classroom-surface-elevated);
    border: 1px solid var(--classroom-border);
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--classroom-shadow-sm);
}

.course-header-glow {
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--classroom-accent) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.5;
}

.course-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    position: relative;
    z-index: 2;
}

.course-title-detail {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    color: var(--classroom-text-primary);
    letter-spacing: -0.5px;
}

.course-description-detail {
    font-size: 1.1rem;
    opacity: 0.9;
    color: var(--classroom-text-secondary);
    max-width: 600px;
    line-height: 1.6;
}

.course-meta-row {
    margin-top: 1.5rem;
    display: flex;
    gap: 10px;
}

.course-code-badge {
    background: var(--classroom-surface);
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-family: monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--classroom-primary);
    border: 1px solid var(--classroom-border);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.course-code-badge:hover {
    background: var(--classroom-surface-elevated);
    border-color: var(--classroom-primary);
    transform: translateY(-1px);
    box-shadow: var(--classroom-shadow-sm);
}

.course-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-header-primary {
    padding: 10px 20px;
    background: var(--classroom-primary);
    border: none;
    color: #000;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    box-shadow: var(--classroom-shadow-sm);
    transition: transform 0.2s;
    min-height: 44px;
    white-space: nowrap;
}

.btn-header-primary:hover {
    transform: translateY(-2px);
    background: var(--classroom-primary-dark);
}

.btn-header-secondary {
    padding: 10px 20px;
    background: var(--classroom-surface);
    border: 1px solid var(--classroom-border);
    color: var(--classroom-text-primary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.2s;
    min-height: 44px;
    white-space: nowrap;
}

.btn-header-secondary:hover {
    background: var(--classroom-surface-elevated);
    border-color: var(--classroom-text-secondary);
}

/* Tabs */
.classroom-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--classroom-border);
    padding-bottom: 0px;
}

.classroom-tab {
    padding: 12px 24px;
    background: transparent;
    color: var(--classroom-text-secondary);
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: 500;
    position: relative;
    bottom: -1px;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.classroom-tab:hover {
    color: var(--classroom-text-primary);
    background: var(--classroom-surface);
}

.classroom-tab.active {
    color: var(--classroom-primary);
    border-bottom: 3px solid var(--classroom-primary);
    font-weight: 600;
}

.tab-badge {
    background: var(--classroom-surface);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 0;
    border: 1px solid var(--classroom-border);
}

/* Teacher vs Student View Distinctions */
.teacher-view {
    border-left: 4px solid var(--classroom-primary);
}

.student-view {
    border-left: 4px solid #10b981;
    /* Green for student view */
}

.student-view .course-header-actions {
    gap: 0.5rem;
    /* Smaller gap when only share button */
}

.student-view .btn-header-secondary {
    background: var(--classroom-surface-elevated);
    color: var(--classroom-text-primary);
}

.student-view .btn-header-secondary:hover {
    background: var(--classroom-primary);
    color: var(--text-primary);
}

/* Student-specific quick action buttons */
.quick-action-btn:hover {
    background: var(--classroom-surface);
    transform: translateY(-2px);
}

.quick-action-btn:active {
    transform: translateY(0);
}

/* Current user highlight in student People tab */
.student-view .student-avatar-container {
    position: relative;
}

.student-view .current-user-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
}

/* --- Redesigned Stream View Styles --- */

.classroom-content {
    --bg-main: #0c0c0c;
    --bg-card: #161616;
    --bg-surface-redesign: #1f1f1f;
    --accent-redesign: #facc15;
    --text-main: #ffffff;
    --text-dim: #9ca3af;
    --border-redesign: rgba(255, 255, 255, 0.08);
    --radius-lg: 20px;
    --radius-md: 12px;
    --green-redesign: #10b981;
    --red-redesign: #ef4444;
}

/* Subject Card Redesign */
.subject-card-redesign {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    border: 1px solid var(--border-redesign);
}

.subject-info-redesign h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}

.subject-info-redesign p {
    color: var(--text-dim);
    margin-bottom: 20px;
}

.class-code-redesign {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(250, 204, 21, 0.1);
    color: var(--accent-redesign);
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
}

.btn-redesign {
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-gold-redesign {
    background: var(--accent-redesign);
    color: #000;
}

.btn-gold-redesign:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Navigation Tabs Redesign */
.nav-tabs-redesign {
    display: flex;
    gap: 32px;
    border-bottom: 1px solid var(--border-redesign);
    margin-bottom: 30px;
    padding: 0 10px;
}

.tab-item-redesign {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 0;
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
}

.tab-item-redesign span {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    margin-left: 4px;
}

.tab-item-redesign.active {
    color: var(--accent-redesign);
}

.tab-item-redesign.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-redesign);
}

/* Overview Grid */
.overview-grid-redesign {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.stats-strip-redesign {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.mini-stat-redesign {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-redesign);
}

.mini-stat-redesign label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    display: block;
    margin-bottom: 8px;
}

.mini-stat-redesign span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Info Cards Redesign */
.info-card-redesign {
    background: var(--bg-card);
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header-redesign {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-redesign);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header-redesign h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.list-item-redesign {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-redesign);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.list-item-redesign:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

.item-main-redesign {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-circle-redesign {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-surface-redesign);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-redesign);
}

.health-indicator-redesign {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.health-good-redesign {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green-redesign);
}

.health-bad-redesign {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red-redesign);
}

.view-all-redesign {
    font-size: 0.85rem;
    color: var(--accent-redesign);
    text-decoration: none;
    font-weight: 500;
}

.view-all-redesign:hover {
    text-decoration: underline;
}

@media (max-width: 992px) {
    .overview-grid-redesign {
        grid-template-columns: 1fr;
    }

    .subject-card-redesign {
        flex-direction: column;
        gap: 20px;
    }
}

/* --- Redesigned Student Section Styles --- */

/* Toolbar Redesign */
.toolbar-redesign {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.search-wrapper-redesign {
    position: relative;
    width: 320px;
}

.search-wrapper-redesign input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-redesign);
    padding: 12px 12px 12px 42px;
    border-radius: 12px;
    color: white;
    outline: none;
    transition: all 0.2s;
}

.search-wrapper-redesign input:focus {
    border-color: var(--accent-redesign);
}

.search-wrapper-redesign i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

/* Students Table Redesign */
.table-container-redesign {
    background: var(--bg-card);
    border: 1px solid var(--border-redesign);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.students-table-redesign {
    width: 100%;
    border-collapse: collapse;
}

.students-table-redesign th {
    text-align: left;
    padding: 16px 24px;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-redesign);
}

.students-table-redesign td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-redesign);
    font-size: 0.9rem;
    color: var(--text-main);
}

.students-table-redesign tr:last-child td {
    border-bottom: none;
}

.students-table-redesign tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.student-profile-redesign {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar-circle-redesign {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface-redesign);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent-redesign);
    border: 1px solid var(--border-redesign);
    overflow: hidden;
}

.avatar-circle-redesign img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-badge-redesign {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-high-redesign {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green-redesign);
}

.status-needs-redesign {
    background: rgba(245, 158, 11, 0.1);
    color: var(--orange);
}

.action-btn-redesign {
    background: transparent;
    border: 1px solid var(--border-redesign);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.action-btn-redesign:hover {
    border-color: var(--accent-redesign);
    color: white;
}

@media (max-width: 768px) {
    .toolbar-redesign {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .search-wrapper-redesign {
        width: 100%;
    }

    .students-table-redesign th:nth-child(2),
    .students-table-redesign td:nth-child(2),
    .students-table-redesign th:nth-child(3),
    .students-table-redesign td:nth-child(3) {
        display: none;
    }
}

/* ================================================
   GOOGLE-STYLE OVERVIEW REDESIGN
   ================================================ */

.classroom-content {
    --google-blue: var(--accent);
    --google-blue-light: rgba(255, 196, 0, 0.1);
    --google-green: #34a853;
    --google-card-bg: var(--input-bg);
    --google-border: var(--border-color);
    --google-text-primary: var(--text-primary);
    --google-text-secondary: var(--text-secondary);
    --google-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --google-radius: 24px;
}

/* Overview Grid Layout */
.overview-google-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.overview-google-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.overview-google-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Stats Row */
.stats-row-google {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card-google {
    background: var(--google-card-bg);
    padding: 24px;
    border-radius: var(--google-radius);
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
}

.stat-label-google {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--google-text-secondary);
    margin: 0 0 8px 0;
    letter-spacing: 0.5px;
}

.stat-value-google {
    font-size: 2rem;
    font-weight: 700;
    color: var(--google-text-primary);
    margin: 0;
}

.stat-value-google.stat-green {
    color: var(--google-green);
}

.stat-value-google.stat-blue {
    color: var(--google-blue);
}

/* Activity Card */
.activity-card-google {
    background: var(--google-card-bg);
    padding: 32px;
    border-radius: var(--google-radius);
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
}

.card-title-google {
    font-size: 1rem;
    font-weight: 700;
    color: var(--google-text-primary);
    margin: 0 0 24px 0;
}

.chart-container-google {
    height: 256px;
    position: relative;
}

/* Health Card */
.health-card-google {
    background: var(--google-card-bg);
    padding: 24px;
    border-radius: var(--google-radius);
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
}

.health-content-google {
    margin-top: 24px;
}

.health-row-google {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.health-label-google {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--google-text-secondary);
}

.health-badge-google {
    font-size: 11px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
}

.health-good-google {
    background: #dcfce7;
    color: #166534;
}

.health-bad-google {
    background: #fee2e2;
    color: #991b1b;
}

.health-progress-google {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--google-border);
}

.progress-bar-google {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill-google {
    height: 100%;
    background: var(--google-green);
    border-radius: 999px;
    transition: width 0.5s ease;
}

.progress-text-google {
    font-size: 11px;
    font-weight: 500;
    color: var(--google-text-secondary);
    text-align: center;
    margin: 0;
}

/* Tip Card (Blue Gradient) */
.tip-card-google {
    background: var(--google-blue);
    padding: 24px;
    border-radius: var(--google-radius);
    color: white;
    box-shadow: 0 4px 20px rgba(255, 196, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.tip-glow-google {
    position: absolute;
    bottom: -16px;
    right: -16px;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transition: transform 0.5s ease;
}

.tip-card-google:hover .tip-glow-google {
    transform: scale(1.5);
}

.tip-content-google {
    position: relative;
    z-index: 2;
}

.tip-title-google {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: white;
}

.tip-text-google {
    font-size: 0.875rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.tip-text-google b {
    color: white;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 992px) {
    .overview-google-grid {
        grid-template-columns: 1fr;
    }

    .stats-row-google {
        grid-template-columns: 1fr;
    }
}

/* ================================================
   GOOGLE-STYLE THEME CONTAINER
   ================================================ */
.classroom-google-theme {
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

/* ================================================
   GOOGLE-STYLE HEADER
   ================================================ */
.header-card-google {
    background: var(--google-card-bg);
    border-radius: var(--google-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
    position: relative;
    overflow: hidden;
}

.header-glow-google {
    position: absolute;
    top: -80px;
    right: -80px;
    width: 200px;
    height: 200px;
    background: var(--google-blue-light);
    border-radius: 50%;
    z-index: 0;
}

.header-content-google {
    position: relative;
    z-index: 1;
}

.header-subject-google {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--google-blue);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.header-icon-google {
    width: 16px;
    height: 16px;
}

.header-title-google {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--google-text-primary);
    margin: 0 0 1rem 0;
    letter-spacing: -0.5px;
}

.class-code-badge-google {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-card);
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--google-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s;
}

.class-code-badge-google:hover {
    border-color: var(--google-blue);
}

.code-label-google {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--google-text-secondary);
}

.code-value-google {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--google-blue);
}

/* ================================================
   GOOGLE-STYLE NAVIGATION TABS
   ================================================ */
.nav-tabs-google {
    display: flex;
    gap: 2.5rem;
    border-bottom: 1px solid var(--google-border);
    padding: 0 1rem;
    margin-bottom: 1.5rem;
}

.nav-tab-google {
    cursor: pointer;
    padding-bottom: 1rem;
    border-bottom: 3px solid transparent;
    color: var(--google-text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-tab-google:hover {
    color: var(--google-blue);
}

.nav-tab-active-google {
    border-bottom-color: var(--google-blue);
    color: var(--google-blue);
    font-weight: 700;
}

.tab-badge-google {
    margin-left: 6px;
    background: var(--bg-tertiary);
    color: var(--google-text-secondary);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

/* ================================================
   GOOGLE-STYLE STUDENTS TAB
   ================================================ */
.students-card-google {
    background: var(--google-card-bg);
    border-radius: var(--google-radius);
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
    overflow: hidden;
}

.students-toolbar-google {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--google-border);
    flex-wrap: wrap;
}

.search-box-google {
    position: relative;
    width: 100%;
    max-width: 384px;
}

.search-icon-google {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--google-text-secondary);
}

.search-input-google {
    width: 100%;
    padding: 12px 16px 12px 42px;
    background: var(--input-bg);
    border: 1px solid var(--google-border);
    border-radius: 12px;
    font-size: 0.875rem;
    color: var(--google-text-primary);
    outline: none;
    transition: all 0.2s;
}

.search-input-google:focus {
    border-color: var(--google-blue);
    box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.1);
}

.btn-primary-google {
    background: var(--google-blue);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-google:hover {
    background: #1557b0;
}

.table-wrapper-google {
    overflow-x: auto;
}

.table-google {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
}



.table-google th {
    padding: 1rem 1.5rem;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--google-text-secondary);
}

.table-google th.text-right {
    text-align: right;
}

.table-google tbody tr {
    border-top: 1px solid var(--google-border);
    transition: background 0.15s;
}

.table-google tbody tr:hover {
    background: transparent;
}

.table-google td {
    padding: 1.25rem 1.5rem;
    font-size: 0.875rem;
    color: var(--google-text-primary);
}

/* Student Avatar */
.student-avatar-google {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--google-blue-light);
    color: var(--google-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Status Badge */
.status-badge-google {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-ontrack-google {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-atrisk-google {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Score progress bar */
.score-bar-google {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-value-google {
    font-weight: 700;
    font-size: 0.875rem;
}

.score-track-google {
    width: 80px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
}

.score-fill-google {
    height: 100%;
    background: var(--google-blue);
    border-radius: 999px;
}

/* ================================================
   GOOGLE-STYLE ANALYTICS TAB
   ================================================ */
.analytics-google-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.analytics-google-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.analytics-google-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chart-card-google {
    background: var(--google-card-bg);
    padding: 2rem;
    border-radius: var(--google-radius);
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
}

.chart-tall-google {
    height: 288px;
}

.quiz-card-google {
    background: var(--google-card-bg);
    padding: 1.5rem;
    border-radius: var(--google-radius);
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
}

.quiz-title-google {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--google-text-primary);
    margin: 0 0 1rem 0;
}

.quiz-item-google {
    margin-top: 1rem;
}

.quiz-header-google {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--google-text-secondary);
    margin-bottom: 8px;
}

.quiz-complete-google {
    color: var(--google-green);
}

.quiz-bar-google {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
}

.quiz-fill-google {
    height: 100%;
    background: var(--google-green);
    border-radius: 999px;
}

/* Leaderboard */
.leaderboard-card-google {
    background: var(--google-card-bg);
    padding: 1.5rem;
    border-radius: var(--google-radius);
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
}

.leaderboard-list-google {
    margin-top: 1rem;
}

.leaderboard-item-google {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--google-border);
}

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

.leaderboard-name-google {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--google-text-secondary);
}

.leaderboard-score-google {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--google-blue);
}

/* ================================================
   GOOGLE-STYLE ATTENDANCE TAB
   ================================================ */
.attendance-card-google {
    background: var(--google-card-bg);
    border-radius: var(--google-radius);
    border: 1px solid var(--google-border);
    box-shadow: var(--google-shadow);
    overflow: hidden;
}

.attendance-header-google {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--nav-active-bg);
    border-bottom: 1px solid var(--google-border);
}

.attendance-title-google {
    font-size: 1rem;
    font-weight: 700;
    color: var(--google-text-primary);
    margin: 0;
}

.attendance-avg-google {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--google-text-secondary);
}

.attendance-table-google {
    width: 100%;
    text-align: center;
    border-collapse: collapse;
}

.attendance-table-google thead {
    border-bottom: 1px solid var(--google-border);
}

.attendance-table-google th {
    padding: 1rem;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--google-text-secondary);
}

.attendance-table-google th.text-left {
    text-align: left;
    padding-left: 2rem;
}

.attendance-table-google th.col-name {
    width: 200px;
}

.attendance-table-google tbody tr {
    border-top: 1px solid var(--google-border);
}

.attendance-table-google td {
    padding: 1.25rem 1rem;
    font-size: 0.875rem;
}

.attendance-table-google td:first-child {
    text-align: left;
    padding-left: 2rem;
}

/* Attendance Status Bubbles */
.status-dot-google {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.status-p-google {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-a-google {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-l-google {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fef08a;
}

.attendance-score-google {
    font-weight: 700;
    color: var(--google-text-secondary);
}

/* Responsive for new sections */
@media (max-width: 992px) {
    .analytics-google-grid {
        grid-template-columns: 1fr;
    }

    .students-toolbar-google {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box-google {
        max-width: 100%;
    }

    .nav-tabs-google {
        gap: 1.5rem;
        overflow-x: auto;
    }
}

/* Upgrade Modal Styles - Refined to match Settings Popup Aesthetics */

/* Reset previously injected modal styles if any, and specialize for upgrade */
.upgrade-modal {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    background-color: var(--sidebar-bg) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.upgrade-modal-body {
    padding: 60px 40px;
    overflow-y: auto;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.pricing-header {
    text-align: center;
    margin-bottom: 40px;
}

.pricing-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.pricing-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Toggle Switch - Match settings toggle pattern if possible, or keep as is but refined */
.pricing-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 30px 0 40px;
    font-weight: 600;
}

.pricing-toggle-container .active {
    color: var(--text-primary);
}

.pricing-toggle-container span:not(.active) {
    color: var(--text-faded);
}

.discount-badge {
    background: var(--accent);
    color: #000000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 50px;
    margin-left: 5px;
}

.pricing-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.pricing-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pricing-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--input-bg);
    transition: 0.3s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.pricing-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    transition: 0.3s;
    border-radius: 50%;
}

input:checked+.pricing-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

input:checked+.pricing-slider:before {
    transform: translateX(24px);
    background-color: #000000;
}

/* Grid and Cards - Match tool-card style */
.upgrade-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 5px;
}

.upgrade-plan-card {
    background: var(--input-main-bg);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 12px;
    /* Match tool-card */
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.upgrade-plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--text-faded);
}

.upgrade-plan-card.featured {
    border-color: var(--accent);
    background: var(--input-main-bg);
    /* Keep base background to feel "native" */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.plan-badge-top {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent);
    color: #000000;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-name {
    font-size: 1.25rem;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    min-height: 40px;
    line-height: 1.5;
}

.plan-price-large {
    margin-bottom: 30px;
    display: flex;
    align-items: baseline;
}

.price-currency {
    font-size: 1.25rem;
    font-weight: 600;
    margin-right: 2px;
}

.price-amount-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.price-period {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-left: 4px;
}

/* Features List */
.plan-features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    flex-grow: 1;
}

.feature-item {
    margin-bottom: 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.feature-item i {
    font-size: 14px;
    color: var(--accent);
}

.feature-item.disabled {
    opacity: 0.4;
    text-decoration: line-through;
}

/* Buttons - Match settings-btn pattern */
.upgrade-action-btn {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upgrade-action-btn.primary {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.upgrade-action-btn.primary:hover {
    background-color: var(--nav-active-bg);
}

.upgrade-action-btn.secondary {
    background-color: var(--accent);
    color: #000000;
}

.upgrade-action-btn.secondary:hover {
    background-color: var(--accent-hover, #ffca2c);
    transform: scale(1.02);
}

.upgrade-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.upgrade-footer-note {
    margin-top: 30px;
    font-size: 0.85rem;
    color: var(--text-faded);
    text-align: center;
}

/* Animations - Match settings modal */
@keyframes modal-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .upgrade-modal-body {
        padding: 24px;
    }

    .pricing-header h1 {
        font-size: 2rem;
    }

    .upgrade-plans-grid {
        grid-template-columns: 1fr;
    }
}

/* How to Study Base Styles - Theme Refined */

.how-to-study-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 0;
    box-sizing: border-box;
    background-color: transparent;
    z-index: 10;
    position: relative;
    overflow: hidden;
}

.how-to-study-full-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    box-sizing: border-box;
    margin: 0;
    flex: 1;
}

/* Premium FAB - Matching Classroom */
.how-to-study-fab-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
}

.how-to-study-fab-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--classroom-primary, #facc15);
    color: #000000;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.how-to-study-fab-btn:hover {
    transform: scale(1.1);
}

.how-to-study-fab-btn svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5px;
}

/* Glassmorphism Modal - Matching Classroom Redesign */
.how-to-study-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.how-to-study-modal {
    background: var(--tool-bg, #161616);
    /* Matches --classroom-surface-elevated */
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.3s ease-out;
    overflow: hidden;
    color: var(--text-primary, #fff);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.how-to-study-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.how-to-study-modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0;
}

.how-to-study-modal-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary, #9ca3af);
    margin: 2px 0 0 0;
}

.how-to-study-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary, #ccc);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.how-to-study-modal-close:hover {
    color: #fff;
}

.how-to-study-modal-form {
    padding: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.flex-1 {
    flex: 1;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, rgba(255, 255, 255, 0.5));
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 0.5rem;
}

.form-select,
.form-input {
    width: 100%;
    padding: 12px;
    background: var(--surface-card, #1f1f1f);
    /* Matches --classroom-surface */
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    color: var(--text-primary, #fff);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.form-select:focus,
.form-input:focus {
    border-color: var(--classroom-primary, #facc15);
    background: var(--bg-active, #252525);
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.1);
}

/* Force dark appearance for system dropdowns */
.form-select {
    color-scheme: dark;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary {
    background: var(--classroom-primary, #facc15);
    color: #000000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(250, 204, 21, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary, #fff);
    /* Logic from createClass styles */
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: var(--text-secondary);
}

@media (max-width: 480px) {
    .how-to-study-modal {
        width: 95%;
    }

    .how-to-study-modal-form {
        padding: 1.5rem;
    }

    .date-range-row {
        flex-direction: column;
    }
}

/* --- Plan Ready Card --- */
.plan-ready-card {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--tool-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 150;
    /* Above FAB */
    animation: slideUpCard 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 320px;
}

@keyframes slideUpCard {
    from {
        transform: translate(-50%, 100px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.plan-ready-content h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.plan-ready-content p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
}

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


/* --- Roadmap Modal Specifics --- */
.roadmap-modal-content {
    max-width: 1000px;
    height: 90vh;
    /* Fixed height relative to viewport */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Ensure rounded corners */
}

.roadmap-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Contain scroll area */
    background: var(--main-bg);
    min-height: 0;
    /* Crucial for nested flex scrolling */
}

.roadmap-controls {
    flex-shrink: 0;
    /* Prevent shrinking */
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: center;
}

.view-toggle {
    display: flex;
    background: var(--bg-active);
    padding: 4px;
    border-radius: 12px;
}

.view-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.view-btn.active {
    background: var(--tool-bg);
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timeline-scroll-area {
    flex: 1;
    overflow-y: auto;
    /* Enable scrolling here */
    padding: 2rem;
    position: relative;
    background: var(--main-bg);
}

/* --- Timeline Styles --- */
.timeline-wrapper {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    padding: 20px 0;
    min-height: 200px;
    /* Ensure at least some height */
}

/* Vertical Center Line */
.timeline-wrapper::after {
    content: '';
    position: absolute;
    width: 2px;
    background-color: var(--border-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1px;
    z-index: 1;
}

.day-row {
    padding: 20px 0;
    position: relative;
    width: 50%;
    z-index: 2;
}

.day-row.left {
    left: 0;
    padding-right: 50px;
    text-align: right;
}

.day-row.right {
    left: 50%;
    padding-left: 50px;
    text-align: left;
}

.dot {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: var(--tool-bg);
    border: 3px solid var(--accent);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot::after {
    content: '';
    width: 10px;
    height: 10px;
    background-color: var(--accent);
    border-radius: 50%;
}

.day-row.left .dot {
    right: -12px;
}

.day-row.right .dot {
    left: -12px;
}

.timeline-card {
    background: var(--tool-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    display: inline-block;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    text-align: left;
    position: relative;
    transition: transform 0.2s;
}

.timeline-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.timeline-card.active {
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(250, 204, 21, 0.1);
}

.date-pill {
    display: inline-block;
    background: var(--bg-active);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.timeline-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.timeline-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

/* --- Compact View --- */
.timeline-wrapper.compact-view::after {
    left: 30px;
}

.compact-view .day-row {
    width: 100%;
    left: 0;
    padding-left: 70px;
    padding-right: 0;
    text-align: left;
}

.compact-view .day-row.left {
    text-align: left;
    padding-right: 0;
}

.compact-view .dot {
    left: 18px;
    right: auto;
}

.compact-view .timeline-card {
    max-width: 100%;
    padding: 16px;
}

.compact-view .timeline-card p {
    display: none;
}

.compact-view h3 {
    margin-bottom: 0;
    font-size: 1rem;
}

.compact-view .date-pill {
    margin-bottom: 4px;
    font-size: 0.7rem;
}

@media (max-width: 768px) {
    .timeline-wrapper::after {
        left: 30px;
    }

    .day-row {
        width: 100%;
        left: 0;
        padding-left: 70px;
        padding-right: 20px;
        text-align: left;
    }

    .day-row.left {
        text-align: left;
        padding-right: 20px;
    }

    .dot {
        left: 18px !important;
        right: auto !important;
    }
}

/* --- Saved Roadmaps Grid --- */
.saved-roadmaps-section {
    padding: 2rem;
    max-width: 1200px;
    margin: 0;
    /* Align left */
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Force content to top */
    align-items: flex-start;
    /* Force items to start left */
    width: 100%;
}

.roadmaps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: transparent;
    /* Remove border/bg for cleaner centered look? Or keep it? User image shows it. Let's keep it but center it. */
    background: var(--tool-bg);
    border-radius: 16px;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    margin: auto;
    /* This centers it vertically and horizontally in the flex container */
    max-width: 400px;
    width: 100%;
}

.roadmap-card {
    background: var(--tool-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.roadmap-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.roadmap-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.roadmap-subject-pill {
    background: var(--bg-active);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.roadmap-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.roadmap-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.roadmap-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
}

.roadmap-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: auto;
}

.roadmap-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--tool-bg);
    border-radius: 16px;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    margin: auto;
    max-width: 400px;
    width: 100%;
    font-size: 1.25rem;
    /* Larger text */
    font-weight: 500;
}

/* Podcast Module - Strict Theme Adherence */

/* Main Container */
.podcast-container {
    padding: 32px 40px;
    height: 100%;
    overflow-y: auto;
    background: transparent;
    /* Inherits main-bg usually */
    color: var(--text-primary);
    font-family: inherit;
}

/* Header Section */
.podcast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.podcast-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

/* Podcast List Grid */
.podcast-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Cards */
.podcast-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    /* Subtle shadow consistent with system */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.podcast-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.podcast-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
    color: var(--text-primary);
}

.podcast-card-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.podcast-card-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.podcast-card-date {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.mindmap-action-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mindmap-action-btn:hover {
    background: var(--bg-tertiary);
    color: #ef4444;
    /* Keep red for delete as semantic warning */
}

/* Player Interface */
.podcast-audio-player-container {
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.podcast-audio-header {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    align-items: center;
}

.podcast-audio-artwork {
    width: 120px;
    height: 120px;
    /* Neutral background instead of gradient */
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.podcast-audio-info {
    flex: 1;
}

.podcast-audio-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.2;
    color: var(--text-primary);
}

.podcast-audio-hosts {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    /* System accent */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.podcast-audio-desc {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Native Audio */
.podcast-audio-controls {
    background: var(--surface-card);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    /* Soft shadow */
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
}

audio {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    outline: none;
}

/* Transcript Toggle */
.podcast-script-toggle {
    text-align: center;
    margin-bottom: 24px;
}

.podcast-script-toggle button {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.podcast-script-toggle button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-secondary);
    cursor: pointer;
}

/* Chat Transcript */
.podcast-script-panel {
    background: transparent;
    border: none;
    padding: 0;
}

.podcast-transcript {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 40px;
}

.podcast-turn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: slideUp 0.3s ease-out;
}

.podcast-turn.speaker-sam {
    align-self: flex-start;
}

.podcast-turn.speaker-alex {
    align-self: flex-end;
    align-items: flex-end;
}

.podcast-speaker-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-left: 12px;
    margin-right: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.podcast-bubble {
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Speaker 1 (Sam): System Secondary Background */
.podcast-turn.speaker-sam .podcast-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid transparent;
}

/* Speaker 2 (Alex): System Accent Color */
.podcast-turn.speaker-alex .podcast-bubble {
    background: var(--accent);
    /* For standard dark theme accent (#FFC400), text should be black for contrast. 
       For light theme accent (#FFC400), same. 
       If accent was blue/dark, text should be white. 
       The system seems to use var(--accent) as a yellow/gold. 
       Let's assume default text color on accent might need adjustment or is handled globally. 
       Looking at style.css, --accent is Yellow. Black text is legible.
    */
    color: #000000;
    /* Force black text on Yellow accent for readability */
    border-bottom-right-radius: 4px;
}

/* Responsive */
@media (max-width: 600px) {
    .podcast-audio-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }

    .podcast-container {
        padding: 16px;
    }

    .podcast-audio-title {
        font-size: 20px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}