* {
    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;
}

/* Light Theme */
body[data-theme="light"] {
    --sidebar-bg: #F9F9F9;
    /* Crisp white sidebar */
    --main-bg: #FCFCFC;
    /* 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 */

    /* 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;
    --accent-hover: #7DA3FF;
}

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

    background-color: var(--main-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;

    -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;
}

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

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

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

.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: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background-color: var(--input-bg);
}

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

.login-header-btn {
    background: transparent;
    color: var(--text-primary);
}

.login-header-btn:hover {
    background-color: var(--input-bg);
}

.signup-header-btn {
    background: var(--accent);
    color: white;
}

.signup-header-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* 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;
    width: 100vw;
    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: 20px;
    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;
    margin-bottom: 32px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    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(--nav-active-bg);
    color: var(--text-primary);
}

.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: var(--input-bg, rgba(255, 255, 255, 0.05)) !important;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2)) !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
    color: var(--text-primary) !important;
    font-size: inherit !important;
    font-family: inherit !important;
    outline: none !important;
    margin: 0 !important;
    min-width: 0 !important;
    width: 100% !important;
}

.history-item-rename-input:focus {
    border-color: var(--primary-color, #4a9eff) !important;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2) !important;
}

.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 {
    display: none;
}

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

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


body:not(.user-logged-in) #curriculumBtn {
    display: none !important;
}

body.user-logged-in #curriculumBtn {
    display: inline-flex !important;
}

.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: 8px 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);
}

.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 20px 60px rgba(0, 0, 0, 0.3);
    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;
    }

    .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;
    }

    /* Fix attach dropdown positioning on mobile */
    .attach-dropdown-menu {
        /* 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;
    }

    /* 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 */
    html {
        height: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
    }

    body {
        height: 100% !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow: hidden !important;
        position: relative;
    }

    .app-container {
        height: 100vh !important;
        width: 100vw !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;
        margin-left: -15px !important;
    }

    /* Fix centering for logged-in users on mobile */
    body.user-logged-in .app-container {
        margin-left: -15px !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;
        background-color: rgba(0, 0, 0, 0.5);
        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(--avatar-blue);
    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(--avatar-blue);
    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-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-upload-zone,
.memorize-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,
.memorize-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,
.memorize-upload-zone:hover,
.memorize-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,
.memorize-upload-zone:hover::before,
.memorize-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,
.memorize-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;
        }

        @media (max-width: 600px) {
            .teachme-cards-grid {
                grid-template-columns: 1fr;
            }
        }

        .teachme-curriculum-card {
            display: flex;
            align-items: center;
            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;
    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;
}

/* 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: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background-color: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    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: 100%;
    transform: none;
    margin-left: 0;
    margin-top: 5px;
}

/* 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;
    fontWeight: 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;
}

