* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    -webkit-touch-callout: none; /* Disable callout on long-press */
}

:root {
    --bg-primary: #fafbfb;  /* Subtle teal-gray tint instead of pure white */
    --bg-secondary: #f3f7f6; /* Light teal-tinted gray */
    --bg-sidebar: #f6f9f8;  /* Slightly teal-tinted sidebar */
    --bg-hover: #e8f0ee;    /* Teal-tinted hover state */
    --text-primary: #1a2e2a; /* Darker teal-influenced text */
    --text-secondary: #5a6b68;
    --text-tertiary: #8a9996;
    --border-color: #d8e5e2; /* Soft teal-gray border */
    --accent-color: #10a37f;
    --user-bubble: linear-gradient(135deg, #10a37f 0%, #0d8968 100%);
    --assistant-bubble: #f0f5f4; /* Light teal-tinted assistant bubble */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --message-hover: rgba(16, 163, 127, 0.02);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1f1e;  /* Dark with subtle teal undertone */
        --bg-secondary: #141817; /* Darker teal-black */
        --bg-sidebar: #161a19;   /* Dark teal-tinted sidebar */
        --bg-hover: #243330;     /* Teal-tinted hover for dark mode */
        --text-primary: #e8f0ee;
        --text-secondary: #9fb5af;
        --text-tertiary: #6a7975;
        --border-color: #2a3633; /* Dark teal-gray border */
        --assistant-bubble: #1f2625; /* Dark teal-tinted bubble */
        --message-hover: rgba(16, 163, 127, 0.05);
    }
}


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    margin: 0;
    padding: 0;
    /* Enable pull-to-refresh */
    overscroll-behavior-y: auto;
}

/* Remove tap highlight from all buttons and interactive elements */
button, 
a, 
input, 
textarea, 
select {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    outline: none;
}

/* Ensure focus styles are still visible for accessibility */
button:focus-visible,
a:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Remove focus outline from text inputs and textareas */
input:focus-visible,
textarea:focus-visible,
input:focus,
textarea:focus {
    outline: none;
}

.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    width: 100%;
}

/* Sidebar Styles */
.sidebar {
    width: 60px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    position: relative;
}

.sidebar.expanded {
    width: 260px;
}

/* Default collapsed state styles */
.sidebar .btn-text,
.sidebar .conv-text {
    display: none;
}

.sidebar.expanded .btn-text,
.sidebar.expanded .conv-text {
    display: inline;
}

.sidebar .new-chat-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    align-items: center;
    min-width: 36px;
}

.sidebar.expanded .new-chat-btn {
    width: auto;
    flex: 1;
    padding: 12px 16px;
    justify-content: flex-start;
}

.sidebar .new-chat-btn svg {
    margin: 0;
}

.sidebar.expanded .new-chat-btn svg {
    margin-right: 12px;
}

.sidebar .conversation-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.expanded .conversation-item {
    justify-content: flex-start;
    padding: 12px 16px;
}

.sidebar .user-account-btn {
    justify-content: center;
    padding: 8px;
    min-height: 44px;
}

.sidebar.expanded .user-account-btn {
    justify-content: flex-start;
    padding: 12px 16px;
}

.sidebar .user-account-btn i {
    margin: 0;
}

.sidebar.expanded .user-account-btn i {
    margin-right: 12px;
}

.sidebar .sidebar-header {
    padding: 12px 12px;
    justify-content: center;
    flex-direction: column-reverse;
    gap: 8px;
}

.sidebar.expanded .sidebar-header {
    padding: 12px;
    flex-direction: row;
}

.sidebar .sidebar-collapse-btn {
    width: 36px;
    height: 36px;
}

.sidebar .conversations-list {
    padding: 8px 12px;
}

.sidebar.expanded .conversations-list {
    padding: 8px;
}

.sidebar .sidebar-footer {
    padding: 12px;
}

.sidebar.expanded .sidebar-footer {
    padding: 12px;
}

.sidebar-header {
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.new-chat-btn {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
    min-height: 36px;
}

.sidebar-collapse-btn,
.sidebar-close-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.sidebar-collapse-btn:hover,
.sidebar-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-collapse-btn i,
.sidebar-close-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.sidebar-close-btn {
    display: none;
}

.sidebar-close-btn i {
    font-size: 18px;
}

/* Desktop only elements */
.desktop-only {
    display: flex;
}

.mobile-only {
    display: none;
}


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

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    padding: 12px 16px;
    padding-right: 40px; /* Make room for delete button */
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    min-height: 40px;
    position: relative; /* For delete button positioning */
}

/* Prevent text overflow - add ellipsis for long conversation names */
.conversation-item .conv-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 40px); /* Account for delete button space */
    padding-right: 5px; /* Add small padding to prevent touching delete button */
}

.sidebar:not(.expanded) .conversation-item {
    padding: 8px;
    justify-content: center;
    min-height: 40px;
}

.sidebar:not(.expanded) .conversation-item svg {
    margin: 0;
}

.sidebar:not(.expanded) .conv-delete-btn {
    display: none !important;
}

.conversation-item:hover {
    background: var(--bg-hover);
}

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

/* Conversation delete button */
.conv-delete-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 2; /* Ensure button stays above text */
}

.conversation-item:hover .conv-delete-btn {
    opacity: 0.7;
}

.conversation-item .conv-delete-btn:hover {
    opacity: 1;
}

.conv-delete-btn:hover {
    background: rgba(255, 82, 82, 0.1);
    color: #ff5252;
}

.conv-delete-btn i {
    font-size: 12px;
}

/* No conversations placeholder */
.no-conversations {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    transition: all 0.3s ease;
}

.no-conversations i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.no-conversations p {
    font-size: 14px;
    transition: all 0.3s ease;
}

/* Collapsed sidebar - hide no conversations placeholder completely */
.sidebar:not(.expanded) .no-conversations {
    display: none;
}

.sidebar-footer {
    padding: 12px;
}

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

.user-account-btn:hover {
    background: var(--bg-hover);
}

.user-account-btn i {
    font-size: 20px;
    color: var(--text-secondary);
}

.user-greeting {
    padding: 8px 12px;
    background: var(--bg-hover);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.greeting-text {
    color: var(--text-secondary);
}

.user-name {
    color: var(--text-primary);
    font-weight: 500;
}


/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    /* height and overflow properties removed to fix corner overflow */
    -webkit-overflow-scrolling: touch; /* Enable momentum scrolling on iOS */
}

/* Main Header */
.main-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    min-height: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    z-index: 100;
    padding: 0 20px;
    background: var(--bg-primary);
    box-shadow: 0 0.5px 0 0 rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.logo-container:hover .header-logo {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(56%) sepia(39%) saturate(1418%) hue-rotate(122deg) brightness(100%) contrast(87%);
}

.logo-container:hover .logo-text {
    opacity: 1;
}

.header-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
    transform: translateY(-2px);
    opacity: 0.85; /* Slightly faded */
    /* Convert white logo to brand color using CSS filters - matching send button */
    filter: brightness(0) saturate(100%) invert(56%) sepia(39%) saturate(1418%) hue-rotate(122deg) brightness(95%) contrast(87%);
}

.logo-text {
    font-size: 17px; /* Reduced from 20px */
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95); /* Clean white */
    opacity: 1;
    margin: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    letter-spacing: 1px; /* Professional letter spacing */
    font-family: 'Inter', 'SF Pro Display', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif; /* Modern professional font stack */
    text-transform: uppercase; /* Makes it look more like a logo */
    font-feature-settings: 'kern' 1; /* Better kerning */
}

/* Mobile user menu button */
.mobile-user-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 4px 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0;
    position: relative;
}

.mobile-user-menu-btn:hover {
    color: var(--text-primary);
}

.mobile-user-menu-btn i {
    font-size: 12px;
}

/* Hide mobile dropdown on desktop */
.mobile-user-dropdown {
    display: none;
}

/* Simple navbar buttons - HIDDEN - Login moved to 3-dot menu */
.auth-buttons-container {
    display: none !important; /* Login/signup now in 3-dot menu */
}

/* No need for special chat view spacing since share is in menu */
.auth-buttons-container.in-chat-view {
    /* Uses same spacing as homepage */
}

.header-auth-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.header-auth-btn i {
    font-size: 14px;
}

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

.login-btn:hover {
    background: var(--bg-hover);
    opacity: 1;
}

.signup-btn {
    background: var(--accent-color);
    color: white;
    border: 1px solid var(--accent-color);
}

.signup-btn:hover {
    background: #0e9571;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    opacity: 1;
}

/* Hide text on mobile */
@media (max-width: 768px) {
    /* Slightly increase base font size for better readability */
    body {
        font-size: 15px; /* Slightly larger than desktop */
    }
    
    /* Enable pull-to-refresh on mobile */
    body {
        overflow-y: auto !important;
        overscroll-behavior-y: auto !important;
    }
    
    .main-container {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: auto !important;
    }
    
    /* Model dropdown menu positioning on mobile */
    .custom-model-dropdown-menu {
        bottom: calc(100% + 4px) !important; /* Closer to button */
        top: auto !important;
        max-height: 350px !important; /* Increased height on mobile */
    }
    
    /* Attach menu positioning on mobile - align with model selector */
    .attach-menu {
        bottom: calc(100% + 4px) !important; /* Same spacing as model dropdown */
    }
    
    .header-auth-btn span {
        display: none;
    }
    
    .header-auth-btn {
        padding: 8px 10px;
    }
    
    /* Hide signup button on mobile */
    .signup-btn {
        display: none;
    }
    
    /* Auth buttons removed - Login/signup now in 3-dot menu */
    
    /* Ensure 3-dot menu matches hamburger size */
    .main-menu-button {
        top: 9px !important; /* Center in 50px header: (50-32)/2 = 9px */
        right: 12px !important; /* Match header padding for symmetry */
        width: 32px !important; /* Reduced size */
        height: 32px !important; /* Reduced size */
        font-size: 14px !important; /* Smaller icon size */
        padding: 0 !important; /* Remove any padding */
    }
    
    /* Increase input and textarea sizes */
    .hero-message-input,
    .message-input {
        font-size: 16px !important; /* Larger for better readability */
        line-height: 1.5;
        padding: 12px 0; /* More padding */
    }
    
    /* Larger send buttons */
    .hero-send-button,
    .send-button {
        width: 38px !important;
        height: 38px !important;
        font-size: 18px !important;
    }
    
    /* Larger attach and model buttons */
    .attach-button {
        width: 36px !important;
        height: 36px !important;
    }
    
    .model-button-mobile {
        width: 38px !important;
        height: 38px !important;
    }
    
    .chat-header {
        top: 12px !important; /* Align with other buttons */
        right: 100px !important; /* Adjusted for new login button position */
    }
    
    .main-menu-dropdown {
        top: 50px !important;
        right: 10px !important;
        min-width: 160px !important;
    }
    
    /* Increase message bubble text size on mobile */
    .message-bubble {
        font-size: 15px !important; /* Slightly larger text */
        line-height: 1.6; /* Better line spacing */
        padding: 12px 16px; /* More padding */
    }
    
    /* Larger conversation list items */
    .conversation-item {
        padding: 14px 16px !important;
        font-size: 15px !important;
    }
    
    /* Larger modal text */
    .custom-model-dropdown-item {
        padding: 10px 14px !important;
        font-size: 14px !important;
    }
    
    .attach-menu-item {
        padding: 12px 14px !important;
        font-size: 15px !important;
    }
}

/* Hide signup button on all screens */
.signup-btn {
    display: none !important;
}

.greeting-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

/* User dropdown menu */
.user-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.user-menu-btn:hover {
    color: var(--text-primary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 170px;
    display: none;
    z-index: 1000;
    padding: 6px 0;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 14px;
}

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

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

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

.logout-item {
    color: var(--error-color) !important;
}

.logout-item i {
    color: var(--error-color) !important;
}

/* 3-dot menu button - rightmost position */
.main-menu-button {
    position: fixed;
    top: 12px;
    right: 15px; /* Adjusted for better spacing */
    z-index: 1000;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
    border-radius: 8px;
    padding: 0; /* Remove padding */
}

.main-menu-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.main-menu-button i {
    font-size: 16px;
}

/* Two dots menu for mobile */
.two-dots {
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.two-dots .dot {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.main-menu-button:hover .two-dots .dot,
.main-menu-button.active .two-dots .dot {
    background: var(--accent-color);
}

/* 3-dot menu dropdown */
.main-menu-dropdown {
    position: fixed;
    top: 55px;
    right: 15px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 170px;
    display: none;
    z-index: 1001;
    padding: 6px 0;
}

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

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

.main-menu-dropdown .menu-item:hover {
    background: var(--bg-hover);
}

.main-menu-dropdown .menu-item i {
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

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

/* Mobile menu toggle - hidden on desktop */
.mobile-menu-toggle {
    display: none;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-right: 8px;
    border-radius: 50%; /* Circle shape */
    position: relative;
    padding: 0;
    opacity: 0.7;
}

/* Dark round background behind the icon */
.mobile-menu-toggle::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.3); /* Lighter dark background */
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%); /* Center perfectly */
    transition: background 0.3s ease;
    z-index: 0;
}

.mobile-menu-toggle:hover {
    opacity: 0.9;
}

.mobile-menu-toggle.active::before {
    background: rgba(0, 0, 0, 0.5); /* Darker when active */
}


/* Logo icon for sidebar toggle */
.sidebar-logo-icon {
    width: 12px; /* Even smaller for 32px button */
    height: 12px; /* Even smaller for 32px button */
    object-fit: contain;
    /* Make it white */
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
    opacity: 1;
    position: relative;
    z-index: 2; /* Above both stars and dark circle */
}

.mobile-menu-toggle.active .sidebar-logo-icon {
    /* Keep white when active */
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
    opacity: 1;
}

/* Remove hamburger lines - no longer needed */
.hamburger-line {
    display: none;
}

/* Simple 2-line hamburger style - adjusted for 32px button */
.hamburger-line:nth-child(1) {
    top: 12px; /* Adjusted for 32px height */
    left: 8px; /* Centered for 32px width */
    width: 16px; /* Keep same width */
}

.hamburger-line:nth-child(2) {
    display: none; /* Hide middle line for 2-line style */
}

.hamburger-line:nth-child(3) {
    bottom: 12px; /* Adjusted for 32px height */
    left: 8px; /* Centered for 32px width */
    width: 8px; /* Half width for second line */
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}


/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto; /* Enable scrolling */
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    margin-top: 0;
}

/* Scrollbar styles for whole screen */
.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Welcome/Hero View */
.welcome-view {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 10px;
    animation: fadeIn 0.5s ease;
    position: relative;
    min-height: calc(100vh - 60px - 40px); /* Subtract header height and smaller footer estimation */
    min-height: calc(100dvh - 60px - 40px);
}

.welcome-content {
    width: 100%;
    max-width: 1400px;
    text-align: center;
}

/* Desktop only - welcome content positioning */
@media (min-width: 769px) {
    .welcome-content {
        transform: translateY(-30%);
    }
}


.welcome-subtitle {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 40px;
    line-height: 1.5;
    font-weight: 400;
    opacity: 0.95;
    pointer-events: none; /* Allow clicks to pass through to elements below */
}

/* Hero Input */
.hero-input-container {
    position: relative;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto 16px auto;
    background: var(--bg-secondary);
    border: none;
    border-radius: 24px;
    padding: 8px 8px 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 
                0 1px 2px rgba(0, 0, 0, 0.04);
    z-index: 100;
}

.hero-input-container:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07), 
                0 1px 2px rgba(0, 0, 0, 0.04);
}

.hero-input-container:focus-within {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 
                0 2px 4px rgba(0, 0, 0, 0.04);
}

/* Attach button and menu styles */
.attach-wrapper {
    position: relative;
    flex-shrink: 0;
}

.attach-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 16px;
}

.attach-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.attach-button.active {
    background: var(--bg-hover);
    color: var(--accent-color);
    transform: rotate(45deg);
}

/* Attach menu dropdown */
.attach-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    min-width: 180px;
    display: none;
    z-index: 100;
}

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

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: var(--text-primary);
}

.attach-menu-item:hover:not(.disabled) {
    background: var(--bg-hover);
}

.attach-menu-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.attach-menu-item.hidden {
    display: none;
}

.attach-menu-item i {
    width: 20px;
    color: var(--text-secondary);
}

/* Image preview styles */
.image-preview-container {
    display: none;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.image-preview-container.has-images {
    display: flex;
}

.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-preview-item:hover .image-preview-remove {
    opacity: 1;
}

.image-preview-remove:hover {
    background: rgba(239, 68, 68, 0.8);
}

.hero-message-input {
    flex: 1;
    border: none;
    outline: none !important;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    background: transparent;
    color: var(--text-primary);
    max-height: 150px;
    padding: 10px 0;
}

.hero-message-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.model-button-mobile {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 6px;
    opacity: 0.9;
}

.model-button-mobile:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
    opacity: 1;
}

.mobile-model-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Hide the default select */
.model-selector-inline {
    display: none;
}

/* Custom dropdown container */
.custom-model-dropdown {
    position: relative;
    min-width: 180px;
    flex-shrink: 0;
}

.custom-model-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 30px 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
    position: relative;
    opacity: 0.9;
}

.custom-model-dropdown-trigger::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    transition: transform 0.2s ease;
}

.custom-model-dropdown.open .custom-model-dropdown-trigger::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-model-dropdown-trigger:hover {
    border-color: var(--border-color);
    background-color: var(--bg-hover);
    opacity: 1;
}

.model-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.model-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-model-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 320px;
    overflow-y: auto;
    z-index: 10000;
    display: none;
    min-width: 220px;
}

.custom-model-dropdown.open .custom-model-dropdown-menu {
    display: block;
}

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

.custom-model-dropdown-item:hover {
    background: var(--bg-hover);
}

.custom-model-dropdown-item.selected {
    background: var(--bg-hover);
    font-weight: 600;
}

.custom-model-dropdown-item .model-logo {
    width: 20px;
    height: 20px;
}

.custom-model-dropdown-item .model-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.custom-model-dropdown-item .model-label {
    font-size: 13px;
    color: var(--text-primary);
}

.custom-model-dropdown-item .model-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: auto;
}

.custom-model-dropdown-item .model-badge.free {
    background: rgba(16, 163, 127, 0.1);
    color: var(--accent-color);
}

.custom-model-dropdown-item .model-badge.pro {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.custom-model-dropdown-item .model-badge.locked {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.custom-model-dropdown-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.custom-model-dropdown-item.disabled:hover {
    background: transparent;
}

/* Hide all default scrollbars completely */
.custom-model-dropdown-menu {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.custom-model-dropdown-menu::-webkit-scrollbar {
    width: 0 !important;
    display: none !important;
}

/* For Firefox - use thin scrollbar but make it transparent */
@-moz-document url-prefix() {
    .custom-model-dropdown-menu {
        scrollbar-width: thin;
        scrollbar-color: transparent transparent;
    }
    
    .custom-model-dropdown-menu.scrolling {
        scrollbar-color: rgba(128, 128, 128, 0.3) transparent;
    }
}

/* Webkit browsers - custom minimal scrollbar */
.custom-model-dropdown-menu::-webkit-scrollbar {
    width: 3px;
}

.custom-model-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.custom-model-dropdown-menu::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

.custom-model-dropdown-menu.scrolling::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
}

.custom-model-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
}

.hero-message-input::placeholder {
    color: var(--text-tertiary);
}

.mic-button {
    display: none !important; /* Hidden for now */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 14px;
    opacity: 0.9;
}

.mic-button:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
    color: var(--text-primary);
    opacity: 1;
}

.mic-button.recording {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.hero-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #10A37F 0%, #10A37F 75%, #42A5F5 100%); /* 75% teal, 25% light blue */
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(16, 163, 127, 0.3);
}

.hero-send-button i {
    font-size: 18px;
}

.hero-send-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #0e9571 0%, #0e9571 75%, #2196F3 100%); /* Darker: 75% teal, 25% blue */
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.4);
}

.hero-send-button:disabled {
    background: linear-gradient(135deg, #10A37F 0%, #10A37F 75%, #42A5F5 100%);
    opacity: 0.3;
    color: white;
    cursor: not-allowed;
}

/* Chat View */
.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
    position: relative;
    padding-top: 60px;
}

/* Chat Header */
/* Share button - now hidden as it's moved to 3-dot menu */
.chat-header {
    display: none !important; /* Permanently hidden - moved to menu */
}


.share-button {
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
    padding: 0 12px;
    gap: 6px;
}

.share-button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.share-button i {
    font-size: 16px;
}

.share-button span {
    font-weight: 500;
}

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


/* Messages */
.message {
    padding: 16px 0;
    animation: fadeIn 0.3s ease;
}

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

.message-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
}

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

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

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

.message-bubble {
    font-size: 15px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary);
}

.message.user .message-bubble {
    background: rgba(236, 236, 241, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    .message.user .message-bubble {
        background: rgba(52, 53, 65, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

.message.assistant .message-bubble {
    padding: 0;
    background: transparent;
}

/* Code blocks in messages */
.code-block-container {
    margin: 0;
    background: #282c34;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    width: 100%;
}

/* Expand message content width for assistant messages to full width */
.message.assistant .message-content {
    max-width: 100%;
}

.code-block-container pre {
    margin: 0;
    padding: 0;
    background: transparent !important;
    overflow-x: auto;
}

.code-block-container code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    color: #abb2bf;
    background: transparent !important;
    white-space: pre !important;
    word-break: normal !important;
    word-wrap: normal !important;
    display: block;
    tab-size: 4;
    padding: 8px;
    margin: 0;
}

/* Streaming code blocks */
.code-block-container code.streaming::after {
    content: '▌';
    color: #61afef;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Override Prism styles for better integration */
.code-block-container .token.comment,
.code-block-container .token.prolog,
.code-block-container .token.doctype,
.code-block-container .token.cdata {
    color: #5c6370;
    font-style: italic;
}

.code-block-container .token.punctuation {
    color: #abb2bf;
}

.code-block-container .token.property,
.code-block-container .token.tag,
.code-block-container .token.constant,
.code-block-container .token.symbol,
.code-block-container .token.deleted {
    color: #e06c75;
}

.code-block-container .token.boolean,
.code-block-container .token.number {
    color: #d19a66;
}

.code-block-container .token.selector,
.code-block-container .token.attr-name,
.code-block-container .token.string,
.code-block-container .token.char,
.code-block-container .token.builtin,
.code-block-container .token.inserted {
    color: #98c379;
}

.code-block-container .token.operator,
.code-block-container .token.entity,
.code-block-container .token.url,
.code-block-container .language-css .token.string,
.code-block-container .style .token.string {
    color: #56b6c2;
}

.code-block-container .token.atrule,
.code-block-container .token.attr-value,
.code-block-container .token.keyword {
    color: #c678dd;
}

.code-block-container .token.function,
.code-block-container .token.class-name {
    color: #61afef;
}

.code-block-container .token.regex,
.code-block-container .token.important,
.code-block-container .token.variable {
    color: #e06c75;
}

/* Inline code */
.inline-code {
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: #e01e5a;
}

@media (prefers-color-scheme: dark) {
    .inline-code {
        background: rgba(255, 255, 255, 0.1);
        color: #79c0ff;
    }
}

/* AI Response Markdown Styling */
.ai-heading {
    font-weight: 600;
    margin: 16px 0 8px 0;
    color: var(--text-primary);
}

.ai-heading:first-child {
    margin-top: 0;
}

h1.ai-heading {
    font-size: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

h2.ai-heading {
    font-size: 20px;
}

h3.ai-heading {
    font-size: 18px;
}

.ai-bold {
    font-weight: 600;
    color: var(--text-primary);
}

.ai-italic {
    font-style: italic;
    color: var(--text-secondary);
}

.ai-list {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-list-item {
    margin: 4px 0;
    color: var(--text-primary);
}

/* AI Response Table Styling */
.ai-table-wrapper {
    margin: 12px 0;
    overflow-x: auto;
    width: 100%;
}

.ai-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.ai-table-header-row {
    background: rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    .ai-table-header-row {
        background: rgba(255, 255, 255, 0.05);
    }
}

.ai-table-header {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.ai-table-row:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
    .ai-table-row:nth-child(even) {
        background: rgba(255, 255, 255, 0.02);
    }
}

.ai-table-cell {
    padding: 10px 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

/* Action buttons for AI messages */
.message-actions {
    display: none;
    gap: 4px;
    margin-top: 8px;
    transition: opacity 0.2s ease;
}

/* Only show actions for the last assistant message */
.message.assistant.last-assistant .message-actions {
    display: flex;
    opacity: 1;
}

.message-actions button {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.message-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.message-actions button i {
    font-size: 12px;
}


.message-bubble.typing::after {
    content: '●●●';
    display: inline-block;
    margin-left: 4px;
    animation: typing 1.4s infinite;
    letter-spacing: 4px;
    font-size: 12px;
}

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Input Area */
.input-area {
    padding: 20px;
    background: var(--bg-primary);
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.input-container {
    position: relative;
    max-width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 8px 8px 8px 12px;
    gap: 12px;
    transition: all 0.2s ease;
}

.input-container:focus-within {
    border-color: var(--border-color);
}

.message-input {
    flex: 1;
    border: none;
    outline: none !important;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    background: transparent;
    color: var(--text-primary);
    max-height: 200px;
    padding: 8px 0;
}

.message-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #10A37F 0%, #10A37F 75%, #42A5F5 100%); /* 75% teal, 25% light blue */
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(16, 163, 127, 0.3);
}

.send-button i {
    font-size: 16px;
}

.send-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #0e9571 0%, #0e9571 75%, #2196F3 100%); /* Darker: 75% teal, 25% blue */
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.4);
}

.send-button:disabled {
    background: linear-gradient(135deg, #10A37F 0%, #10A37F 75%, #42A5F5 100%);
    opacity: 0.3;
    color: white;
    cursor: not-allowed;
}

.input-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

.footer-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0;
    white-space: nowrap;
    padding: 0 20px;
    max-width: 100%;
}

.important-info-link {
    color: var(--text-tertiary);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.important-info-link:hover {
    color: var(--text-secondary);
}

/* Footer text variants */
.footer-text-mobile {
    display: none;
}

.footer-text-desktop {
    display: inline;
}

/* Tablet Responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    /* Show icon button for model selector on tablets */
    .model-button-mobile {
        display: flex !important;
        width: 36px;
        height: 36px;
    }
    
    /* Hide the dropdown trigger text on tablets */
    .custom-model-dropdown .custom-model-dropdown-trigger {
        display: none !important;
    }
    
    /* Adjust dropdown position for tablets */
    .custom-model-dropdown {
        position: absolute;
        right: 85px; /* Positioned next to mic button */
        top: 0;
        min-width: 200px;
    }
    
    /* Keep dropdown menu functional */
    .custom-model-dropdown-menu {
        right: 0;
        left: auto;
        top: 40px;
    }
    
    /* Adjust hero input container for tablets */
    .hero-input-container {
        gap: 8px;
    }
}

/* Tablet Landscape specific - prevent viewport overflow */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) and (max-height: 768px) {
    .custom-model-dropdown.open .custom-model-dropdown-menu {
        position: fixed !important;
        top: 50% !important; /* Center vertically */
        transform: translateY(-50%) !important; /* Perfect center */
        bottom: auto !important;
        right: 20px !important;
        left: auto !important;
        width: 240px !important;
        max-height: 40vh !important; /* 40% of viewport height - stays within bounds */
        z-index: 9999 !important;
        overflow-y: auto;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
    }
    
    /* Ensure body doesn't scroll when dropdown is open */
    .custom-model-dropdown.open ~ * {
        overflow: hidden !important;
    }
}

/* For very small tablet landscape heights */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) and (max-height: 600px) {
    .custom-model-dropdown.open .custom-model-dropdown-menu {
        max-height: 35vh !important; /* Even smaller for very short screens */
        top: 45% !important;
    }
}

/* For smaller tablet landscape screens */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) and (max-height: 600px) {
    .custom-model-dropdown.open .custom-model-dropdown-menu {
        bottom: 60px !important;
        max-height: 100px !important;
    }
}

/* Tablet Landscape with limited height */
@media (max-width: 1024px) and (orientation: landscape) and (max-height: 600px) {
    .custom-model-dropdown.open .custom-model-dropdown-menu {
        max-height: 120px !important; /* Very reduced */
    }
}

/* Tablet Landscape with very limited height */
@media (max-width: 1024px) and (orientation: landscape) and (max-height: 500px) {
    .custom-model-dropdown.open .custom-model-dropdown-menu {
        max-height: 100px !important; /* Minimal height */
    }
}

/* Cookie Consent Banner */
.cookie-consent {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    max-width: 90%;
    width: 600px;
    display: none;
    animation: slideUp 0.3s ease-out;
}

.cookie-consent.show {
    display: block;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
}

.cookie-text i {
    font-size: 24px;
    color: var(--primary);
    flex-shrink: 0;
}

.cookie-text p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.cookie-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.cookie-text a:hover {
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cookie-accept {
    background: var(--primary);
    color: white;
}

.cookie-accept:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.cookie-reject {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

.cookie-reject:hover {
    background: var(--bg-primary);
}

/* Mobile responsive cookie banner */
@media (max-width: 768px) {
    .cookie-consent {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
        width: auto;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .cookie-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .cookie-text {
        min-width: auto;
        gap: 10px;
    }
    
    .cookie-text i {
        font-size: 20px;
    }
    
    .cookie-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .cookie-btn {
        flex: 1;
    }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998; /* Just below sidebar which is 999 */
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
        width: 260px !important;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Force full sidebar layout on mobile when open */
    .sidebar.open .btn-text,
    .sidebar.open .conv-text {
        display: inline !important;
    }
    
    .sidebar.open .new-chat-btn {
        width: auto !important;
        flex: 1 !important;
        padding: 12px 16px !important;
        justify-content: flex-start !important;
    }
    
    .sidebar.open .new-chat-btn svg {
        margin-right: 12px !important;
    }
    
    .sidebar.open .conversation-item {
        justify-content: flex-start !important;
        padding: 12px 16px !important;
        padding-right: 40px !important; /* Make room for delete button */
    }
    
    .sidebar.open .conv-delete-btn {
        display: flex !important;
        opacity: 0.7 !important; /* Always visible on mobile */
    }
    
    /* Make delete buttons always visible on mobile (no hover needed) */
    .conversation-item .conv-delete-btn {
        opacity: 0.7 !important;
        width: 32px !important;
        height: 32px !important;
        padding: 8px !important;
    }
    
    .conversation-item .conv-delete-btn:active {
        opacity: 1 !important;
        background: rgba(255, 82, 82, 0.1);
    }
    
    .conversation-item .conv-delete-btn i {
        font-size: 14px !important;
    }
    
    .sidebar.open .user-account-btn {
        justify-content: flex-start !important;
        padding: 12px 16px !important;
    }
    
    .sidebar.open .user-account-btn i {
        margin-right: 12px !important;
    }
    
    .sidebar.open .sidebar-header {
        padding: 12px !important;
        flex-direction: row !important;
        justify-content: space-between !important;
    }
    
    .sidebar.open .conversations-list {
        padding: 8px !important;
        max-height: calc(100dvh - 180px); /* Account for header and footer */
        overflow-y: auto;
    }
    
    /* Ensure sidebar content is scrollable and footer padding matches header */
    .sidebar {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .sidebar .conversations-list {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Match footer padding with header on mobile */
    .sidebar .sidebar-footer {
        padding: 12px !important; /* Same as header */
        margin-top: auto; /* Push to bottom */
    }
    
    /* Ensure sidebar flex layout on mobile */
    .sidebar.open {
        display: flex;
        flex-direction: column;
    }
    
    .sidebar.open .sidebar-footer {
        margin-top: auto; /* Stick to bottom */
        padding-bottom: 16px !important; /* Extra bottom padding for safety */
    }
    
    /* Overlay for mobile sidebar */
    .sidebar.open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 260px;
        right: 0;
        bottom: 0;
        height: 100dvh; /* Dynamic viewport height */
        background: rgba(0, 0, 0, 0.3);
        z-index: -1;
        animation: fadeIn 0.3s ease;
    }
    
    .chat-area {
        max-width: 100%;
    }
    
    /* Reduce padding on input area for more width */
    .input-area {
        padding: 10px 8px; /* Reduced from 20px */
    }
    
    /* Reduce padding on messages container for more width */
    .messages-container {
        padding: 10px; /* Reduced from 20px */
    }
    
    .suggestions-grid {
        grid-template-columns: 1fr;
    }
    
    .welcome-title {
        font-size: 36px;
    }
    
    /* Mobile prompt area adjustments */
    .hero-input-container {
        padding: 10px 8px;
        gap: 8px;
        align-items: center;
    }
    
    .hero-message-input {
        flex: 1;
        font-size: 14px;
        padding: 8px 0;
        min-width: 0;
    }
    
    .attach-button {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    /* Hide desktop model selector on mobile */
    .model-selector-inline {
        display: none !important;
    }
    
    /* Show mobile model button */
    .model-button-mobile {
        display: flex !important;
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .mic-button {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .hero-send-button {
        width: 36px;
        height: 36px;
    }
    
    /* Input container mobile adjustments */
    .input-container {
        padding: 10px 8px;
        gap: 8px;
    }
    
    .message-input {
        font-size: 14px;
    }
    
    .send-button {
        width: 30px;
        height: 30px;
    }
    
    /* Header adjustments */
    .main-header {
        left: 10px;
        right: 10px;
        min-height: 50px;
        height: 50px;
        padding: 0 12px;
        align-items: center; /* Ensure vertical centering */
    }
    
    /* Show mobile menu toggle on mobile */
    .mobile-menu-toggle {
        display: flex !important;
        width: 28px; /* Even smaller */
        height: 28px; /* Even smaller */
        padding: 0;
        background: linear-gradient(135deg, #10A37F 0%, #10A37F 75%, #42A5F5 100%); /* 75% teal, 25% light blue */
        margin-left: 0; /* Normal margin */
        margin-right: 8px;
        position: relative;
        border-radius: 50%; /* Full circle */
        align-items: center;
        justify-content: center;
        opacity: 0.7; /* Faded appearance */
        box-shadow: 0 2px 8px rgba(16, 163, 127, 0.25);
    }

    /* Dark circle background */
    .mobile-menu-toggle::before {
        content: '';
        position: absolute;
        width: 20px; /* Adjusted for 28px button */
        height: 20px; /* Adjusted for 28px button */
        background: rgba(0, 0, 0, 0.3); /* Lighter dark circle */
        border-radius: 50%;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%); /* Center perfectly */
        transition: all 0.3s ease;
        z-index: 0;
    }

    .mobile-menu-toggle:hover {
        background: linear-gradient(135deg, #0e9571 0%, #0e9571 75%, #2196F3 100%); /* Darker: 75% teal, 25% blue */
        opacity: 0.9; /* Less faded on hover */
        box-shadow: 0 4px 12px rgba(16, 163, 127, 0.35);
    }
    
    .mobile-menu-toggle.active::before {
        background: rgba(0, 0, 0, 0.5); /* Darker when active */
    }
    
    /* Hide desktop collapse button, show mobile close button */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    /* Show two-dots on mobile */
    .two-dots {
        display: flex !important;
    }
    
    /* Mobile sidebar should fully close */
    .sidebar.collapsed {
        display: none;
    }
    
    .logo-text {
        font-size: 15px; /* Reduced mobile size */
        font-weight: 500; /* Keep consistent weight */
        letter-spacing: 0.8px; /* Professional letter spacing for mobile */
        line-height: 32px; /* Match button height for vertical centering */
        transform: none; /* Remove any transform */
        /* Inherits white color and font from main style */
    }
    
    .header-logo {
        width: 24px; /* Increased from 22px */
        height: 24px; /* Increased from 22px */
        transform: none; /* Remove translateY for better alignment */
    }
    
    .logo-container {
        gap: 3px;
    }
    
    .greeting-container {
        display: none !important;
    }
    
    /* Show mobile user menu button when logged in */
    .mobile-user-menu-btn.show {
        display: inline-flex !important;
        align-items: center;
    }
    
    /* Hide desktop dropdown on mobile */
    .greeting-container .user-dropdown {
        display: none !important;
    }
    
    /* Position mobile dropdown properly */
    .mobile-user-dropdown {
        position: absolute !important;
        top: 35px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1001;
        display: none;
        min-width: 160px;
    }
    
    .mobile-user-dropdown.show {
        display: block !important;
    }
    
    /* Make logo container relative for dropdown positioning */
    .logo-container {
        position: relative;
    }
    
    /* Show mobile model button */
    .model-button-mobile {
        display: flex !important;
    }
    
    /* Position dropdown for mobile */
    .custom-model-dropdown {
        position: absolute;
        right: 50px;
        top: 0;
        min-width: 200px;
    }
    
    .custom-model-dropdown .custom-model-dropdown-trigger {
        display: none !important;
    }
    
    .custom-model-dropdown.open .custom-model-dropdown-menu {
        display: block !important;
        position: fixed;
        top: auto;
        bottom: 88px; /* Added 8px gap from button */
        right: 10px;
        left: auto;
        width: 240px;
        max-height: 400px;
        z-index: 1001;
    }
    
    .main-menu-button {
        top: 9px; /* Adjusted for 32px button: (50-32)/2 = 9px */
        right: 12px; /* Match header padding for symmetry */
        width: 32px; /* Further reduced from 36px */
        height: 32px; /* Further reduced from 36px */
        font-size: 14px; /* Reduced from 16px */
        background: transparent; /* Remove background */
        border-radius: 8px; /* Less round for cleaner look */
        box-shadow: none; /* Remove shadow */
        padding: 0; /* Remove padding */
    }
    
    .main-menu-button:hover {
        background: var(--bg-hover) !important; /* Subtle hover background */
        box-shadow: none !important; /* No shadow */
    }
    
    /* Share button mobile adjustments */
    .share-button {
        width: 32px;
        height: 32px;
        padding: 0;
        font-size: 12px;
    }
    
    .share-button span {
        display: none;
    }
    
    .share-button i {
        font-size: 14px;
    }
    
    .chat-header {
        top: 9px !important;
        right: 50px !important; /* Position share button with space from 3-dot on mobile */
    }
    
    .welcome-subtitle {
        font-size: 24px;
        padding: 0 20px;
        color: var(--text-primary);
        opacity: 1;
        font-weight: 400;
    }
    
    /* Adjust welcome view for mobile viewport */
    .welcome-view {
        padding: 20px 0; /* Only top and bottom padding, horizontal handled by content */
        min-height: calc(100dvh - 50px - 40px); /* Account for header and footer */
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .welcome-content {
        position: relative;
        display: flex;
        flex-direction: column;
        height: 100%;
        justify-content: space-between;
        padding: 0 10px; /* Reduced horizontal padding for more width */
        padding-bottom: 0;
    }
    
    .welcome-subtitle {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        margin: 0;
        padding: 0 20px;
        z-index: 1;
        pointer-events: none; /* Allow clicks to pass through to elements below */
    }
    
    .hero-input-container {
        margin-top: auto;
        margin-bottom: 16px; /* Small space above footer */
        width: 100%;
        background: rgba(17, 21, 20, 0.85); /* Reduced darkness for mobile */
        backdrop-filter: blur(12px);
        border: 1px solid rgba(42, 54, 51, 0.3);
        box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.08); /* Reduced shadow effect */
    }
    
    .footer-hint {
        bottom: 10px;
        font-size: 11px;
        white-space: nowrap;
        line-height: 1.4;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100% - 40px);
        color: var(--text-secondary);
        opacity: 0.8;
    }
    
    /* Enable touch scrolling and pull-to-refresh */
    .main-content {
        /* Remove touch-action to allow default behavior including pull-to-refresh */
        -webkit-overflow-scrolling: touch;
        /* Remove overscroll-behavior to allow browser's default pull-to-refresh */
    }
    
    body {
        /* Remove touch-action restrictions for mobile to enable pull-to-refresh */
    }
    
    /* Show mobile text variant on mobile */
    .footer-text-mobile {
        display: inline;
    }
    
    .footer-text-desktop {
        display: none;
    }
    
    /* Input hint styling for mobile */
    .input-hint {
        font-size: 11px;
        color: var(--text-secondary);
        opacity: 0.8;
    }
    
    /* Important info link white on mobile */
    .important-info-link {
        color: white;
        opacity: 0.9;
    }
    
    .important-info-link:hover {
        color: white;
        opacity: 1;
    }
    
    /* Action buttons on mobile */
    .message-actions {
        opacity: 1;
    }
}

/* Model Restriction Popup */
.model-restriction-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.model-restriction-popup.show {
    opacity: 1;
    visibility: visible;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--bg-primary);
    border: 2px solid var(--accent-color);
    border-radius: 16px;
    padding: 0;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(16, 163, 127, 0.2), 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.model-restriction-popup.show .popup-content {
    transform: translate(-50%, -50%) scale(1);
}

.popup-header {
    padding: 24px 24px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.popup-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #0d8968 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.popup-icon i {
    color: white;
    font-size: 24px;
}

.popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.popup-body {
    padding: 24px;
    text-align: center;
    line-height: 1.6;
}

.popup-body p {
    margin: 0 0 16px;
    color: var(--text-muted);
}

.popup-body p:last-child {
    margin-bottom: 0;
}

.popup-actions {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.popup-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    min-width: 120px;
    justify-content: center;
}

.popup-btn.secondary {
    background: var(--surface-color);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.popup-btn.secondary:hover {
    background: var(--hover-color);
    color: var(--text-color);
}

.popup-btn.primary {
    background: linear-gradient(135deg, var(--accent-color) 0%, #0d8968 100%);
    color: white;
}

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

/* Dark mode adjustments */
.dark .popup-content {
    border: 1px solid var(--border-color);
}

.dark .popup-icon {
    background: linear-gradient(135deg, var(--accent-color) 0%, #0d8968 100%);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .model-restriction-popup {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .popup-content {
        width: 90%;
        max-width: 400px;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95); /* Center with scale animation */
    }
    
    .model-restriction-popup.show .popup-content {
        transform: translate(-50%, -50%) scale(1);
    }
    
    .popup-header {
        padding: 20px 20px 12px;
    }
    
    .popup-body {
        padding: 16px 20px;
    }
    
    .popup-actions {
        flex-direction: column;
        padding: 12px 20px 20px;
        gap: 10px;
    }
    
    .popup-btn {
        width: 100%;
        padding: 14px 20px;
    }
    
    /* Custom model dropdown alignment on mobile */
    .custom-model-dropdown-menu {
        position: fixed;
        bottom: 80px; /* Same level as attach menu - above prompt area */
        top: auto;
        left: auto;
        right: 16px; /* Position on right side to match model button location */
        transform: none;
        width: calc(100% - 32px);
        max-width: 320px;
        max-height: 60vh; /* Dynamic height - up to 60% of viewport */
        min-height: 400px; /* Minimum height to show models without cropping */
    }
    
    /* Ensure both menus appear at same level */
    .attach-menu {
        position: fixed;
        bottom: 80px; /* Consistent positioning with model dropdown */
        left: 16px;
        right: auto;
    }
    
    /* Mobile model button positioning */
    .model-button-mobile {
        display: flex;
    }
    
    /* Hide desktop model selector on mobile */
    .custom-model-dropdown-trigger {
        display: none;
    }
}

/* Skeleton Loading for Sidebar */
.skeleton-loader {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Bottom fade effect for skeleton loader */
.skeleton-loader::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-sidebar) 70%, var(--bg-sidebar) 100%);
    pointer-events: none;
    z-index: 1;
}

.skeleton-item {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    animation: skeleton-pulse 1.5s infinite;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Skeleton for minimized sidebar */
.sidebar:not(.expanded) .skeleton-loader {
    padding: 8px;
    gap: 4px;
    align-items: center;
}

.sidebar:not(.expanded) .skeleton-item {
    padding: 8px;
    width: 36px;
    height: 36px;
    margin: 0;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar:not(.expanded) .skeleton-text {
    display: none;
}

/* Add a circular skeleton icon for minimized sidebar */
.sidebar:not(.expanded) .skeleton-item::before {
    content: "";
    width: 18px;
    height: 18px;
    background: var(--bg-hover);
    border-radius: 50%;
    opacity: 0.5;
}


.skeleton-item::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-text {
    height: 14px;
    background: var(--bg-hover);
    border-radius: 6px;
    margin-bottom: 8px;
}

.skeleton-text.title {
    width: 100%;
}

.skeleton-text.subtitle {
    width: 65%;
    height: 12px;
    opacity: 0.6;
    margin-bottom: 0;
    margin-top: 4px;
}

/* Remove individual item opacity - using gradient fade instead */

@keyframes skeleton-pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

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

/* Chat History Styles */
.chat-history-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-limit {
    background: var(--accent-color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
}

.recent-chats {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.chat-item {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

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

.chat-item.active {
    background: var(--bg-secondary);
    border-left-color: var(--accent-color);
}

.chat-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.chat-timestamp {
    opacity: 0.8;
}

.chat-token-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.token-bar {
    width: 30px;
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.token-progress {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.token-progress.near-limit {
    background: #ff9800;
}

.token-progress.exceeded {
    background: #f44336;
}

.chat-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-item:hover .chat-item-actions {
    opacity: 1;
}

.chat-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.chat-delete-btn:hover {
    background: #f44336;
    color: white;
}

/* Token limit warning */
.token-limit-warning {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 8px 12px;
    margin: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
    display: none;
}

.token-limit-warning.show {
    display: block;
}

.new-chat-suggestion {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 6px;
    width: 100%;
}

.new-chat-suggestion:hover {
    opacity: 0.9;
}