/* Palette AI - Layout Styles (Phase 1: Grid System) */
/* Dark mode, LibreChat-inspired layout */

/* ============================================================================
   MAIN APP CONTAINER - GRID LAYOUT
   ============================================================================ */

.app-container {
    display: grid;
    grid-template-columns: 250px 1fr 0px; /* Sidebar | Chat | Artifacts (hidden) */
    grid-template-rows: 48px 1fr; /* Header | Content */
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-primary);
}

/* When artifact pane is open - 50/50 split */
.app-container.artifacts-open {
    grid-template-columns: 250px 1fr 1fr; /* Sidebar | Chat (50%) | Artifacts (50%) */
}

/* Smooth transition for artifact pane */
.app-container {
    transition: grid-template-columns var(--transition-pane) var(--easing);
}

/* ============================================================================
   APP HEADER - PHASE 10.5: CLEANER STYLE
   ============================================================================ */

.app-header {
    height: 50px; /* Reduced from 60px */
    padding: 0 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 200px;
}

.app-header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    overflow: visible; /* CRITICAL - allow dropdown to overflow */
    position: relative;
    z-index: 100;
}

.model-selector-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    min-width: 180px;
    max-width: 250px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: all 0.15s ease;
    position: relative;
    z-index: 1000;
}

.model-selector-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.model-selector-btn:active,
.model-selector-btn.open {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

#currentModelDisplay {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

/* Cost tracker - no positioning tricks, just flex */
#costTrackerInline {
    display: flex !important;
    align-items: center !important;
    height: 32px !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 12px !important;
    font-size: 13px !important;
}


.model-selector:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.model-selector:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

/* Style dropdown options */
.model-selector option {
    padding: 8px 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.model-selector optgroup {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 6px 12px;
    font-size: 13px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 200px;
    justify-content: flex-end;
}

.header-icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-icon-btn:active {
    transform: scale(0.95);
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

.sidebar {
    grid-column: 1;
    grid-row: 1 / 3; /* Span both header and content rows */
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 250px;
}

.sidebar-header {
    height: 48px; /* Match app header */
    padding: 0 12px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    flex-shrink: 0;
    display: flex;
    align-items: center; /* Vertically center button */
}



.conversation-search:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.conversation-search::placeholder {
    color: var(--text-muted);
}

.new-conversation-btn {
    width: 92%;
    padding: 6px 12px;
    margin-left: 8px; /* Add exterior space on left side */
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
}

.new-conversation-btn:hover {
    background: var(--accent-hover);
}

.conversation-list-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-secondary);
    min-height: 0; /* Critical for flex containers */
    display: block !important; /* Force visibility */
    position: relative;
    z-index: 1;
}

/* Ensure it's never hidden */
.conversation-list-container:empty::after {
    content: 'No conversations yet';
    display: block;
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-style: italic;
}

.conversation-item {
    padding: 10px 12px;
    margin: 2px 8px;
    border-radius: 8px; /* Rounded */
    cursor: pointer;
    transition: all 0.15s ease;
    background: transparent;
}

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

.conversation-item.active {
    background: var(--accent-primary) !important;
    background: rgba(16, 163, 127, 0.15) !important;
    border-left: 3px solid var(--accent-primary);
}

/* Keep same color on hover */
.conversation-item:hover .conversation-title {
    color: var(--text-primary) !important;
}

/* Even active state gets bright color */
.conversation-item.active .conversation-title {
    color: var(--accent-primary) !important; /* Green for active */
    font-weight: 600;
}

/* Sidebar Footer with Search */
.sidebar-footer {
    padding: 7.5px 16px 7.5px 20px; /* top right bottom left - left is 20px */
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: center;
}

.conversation-search {
    width: 98%;
    padding: 2px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s ease;
    text-align: center; /* Center placeholder */
    height: 34px;
}

.conversation-search::placeholder {
    color: var(--text-secondary);
    text-align: center;
}

/* Hide placeholder on focus (when clicked) */
.conversation-search:focus::placeholder {
    opacity: 0;
}

/* When focused or has text, left-align the cursor/text */
.conversation-search:focus,
.conversation-search:not(:placeholder-shown) {
    text-align: left;
}

.conversation-search:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

/* ============================================================================
   CHAT AREA
   ============================================================================ */

.chat-area {
    grid-column: 2;
    grid-row: 2;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Header (when conversation is open) - MATCH APP HEADER HEIGHT */
.chat-header {
    height: 50px; /* Fixed height to match app header */
    padding: 0 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center; /* Vertically center content */
    flex-shrink: 0;
}

.chat-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 100%; /* Fill parent height */
}

.chat-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0; /* Remove default h3 margins */
    line-height: 1; /* Tight line height */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    flex-shrink: 1;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.chat-header-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    border-radius: 4px;
    transition: all var(--transition-fast) var(--easing);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.chat-header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.file-attachments-bar.has-files {
    display: flex;
}

/* ============================================================================
   CHAT INPUT AREA - CONSOLIDATED
   ============================================================================ */

   .chat-input-container {
    height: 50px; /* Fixed height to match header */
    padding: 0 20px; /* Remove vertical padding, keep horizontal */
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center; /* Vertically center content */
    gap: 8px;
    flex-shrink: 0;
}

.file-attachments-bar {
    position: absolute;
    bottom: 50px; /* Position above the input container */
    left: 250px; /* After sidebar */
    right: 0;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
    border-bottom: 1px solid var(--border-primary);
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
    z-index: 10;
}

.file-attachments-bar.has-files {
    display: flex;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary); /* Reduced from 2px to 1px */
    border-radius: 6px; /* Reduced from 12px to 6px - less rounded like search */
    padding: 6px 8px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    flex: 1;
    height: 34px;
    margin-top: 15.5px;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1), var(--shadow-md);
}

.chat-input {
    flex: 1;
    background: transparent !important;
    border: none;
    color: var(--text-primary) !important;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    padding: 0;
    
    /* Fixed height for single line */
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important; /* Prevent expansion in 50px footer */
    line-height: 24px;
    overflow-y: hidden;
    box-sizing: content-box !important;
    
    /* Remove transitions that might cause sizing issues */
    transition: none;
}

.chat-input:focus {
    outline: none;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

/* ========================================
   INPUT BUTTONS - INTEGRATED STYLE
   ======================================== */

.chat-input-btn {
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    width: 24px; /* Even smaller */
    height: 24px; /* Even smaller */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px; /* Smaller icon */
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.chat-input-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: scale(1.05);
}

.chat-input-btn:active {
    transform: scale(0.95);
}

/* Send button - accent color */
#sendBtn {
    background: var(--accent-primary);
    color: white;
}

#sendBtn:hover:not(:disabled) {
    background: var(--accent-hover);
}

#sendBtn:disabled {
    opacity: 0.5;
    background: var(--bg-hover);
    cursor: not-allowed;
}

/* Stop button - matches send button style with red color */
#stopBtn {
    background: var(--error);
    color: white;
    width: 24px !important; /* Force same width as send button */
    height: 24px !important; /* Force same height as send button */
    padding: 0 !important; /* Remove any padding */
    line-height: 1 !important; /* Remove line-height */
    /* display controlled by JS - DO NOT set display here */
    align-items: center !important; /* Center icon vertically */
    justify-content: center !important; /* Center icon horizontally */
}

/* When JS shows the button, ensure it uses flexbox for centering */
#stopBtn:not([style*="display: none"]) {
    display: flex !important;
}

#stopBtn:hover:not(:disabled) {
    background: #dc2626; /* Darker red on hover */
}

#stopBtn:active {
    transform: scale(0.95); /* Match send button press effect */
}

/* ============================================================================
   ARTIFACT PANE
   ============================================================================ */

.artifact-pane {
    grid-column: 3;
    grid-row: 2;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 400px;
}

/* Hidden when not open */
.app-container:not(.artifacts-open) .artifact-pane {
    display: none;
}

.artifact-pane-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
}

.artifact-pane-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.artifact-pane-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    border-radius: 4px;
    transition: all var(--transition-fast) var(--easing);
}

.artifact-pane-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.artifact-pane-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================================================
   DRAG & DROP OVERLAY
   ============================================================================ */

.drag-drop-overlay {
    position: fixed;
    top: 48px; /* Below header */
    left: 250px; /* After sidebar */
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
}

.drag-drop-overlay.active {
    display: flex;
}

.drag-drop-text {
    font-size: 24px;
    color: var(--text-primary);
    text-align: center;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Tablet: 768px - 1023px */
@media (max-width: 1023px) {
    .app-container {
        grid-template-columns: 50px 1fr 0px; /* Collapsed sidebar */
    }
    
    .sidebar {
        width: 50px;
    }
    
    /* Hide text, show only icons */
    .conversation-title,
    .conversation-preview,
    .conversation-timestamp,
    .new-conversation-btn span {
        display: none;
    }
}

/* Mobile: < 768px */
@media (max-width: 767px) {
    .app-container {
        grid-template-columns: 0px 1fr 0px; /* Hide sidebar */
    }
    
    .sidebar-top-spacer .menu-toggle {
        display: block; /* Show in sidebar on mobile */
    }
    
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -250px;
        top: 48px;
        bottom: 0;
        width: 250px;
        z-index: 200;
        transition: left var(--transition-pane) var(--easing);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .drag-drop-overlay {
        left: 0; /* Full width on mobile */
    }
}

/* ============================================================================
   SCROLLBAR STYLING
   ============================================================================ */

.conversation-list-container::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.artifact-pane-content::-webkit-scrollbar {
    width: 8px;
}

.conversation-list-container::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.artifact-pane-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.conversation-list-container::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.artifact-pane-content::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

.conversation-list-container::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.artifact-pane-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

.sidebar-top-spacer {
    height: 50px; /* Match header height */
    display: flex;
    align-items: center;
    justify-content: center; /* Center horizontally */
    padding: 0 12px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    position: relative; /* For absolute positioning of menu toggle */
}

.sidebar-top-spacer .menu-toggle {
    position: absolute;
    left: 12px; /* Position on left side */
    display: none; /* Hidden on desktop, shown on mobile */
}

/* Logo styling */
.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* PHASE 9: Artifact Streaming Styles */
.artifact-card.streaming {
    border: 2px solid var(--accent-primary);
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.artifact-streaming-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.streaming-dots::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.artifact-streaming-notice {
    display: inline-block;
    padding: 8px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: #1e40af;
    font-size: 13px;
    margin: 8px 0;
}

.artifact-card.timeout {
    border-color: #f59e0b;
    background: #fffbeb;
}

.artifact-card.complete {
    border-color: #10b981;
    animation: none;
}

/* PHASE 9: Compact chat input area */
.chat-input-area {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 16px; /* Reduced vertical padding: 10px top/bottom, keep 16px sides */
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
    min-height: 52px; /* Reduced from 70px to 52px */
}

/* PHASE 9: Enhanced Loading States */

/* Skeleton loading for messages */
.message-skeleton {
    padding: 16px;
    margin: 12px 0;
    border-radius: 12px;
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.message-skeleton-line {
    height: 12px;
    background: #d1d5db;
    border-radius: 4px;
    margin-bottom: 8px;
}

.message-skeleton-line:last-child {
    width: 60%; /* Shorter last line */
    margin-bottom: 0;
}

/* Page transition overlay */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.page-transition-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* File upload progress indicator */
.file-upload-progress {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 250px;
    animation: slideInRight 0.3s ease;
}

.file-upload-progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.file-upload-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Improved error states */
.message-content.error {
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    color: #991b1b;
}

/* Success notification enhancement */
.notification.success {
    border-left-color: #10b981;
}

.notification.error {
    border-left-color: #ef4444;
}

.notification.warning {
    border-left-color: #f59e0b;
}

.notification.info {
    border-left-color: #3b82f6;
}

/* PHASE 9: Enhanced context indicator */
#contextUsage {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

#tokenUsageBar {
    width: 100px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

#tokenUsageFill {
    height: 100%;
    background: #27ae60;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Color states for usage levels */
#tokenUsageFill[style*="80"] {
    background: #f39c12 !important; /* Warning at 80%+ */
}

#tokenUsageFill[style*="90"] {
    background: #e74c3c !important; /* Danger at 90%+ */
}

/* PHASE 9: Responsive Design Improvements */

@media (max-width: 768px) {
    /* Stack layout on mobile */
    #appContainer {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
    }
    
    .main-content {
        width: 100% !important;
    }
    
    /* Hide conversation search on mobile to save space */
    #conversationSearch {
        display: none;
    }
    
    /* Compact chat header on mobile */
    .chat-header {
        padding: 8px 12px;
    }
    
    .chat-title {
        font-size: 16px;
    }
    
    /* Stack file attachment items on mobile */
    .file-attachment-item {
        width: 100%;
        max-width: 100%;
    }
    
    /* Make buttons touch-friendly on mobile */
    .chat-input-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Reduce artifact card padding on mobile */
    .artifact-card {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .chat-input-area {
        padding: 8px;
        gap: 6px;
    }
    
    .chat-input-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Hide some metadata on very small screens */
    .message-meta {
        font-size: 10px;
    }
    
    /* Compact conversation items */
    .conversation-item {
        padding: 8px;
    }
}

/* ============================================================================
   CONVERSATION ITEMS - CONSOLIDATED
   ============================================================================ */

   .conversation-item {
    padding: 10px 12px;
    margin: 2px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: transparent;
}

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

.conversation-item.active {
    background: rgba(16, 163, 127, 0.15) !important;
    border-left: 3px solid #10a37f !important; /* Bright green */
}

.conversation-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    position: relative;
}

.conversation-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary) !important;
    line-height: 1.3;
    flex: 1;
}

.conversation-item:hover .conversation-title {
    color: var(--text-primary) !important;
}

.conversation-item.active .conversation-title {
    color: #10a37f !important; /* Bright green */
    font-weight: 600;
}

.conversation-delete-btn {
    opacity: 0 !important;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    position: absolute;
    right: 8px;
}

.conversation-item:hover .conversation-delete-btn {
    opacity: 1 !important;
    pointer-events: auto;
}

.conversation-delete-btn:hover {
    background: var(--bg-hover);
    color: #dc2626;
    transform: scale(1.1);
}

.conversation-delete-btn:active {
    transform: scale(0.95);
}

/* ============================================================================
   ENHANCED TYPING INDICATOR (Phase 2 - Bug 4)
   ============================================================================ */

   .typing-indicator.enhanced {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    margin: 8px 0;
    max-width: 300px;
    transition: all 0.2s ease;
}

.typing-indicator-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.typing-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.typing-progress {
    width: 100%;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.typing-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: 200px 0;
    }
}

/* Smooth fade out animation */
.typing-indicator {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* NUCLEAR: Conversations list can NEVER be hidden */
#conversationsList,
.conversation-list-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

.sidebar {
    display: flex !important;
}

.menu-toggle {
    display: none; /* Hidden by default on desktop */
}

@media (max-width: 767px) {
    .menu-toggle {
        display: flex !important; /* Show on mobile */
    }
}