/* New AI Logo - Transparent background and adaptive theming */
img[src*="nexorax-logo.svg"] {
    background: transparent !important;
    /* AI logo naturally transparent - no background needed */
    backdrop-filter: none !important;
    filter: none !important;
    mix-blend-mode: normal !important;
    /* Smooth transitions for theme changes */
    transition: filter 0.3s ease, opacity 0.3s ease;
    /* Ensure crisp rendering */
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
}

/* Light mode - optimal visibility */
img[src*="nexorax-logo.svg"] {
    filter: brightness(1) contrast(1) saturate(1.1);
    opacity: 1;
}

/* Dark mode - enhanced visibility and glow effect */
.dark img[src*="nexorax-logo.svg"] {
    /* Enhance brightness and add subtle glow for dark backgrounds */
    filter: brightness(1.2) contrast(1.1) saturate(1.2) drop-shadow(0 0 8px rgba(168, 85, 247, 0.3));
    opacity: 0.95;
}

/* Hover effects for interactive elements */
img[src*="nexorax-logo.svg"]:hover {
    filter: brightness(1.1) contrast(1.1) saturate(1.2);
    transform: scale(1.02);
    transition: all 0.2s ease;
}

.dark img[src*="nexorax-logo.svg"]:hover {
    filter: brightness(1.3) contrast(1.2) saturate(1.3) drop-shadow(0 0 12px rgba(168, 85, 247, 0.5));
    transform: scale(1.02);
}

/* Modern Settings Modal Styles - Easy to Read */
.modern-settings-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 
        0 20px 40px -12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    will-change: transform, opacity;
    transform: translate3d(0, 15px, 0) scale(0.96);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 480px;
}

.modern-settings-card.show {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
}

.modern-settings-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
}

.modern-settings-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    opacity: 0.9;
}

.modern-settings-header > * {
    position: relative;
    z-index: 1;
}

.settings-icon-container {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.settings-icon-container svg {
    width: 24px;
    height: 24px;
}

.modern-close-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.modern-settings-content {
    padding: 20px;
    max-height: 65vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.modern-settings-content::-webkit-scrollbar {
    width: 6px;
}

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

.modern-settings-content::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #cbd5e0, #a0aec0);
    border-radius: 6px;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.modern-settings-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.modern-settings-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #3b82f6;
    background: #ffffff;
}

.modern-settings-item:active {
    transform: translateY(0);
}

.settings-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
}

.settings-item-icon svg {
    width: 20px;
    height: 20px;
}

.ai-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.theme-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

.about-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.danger-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.settings-item-content {
    flex: 1;
    min-width: 0;
}

.settings-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
}

.settings-item-subtitle {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.settings-item-arrow,
.settings-item-chevron {
    margin-left: 12px;
}

/* Theme Toggle Switch - Compact */
.theme-toggle-switch {
    margin-left: 8px;
}

.toggle-track {
    width: 44px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.toggle-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 10px;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .toggle-track {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.dark .toggle-thumb {
    transform: translateX(20px);
}

/* Model Options Dropdown - Compact */
.model-options {
    margin-top: 8px;
    padding: 6px;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.1);
    animation: slideDown 0.3s ease-out;
}

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

.model-option {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.model-option:hover {
    background: rgba(59, 130, 246, 0.1);
}

.model-radio {
    margin-right: 10px;
    accent-color: #3b82f6;
}

.model-option-content {
    flex: 1;
}

.model-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1px;
}

.model-description {
    font-size: 11px;
    color: #64748b;
}

.model-check {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.model-check svg {
    width: 18px;
    height: 18px;
}

.model-option:has(.model-radio:checked) .model-check {
    opacity: 1;
}

/* Dark Mode Styles for Settings */
.dark .modern-settings-card {
    background: #141414;
    border-color: #262626;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.dark .modern-settings-content {
    scrollbar-color: #404040 transparent;
}

.dark .settings-section-title {
    color: #a3a3a3;
}

.dark .modern-settings-item {
    background: #1e1e1e;
    border-color: #262626;
}

.dark .modern-settings-item:hover {
    background: #2a2a2a;
    border-color: #3b82f6;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.dark .settings-item-title {
    color: #f5f5f5;
}

.dark .settings-item-subtitle {
    color: #a3a3a3;
}

.dark .model-options {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.dark .model-option:hover {
    background: rgba(59, 130, 246, 0.15);
}

.dark .model-name {
    color: #f5f5f5;
}

.dark .model-description {
    color: #a3a3a3;
}

/* Responsive Design for Settings Modal */
@media (max-width: 640px) {
    .modern-settings-card {
        margin: 12px;
        max-width: calc(100vw - 24px);
    }
    
    .modern-settings-header {
        padding: 14px 16px;
    }
    
    .modern-settings-header h2 {
        font-size: 17px !important;
    }
    
    .modern-settings-header p {
        font-size: 12px !important;
    }
    
    .settings-icon-container {
        width: 32px;
        height: 32px;
    }
    
    .settings-icon-container svg {
        width: 18px;
        height: 18px;
    }
    
    .modern-close-btn {
        width: 28px;
        height: 28px;
    }
    
    .modern-close-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .modern-settings-content {
        padding: 12px;
    }
    
    .settings-item-icon {
        width: 30px;
        height: 30px;
        margin-right: 10px;
    }
    
    .settings-item-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .settings-item-title {
        font-size: 13px;
    }
    
    .settings-item-subtitle {
        font-size: 10px;
    }
    
    .modern-settings-item {
        padding: 10px;
    }
}

/* Sidebar Mobile Optimization */
@media (max-width: 768px) {
    #sidebar {
        width: 280px;
    }
    
    #sidebar .p-4 {
        padding: 12px !important;
    }
    
    #sidebar h1 {
        font-size: 18px !important;
    }
    
    #sidebar img {
        width: 32px !important;
        height: 32px !important;
    }
    
    .new-chat-button {
        padding: 10px 14px !important;
        font-size: 14px !important;
    }
    
    .new-chat-button svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    .chat-item {
        padding: 10px !important;
        font-size: 13px !important;
    }
    
    .chat-item .font-medium {
        font-size: 13px !important;
    }
    
    .chat-item .text-xs {
        font-size: 11px !important;
    }
    
    .chat-item button {
        padding: 6px !important;
    }
    
    .chat-item button svg {
        width: 14px !important;
        height: 14px !important;
    }
    
    #settingsBtn {
        padding: 8px 10px !important;
        font-size: 13px !important;
    }
    
    #settingsBtn svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    #noChatHistory svg {
        width: 40px !important;
        height: 40px !important;
    }
    
    #noChatHistory p {
        font-size: 12px !important;
    }
}

/* Modern AI Loading Animation like Replit */
.ai-loading {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    width: fit-content;
    align-self: flex-start;
}

/* Dark mode support for ai-loading */
.dark .ai-loading,
[data-theme="dark"] .ai-loading,
body.dark-mode .ai-loading {
    background: #1e1e1e;
    border: 1px solid #262626;
}

.dark .ai-loading-text,
[data-theme="dark"] .ai-loading-text,
body.dark-mode .ai-loading-text {
    color: #a3a3a3;
}

.ai-loading-text {
    color: #64748b;
    font-size: 14px;
    margin-right: 8px;
}

.ai-loading-dots {
    display: flex;
    gap: 2px;
}

.ai-loading-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #3b82f6;
    animation: replitTyping 1.2s infinite ease-in-out;
}

.ai-loading-dot:nth-child(1) {
    animation-delay: 0s;
}

.ai-loading-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-loading-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes replitTyping {
    0%, 60%, 100% {
        transform: translateY(0px);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Old cursor removed - using new implementation below */


/* Removed quick suggestion styles */

/* Enhanced input area styles */
.home-input-area {
    backdrop-filter: blur(20px);
}

/* ChatGPT-style message styling - Clean without bubbles */
.message-bubble {
    margin-bottom: 24px;
    width: 100%;
}

.message-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 17px;
}

/* User message styling */
.user-message {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 6px;
    padding: 0 20px;
}

.user-message .message-wrapper {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: flex-end;
    line-height: 0;
}

.user-message .message-content {
    background: #ffffff;
    color: #1f2937;
    padding: 10px 16px;
    border-radius: 8px;
    max-width: fit-content;
    min-width: 60px;
    word-wrap: break-word;
    border: 1px solid #d1d5db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 17px;
    line-height: 1.5;
    vertical-align: top;
    width: auto;
}

/* AI message styling */
.ai-message {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 6px;
    padding: 0 20px;
}

.ai-message .message-wrapper {
    max-width: 90%;
    display: flex;
    flex-direction: column;
    gap: 0px;
    align-items: flex-start;
    line-height: 1;
}

.ai-message .message-content {
    background: transparent;
    color: #374151;
    padding: 0;
    max-width: 100%;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* File attachments - hiển thị NGOÀI message-content, TRONG message-wrapper */
.user-file-attachments,
.ai-file-attachments {
    display: block;
    margin-top: 4px;
}

.user-file-attachments {
    align-self: flex-end;
}

.ai-file-attachments {
    align-self: flex-start;
}

/* Model badge - ẨN HOÀN TOÀN */
.ai-message .model-badge,
.message .model-badge,
div.model-badge {
    display: none !important;
}

/* Avatar styling - HIDDEN */
.avatar {
    display: none;
}

.user-avatar {
    display: none;
}

.ai-avatar {
    display: none;
}

/* Dark mode support */
.dark .user-message .message-content,
[data-theme="dark"] .user-message .message-content,
body.dark-mode .user-message .message-content {
    background: #1e1e1e;
    color: #f5f5f5;
    border-color: #404040;
}

.dark .ai-message .message-content,
[data-theme="dark"] .ai-message .message-content,  
body.dark-mode .ai-message .message-content {
    color: #e5e5e5;
}

/* Responsive design */
@media (max-width: 768px) {
    .user-message, .ai-message {
        padding: 0 12px;
    }
    
    .user-message .message-wrapper {
        max-width: 75%;
    }
    
    .ai-message .message-wrapper {
        max-width: 95%;
    }
    
    .message-content {
        font-size: 15px;
    }
    
    /* User message mobile - nhỏ gọn hơn */
    .user-message .message-content {
        font-size: 15px;
        padding: 4px 10px;
    }
    
    .avatar {
        width: 28px;
        height: 28px;
    }
}

/* User message specificity fix - inline content để không tạo block line box */
.user-message .message-content > * {
    line-height: inherit;
    display: inline;
    margin: 0;
    padding: 0;
}

/* Markdown styling */
.message-content h1, .message-content h2, .message-content h3, 
.message-content h4, .message-content h5, .message-content h6 {
    font-weight: bold;
    margin: 0.5rem 0 0.15rem 0;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
    margin-top: 0;
}

.message-content h1 { font-size: 1.5rem; line-height: 1.3; }
.message-content h2 { font-size: 1.3rem; line-height: 1.3; }
.message-content h3 { font-size: 1.1rem; line-height: 1.3; }

.message-content p {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.5;
    display: inline;
}

.message-content p:first-child {
    margin-top: 0 !important;
}

.message-content p:last-child {
    margin-bottom: 0 !important;
}

.message-content strong, .message-content b {
    font-weight: bold;
}

.message-content em, .message-content i {
    font-style: italic;
}

.message-content ul, .message-content ol {
    margin: 0.1rem 0;
    padding-left: 1.5rem;
    list-style: none;
}

.message-content ul li::before {
    content: "•";
    color: #3b82f6;
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.message-content ol {
    list-style: decimal;
    padding-left: 1.8rem;
}

.message-content ol li::before {
    content: none;
}

.message-content li {
    margin: 0.2rem 0;
    line-height: 1.5;
}

/* Dark mode bullet color */
.dark .message-content ul li::before {
    color: #60a5fa;
}

.message-content code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.message-content pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-content pre code {
    background-color: transparent;
    padding: 0;
}

.message-content blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 0.5rem 0;
    font-style: italic;
    color: #6b7280;
}

/* Dark mode cho Markdown */
.dark .message-content code {
    background-color: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.dark .message-content pre {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .message-content blockquote {
    color: #9ca3af;
}

/* ========== ENHANCED MARKDOWN STYLES ========== */

/* Tables */
.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.message-content table thead {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.message-content table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid #2563eb;
}

.message-content table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.message-content table tbody tr:hover {
    background: #f8fafc;
    transition: background 0.2s ease;
}

.message-content table tbody tr:last-child td {
    border-bottom: none;
}

/* Dark mode for tables */
.dark .message-content table {
    background: #1e1e1e;
    border-color: #262626;
}

.dark .message-content table thead {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.dark .message-content table th {
    border-bottom-color: #2563eb;
}

.dark .message-content table td {
    border-bottom-color: #262626;
}

.dark .message-content table tbody tr:hover {
    background: #2a2a2a;
}

/* Task Lists / Checkboxes */
.message-content input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #3b82f6;
    border-radius: 4px;
}

.message-content ul.contains-task-list,
.message-content ul:has(input[type="checkbox"]) {
    list-style: none;
    padding-left: 0;
}

.message-content .task-list-item,
.message-content li:has(input[type="checkbox"]) {
    display: flex;
    align-items: flex-start;
    padding: 6px 0;
    gap: 8px;
}

/* Strikethrough */
.message-content del,
.message-content s {
    text-decoration: line-through;
    color: #9ca3af;
}

.dark .message-content del,
.dark .message-content s {
    color: #6b7280;
}

/* Enhanced Code Blocks with Syntax Highlighting */
.message-content pre {
    position: relative;
    background-color: #1e293b !important;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid #334155;
}

.message-content pre code {
    background-color: transparent !important;
    padding: 0;
    color: #e2e8f0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    display: block;
}

/* Inline code */
.message-content code {
    background-color: #f1f5f9;
    color: #dc2626;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #e2e8f0;
}

.dark .message-content code {
    background-color: #1e293b;
    color: #f87171;
    border-color: #334155;
}

/* Enhanced Blockquotes */
.message-content blockquote {
    border-left: 4px solid #3b82f6;
    padding: 12px 20px;
    margin: 1rem 0;
    background: #f8fafc;
    border-radius: 4px;
    font-style: italic;
    color: #475569;
}

.dark .message-content blockquote {
    background: #1e293b;
    color: #cbd5e1;
    border-left-color: #3b82f6;
}

/* Horizontal Rules */
.message-content hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 2rem 0;
}

.dark .message-content hr {
    border-top-color: #374151;
}

/* Links */
.message-content a {
    color: #3b82f6;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.message-content a:hover {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.dark .message-content a {
    color: #60a5fa;
}

.dark .message-content a:hover {
    color: #93c5fd;
    border-bottom-color: #93c5fd;
}

/* Images */
.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0;
    border: 1px solid #e5e7eb;
}

.dark .message-content img {
    border-color: #374151;
}

/* Kbd (Keyboard) tags */
.message-content kbd {
    display: inline-block;
    padding: 3px 8px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.85em;
    color: #1f2937;
    background: linear-gradient(to bottom, #f9fafb, #f3f4f6);
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 2px 0 rgba(0,0,0,0.1), inset 0 0 0 2px #ffffff;
    white-space: nowrap;
}

.dark .message-content kbd {
    color: #f3f4f6;
    background: linear-gradient(to bottom, #374151, #1f2937);
    border-color: #4b5563;
    box-shadow: 0 2px 0 rgba(0,0,0,0.3), inset 0 0 0 2px rgba(255,255,255,0.1);
}

/* Mark (Highlight) tags */
.message-content mark {
    background: #fef08a;
    color: #854d0e;
    padding: 2px 4px;
    border-radius: 3px;
}

.dark .message-content mark {
    background: #713f12;
    color: #fef08a;
}

/* Sub and Sup */
.message-content sub,
.message-content sup {
    font-size: 0.75em;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

.message-content sub {
    bottom: -0.25em;
}

.message-content sup {
    top: -0.5em;
}

/* Details/Summary (Collapsible) */
.message-content details {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin: 1rem 0;
    background: #f9fafb;
}

.message-content details summary {
    cursor: pointer;
    font-weight: 600;
    color: #3b82f6;
    user-select: none;
    padding: 4px 0;
}

.message-content details summary:hover {
    color: #2563eb;
}

.message-content details[open] {
    padding-bottom: 16px;
}

.message-content details[open] summary {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.dark .message-content details {
    background: #1e293b;
    border-color: #374151;
}

.dark .message-content details[open] summary {
    border-bottom-color: #374151;
}

/* Footnotes */
.message-content .footnotes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid #e5e7eb;
    font-size: 0.9em;
    color: #6b7280;
}

.dark .message-content .footnotes {
    border-top-color: #374151;
    color: #9ca3af;
}

/* Definition Lists */
.message-content dl {
    margin: 1rem 0;
}

.message-content dt {
    font-weight: 600;
    margin-top: 1rem;
    color: #1f2937;
}

.message-content dd {
    margin-left: 2rem;
    color: #6b7280;
}

.dark .message-content dt {
    color: #f3f4f6;
}

.dark .message-content dd {
    color: #9ca3af;
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px) scale(0.9) rotateX(10deg); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1) rotateX(0deg); 
    }
}

.typing-indicator {
    animation: typingPulse 1.5s infinite;
}

@keyframes typingPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* .message-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
} */

.sidebar-transition {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Sidebar active state - hiện sidebar khi có class active */
#sidebar.active {
    transform: translateX(0) !important;
}

/* Ẩn MOBILE toggle button khi sidebar đang mở (chỉ mobile) */
#sidebar.active ~ #sidebarToggle {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Desktop sidebar settings */
@media (min-width: 1024px) {
    /* Desktop toggle button luôn ở trên sidebar */
    #desktopSidebarToggle {
        z-index: 60 !important;
        transition: opacity 0.3s ease, left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

.chat-item {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    transform-origin: left center;
}

.chat-item:hover {
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.chat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.2), transparent);
    transition: left 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chat-item:hover::before {
    left: 100%;
}

.chat-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(to bottom, #3b82f6, #8b5cf6);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.chat-item:hover::after {
    transform: scaleY(1);
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes scaleIn {
    from { 
        opacity: 0; 
        transform: scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

.bounce-in {
    animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-180deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) rotate(-90deg);
    }
    70% {
        transform: scale(0.9) rotate(-45deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.float {
    /* Removed annoying float animation */
}

.glow {
    /* Removed annoying glow animation */
}

.pulse-ring {
    /* Removed annoying pulse animation */
}

.wiggle {
    animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

.heartbeat {
    /* Removed annoying heartbeat animation */
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.rotate-in {
    animation: rotateIn 0.5s ease-out;
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.glass-effect {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
}

.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

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

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #cbd5e0, #a0aec0);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #a0aec0, #718096);
    transform: scaleX(1.2);
}

/* Performance optimizations */
* {
    box-sizing: border-box;
}

html, body {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    .text-6xl { font-size: 2.5rem !important; }
    .text-xl { font-size: 1.1rem !important; }
    .w-80 { width: 16rem !important; }
    .p-6 { padding: 1rem !important; }
    .mb-12 { margin-bottom: 1.5rem !important; }
    .mb-8 { margin-bottom: 1rem !important; }
}

.chat-container {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.input-area {
    margin-bottom: 0;
    padding-bottom: 0;
}

.chat-container > .border-t {
    margin-top: auto;
}

.home-container {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.dark { 
    background-color: #0a0a0a !important; 
    color: #f5f5f5 !important;
    transition: none !important;
}

/* Dark mode cho tất cả elements - No transitions for instant dark mode */
.dark .bg-white { background-color: transparent !important; }
.dark .bg-gray-50 { background-color: #0a0a0a !important; }
.dark .bg-gray-100 { background-color: #141414 !important; }
.dark .bg-gray-200 { background-color: #1e1e1e !important; }
.dark .text-gray-900 { color: #f5f5f5 !important; }
.dark .text-gray-700 { color: #e5e5e5 !important; }
.dark .text-gray-600 { color: #a3a3a3 !important; }
.dark .text-gray-500 { color: #737373 !important; }
.dark .text-gray-400 { color: #525252 !important; }
.dark .text-gray-800 { color: #f5f5f5 !important; }
.dark .border-gray-300 { border-color: #404040 !important; }
.dark .border-gray-200 { border-color: #262626 !important; }

/* ChatGPT-style backgrounds */
#chatScreen { 
    background-color: #ffffff !important; 
}
#messagesContainer { 
    background-color: #ffffff !important; 
}
.chat-container { 
    background-color: #ffffff !important; 
}

/* Dark mode cho chat screen background */
.dark #chatScreen { background-color: #0a0a0a !important; }
.dark #messagesContainer { background-color: #0a0a0a !important; }
.dark .chat-container { background-color: #0a0a0a !important; }

/* Dark mode cho home screen */
.dark .bg-gradient-to-br { 
    background: linear-gradient(to bottom right, #0a0a0a, #141414) !important; 
}

/* Dark mode cho message bubbles */
.dark .ai-bubble {
    background: #1e1e1e !important;
    color: #f5f5f5 !important;
}

/* Dark mode cho chat messages */
.dark .bg-blue-600 { background-color: #3b82f6 !important; }
.dark .border-gray-200 { border-color: #262626 !important; }

/* Dark mode cho glass effect */
.dark .glass-effect { 
    backdrop-filter: blur(10px);
    background: rgba(20, 20, 20, 0.9) !important;
}

/* Dark mode cho hover effects */
.dark .hover\:bg-gray-100:hover { background-color: #2a2a2a !important; }
.dark .hover\:bg-gray-50:hover { background-color: #1e1e1e !important; }
.dark .hover\:text-red-500:hover { color: #ef4444 !important; }
.dark .hover\:text-blue-500:hover { color: #3b82f6 !important; }

/* Dark mode cho input fields */
.dark input[type="text"], .dark textarea {
    background-color: #1a1a1a !important;
    border-color: #2d2d2d !important;
    color: #e5e5e5 !important;
}

.dark input[type="text"]:focus, .dark textarea:focus {
    border-color: #3b82f6 !important;
    background-color: #1e1e1e !important;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4) !important;
}

.dark input[type="text"]::placeholder, .dark textarea::placeholder {
    color: #6b7280 !important;
}

/* Dark mode for sidebar and chat history - Professional theme */
.dark .sidebar {
    background-color: #141414 !important;
    border-color: #262626 !important;
}

/* Dark mode for chat history items */
.dark .chat-item {
    background-color: #1e1e1e !important;
    border-color: #262626 !important;
    color: #e5e5e5 !important;
}

.dark .chat-item:hover {
    background-color: #2a2a2a !important;
}

.dark .chat-item h3, .dark .chat-item .chat-title {
    color: #f5f5f5 !important;
}

.dark .chat-item p, .dark .chat-item .chat-date {
    color: #a3a3a3 !important;
}

/* Dark mode for sidebar header */
.dark .sidebar h2, .dark .sidebar h3 {
    color: #f5f5f5 !important;
}

/* Dark mode for new chat button */
.dark .new-chat-button {
    background-color: #1e1e1e !important;
    color: #e5e5e5 !important;
    border-color: #262626 !important;
}

.dark .new-chat-button:hover {
    background-color: #2a2a2a !important;
}

/* Chat input now uses same styling as home input - no specific rules needed */

/* Dark mode cho chat input container */
.dark .bg-white\/95 {
    background: transparent !important;
    border: none !important;
}

.dark .backdrop-blur-sm {
    backdrop-filter: blur(8px);
}

.dark .border-gray-200\/50 {
    border-color: rgba(38, 38, 38, 0.5) !important;
}

/* Dark mode cho toggle buttons */
.dark #sidebarToggle,
.dark #desktopSidebarToggle {
    background-color: #1e1e1e !important;
}

.dark #sidebarToggle svg,
.dark #desktopSidebarToggle svg {
    color: #a3a3a3 !important;
}

/* Dark mode cho modals */
.dark #settingsContent, .dark #aboutContent, .dark #clearAllContent, .dark #feedbackContent {
    background-color: #141414 !important;
    color: #f5f5f5 !important;
}

/* Dark mode cho dynamic modals */
.dark .bg-white {
    background-color: #141414 !important;
}

.dark .text-gray-900 {
    color: #f5f5f5 !important;
}

.dark .text-gray-600 {
    color: #a3a3a3 !important;
}

/* Dark mode cho message bubbles */
.dark .message-bubble .bg-white {
    background-color: #1e1e1e !important;
    color: #f5f5f5 !important;
    border-color: #262626 !important;
}

/* Dark mode cho home screen */
.dark #homeScreen {
    background-color: #0a0a0a !important;
}

.dark .home-container {
    background-color: #0a0a0a !important;
}

/* Dark mode cho settings button container ở sidebar */
.dark .sidebar > div:last-child {
    background-color: #141414 !important;
    border-color: #262626 !important;
}

.dark #settingsBtn {
    color: #a3a3a3 !important;
}

.dark #settingsBtn:hover {
    color: #f5f5f5 !important;
    background-color: #1e1e1e !important;
}

/* Nút sidebar toggle mobile và desktop */
#sidebarToggle:hover {
    transform: scale(1.05);
}

#desktopSidebarToggle:hover {
    transform: scale(1.05);
}

/* Nút đóng sidebar */
#closeSidebar:hover {
    transform: scale(1.05);
}

/* Material UI Inspired Styles */

/* Button styles */
.btn-material {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    text-decoration: none;
    user-select: none;
}

.btn-material:hover {
    box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    transform: translateY(-1px);
}

.btn-material:active {
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
}

.btn-secondary {
    background: #f5f5f5;
    color: #424242;
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #eeeeee;
    border-color: #bdbdbd;
}

/* Input styles */
.glow-input-container {
    display: flex;
    align-items: center;
    position: relative;
    border: 1px solid #e0e0e0;
    background-color: #fafafa;
    border-radius: 8px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: text;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.glow-input-container:hover {
    border-color: #bdbdbd;
    background-color: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.glow-input-container:focus-within {
    border-color: #1976d2;
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1), 0 2px 8px rgba(0,0,0,0.12);
}

.glow-input {
    background: transparent !important;
    border: none !important;
    color: #212121 !important;
    z-index: 2;
    position: relative;
    width: 100%;
    padding: 10px 50px 10px 14px;
    resize: none;
    outline: none;
    font-size: 14px;
    font-weight: 400;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.4;
}

.glow-input::placeholder {
    color: #757575 !important;
    opacity: 1;
}

/* Material Dark mode cho input */
.dark .glow-input-container {
    border-color: #424242;
    background-color: #303030;
}

.dark .glow-input-container:hover {
    border-color: #616161;
    background-color: #424242;
}

.dark .glow-input-container:focus-within {
    border-color: #42a5f5;
    background-color: #424242;
    box-shadow: 0 0 0 2px rgba(66, 165, 245, 0.15), 0 2px 8px rgba(0,0,0,0.3);
}

.dark .glow-input {
    color: #ffffff !important;
}

.dark .glow-input::placeholder {
    color: #bdbdbd !important;
}

/* New Chat Button Styles */
.new-chat-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    height: 44px;
    background-color: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 22px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    margin-bottom: 16px;
}

.new-chat-button:hover {
    background-color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.plus-icon {
    width: 18px;
    height: 18px;
    border: 1.2px solid #5f6368;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.plus-icon::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 1.2px;
    background-color: #5f6368;
    border-radius: 0.6px;
}

.plus-icon::after {
    content: '';
    position: absolute;
    width: 1.2px;
    height: 8px;
    background-color: #5f6368;
    border-radius: 0.6px;
}

.button-text {
    font-size: 14px;
    color: #3c4043;
    font-weight: 400;
    letter-spacing: 0.01em;
    user-select: none;
}

/* Removed duplicate - using earlier definition with better colors */

.dark .plus-icon {
    border-color: #9ca3af;
}

.dark .plus-icon::before,
.dark .plus-icon::after {
    background-color: #9ca3af;
}

.dark .button-text {
    color: #f3f4f6;
}

/* NexoraX Message Input Styles */
.nexorax-message-input-wrapper {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    position: relative;
}

.nexorax-message-input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.nexorax-message-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: #1f2937;
    padding: 8px 0;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.nexorax-message-input::placeholder {
    color: #9ca3af;
}

.nexorax-input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nexorax-mic-button {
    width: 36px;
    height: 36px;
    background-color: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.nexorax-mic-button:hover {
    background-color: #f3f4f6;
}

.nexorax-mic-button svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

.nexorax-send-button {
    width: 36px;
    height: 36px;
    background-color: #a78bfa;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nexorax-send-button:hover {
    background-color: #8b5cf6;
    transform: scale(1.05);
}

.nexorax-send-button svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Dark mode for NexoraX message input - Updated to match new theme */
.dark .nexorax-message-input-wrapper {
    background-color: #2f3349;
    border-color: #404356;
}

.dark .nexorax-message-input-wrapper:focus-within {
    border-color: #5865f2;
    box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.4);
}

.dark .nexorax-message-input {
    color: #dcddde;
}

.dark .nexorax-message-input::placeholder {
    color: #72767d;
}

.dark .nexorax-mic-button:hover {
    background-color: #404356;
}

.dark .nexorax-mic-button svg {
    color: #d1d5db;
}

/* Responsive */
@media (max-width: 640px) {
    .nexorax-message-input {
        font-size: 16px;
    }
}

/* Replit-style Input Components */
.replit-input-container {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.replit-input-container:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.replit-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #1f2937;
    padding: 0;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.replit-input::placeholder {
    color: #9ca3af;
}

.replit-send-btn {
    margin-left: 12px;
    width: 32px;
    height: 32px;
    background-color: #3b82f6;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.replit-send-btn:hover {
    background-color: #4752c4;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(88, 101, 242, 0.3);
}

.replit-send-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.replit-send-btn svg {
    color: white;
}

/* Dark mode for Replit-style input - Professional dark theme */
.dark .replit-input-container {
    background-color: #1a1a1a;
    border-color: #2d2d2d;
    border-width: 1px;
}

.dark .replit-input-container:focus-within {
    border-color: #3b82f6;
    background-color: #1e1e1e;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

.dark .replit-input {
    color: #e5e5e5;
    background-color: transparent;
}

.dark .replit-input::placeholder {
    color: #6b7280;
}

.dark .replit-send-btn {
    background-color: #3b82f6;
}

.dark .replit-send-btn:hover {
    background-color: #2563eb;
}

/* Chat input area improvements */
.chat-container .fixed {
    background: transparent;
}

.dark .chat-container .fixed {
    background: transparent;
}

/* Improve messages container for better scrolling */
#messagesContainer {
    padding-bottom: 120px !important; /* Increase bottom padding */
    margin-bottom: 0;
    scroll-behavior: smooth;
}

/* Auto scroll to bottom when new messages appear */
.message-bubble:last-child {
    margin-bottom: 20px;
}

/* ChatGPT-style input container */
.chatgpt-input-container {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 8px 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    position: relative;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    gap: 8px;
    overflow: hidden;
}

.chatgpt-input-container:focus-within {
    border-color: #9ca3af;
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.1);
}

/* Attachment buttons */
.attachment-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.attachment-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.attachment-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* Input field */
.chatgpt-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: #374151;
    padding: 12px 0;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    min-height: 24px;
    max-height: 120px;
    resize: none;
    overflow-y: auto;
}

.chatgpt-input::placeholder {
    color: #9ca3af;
}

/* Send button - New Design */
.chatgpt-send-btn {
    width: 32px;
    height: 32px;
    background-color: #3b82f6;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: bold;
    color: white;
    position: relative;
}

.chatgpt-send-btn:hover {
    background-color: #2563eb;
    transform: scale(1.05);
}

.chatgpt-send-btn:active {
    transform: scale(0.95);
}

.chatgpt-send-btn:before {
    content: "↑";
    font-size: 16px;
    line-height: 1;
    color: white;
    display: block;
}

/* Dark mode for ChatGPT input */
.dark .chatgpt-input-container,
[data-theme="dark"] .chatgpt-input-container,
body.dark-mode .chatgpt-input-container {
    background-color: #1a1a1a;
    border-color: #2d2d2d;
}

.dark .chatgpt-input-container:focus-within,
[data-theme="dark"] .chatgpt-input-container:focus-within,
body.dark-mode .chatgpt-input-container:focus-within {
    border-color: #3b82f6;
}

.dark .chatgpt-input,
[data-theme="dark"] .chatgpt-input,
body.dark-mode .chatgpt-input {
    color: #e5e5e5;
}

.dark .chatgpt-input::placeholder,
[data-theme="dark"] .chatgpt-input::placeholder,
body.dark-mode .chatgpt-input::placeholder {
    color: #6b7280;
}

.dark .attachment-btn,
[data-theme="dark"] .attachment-btn,
body.dark-mode .attachment-btn {
    color: #a3a3a3;
}

.dark .attachment-btn:hover,
[data-theme="dark"] .attachment-btn:hover,
body.dark-mode .attachment-btn:hover {
    background-color: #2a2a2a;
    color: #f5f5f5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chatgpt-input-container {
        max-width: calc(100% - 24px);
        margin: 0 12px;
        padding: 12px 16px;
        min-height: 56px;
        gap: 12px;
    }
    
    .chatgpt-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 0;
        min-height: 20px;
        line-height: 1.4;
        -webkit-appearance: none;
        -webkit-border-radius: 0;
        border-radius: 0;
    }
    
    .attachment-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        min-width: 40px;
        min-height: 40px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .chatgpt-send-btn {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        min-width: 40px;
        min-height: 40px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .chatgpt-send-btn:before {
        font-size: 18px;
    }
    
    .attachment-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .attachment-buttons {
        flex-shrink: 0;
    }
    
    /* Mobile-specific fixes */
    #messagesContainer {
        padding-bottom: 140px !important;
    }
    
    /* Better mobile input focus */
    .chatgpt-input-container:focus-within {
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
        border-color: #3b82f6;
    }
    
    /* Prevent mobile safari zoom and improve typing */
    .chatgpt-input {
        -webkit-user-select: text;
        -webkit-touch-callout: default;
        user-select: text;
    }
    
    /* Better mobile button interactions */
    .chatgpt-send-btn {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    .attachment-btn {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* Dark mode for input area background */
.dark .fixed,
[data-theme="dark"] .fixed,
body.dark-mode .fixed {
    background: linear-gradient(180deg, transparent 0%, rgba(10,10,10,0.8) 20%, #0a0a0a 100%) !important;
}

/* ========================================= */
/* New Modern Input Container Design */
/* ========================================= */

.new-input-container {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 6px;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
}

.new-input-container:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Attachment button */
.new-attachment-btn {
    width: 36px;
    height: 36px;
    background-color: transparent;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    flex-grow: 0;
    order: 1;
    box-sizing: border-box;
}

.new-attachment-btn:hover {
    background-color: #f3f4f6;
}

.new-attachment-btn svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

/* Input field */
.new-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: #1f2937;
    padding: 10px 12px;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    resize: none;
    min-height: 20px;
    order: 2;
    min-width: 0;
    box-sizing: border-box;
    flex-grow: 1;
    flex-shrink: 1;
}

.new-input::placeholder {
    color: #9ca3af;
}

/* Microphone button */
.new-mic-btn {
    width: 36px;
    height: 36px;
    background-color: transparent;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    flex-grow: 0;
    order: 2.5;
    box-sizing: border-box;
    position: relative;
}

.new-mic-btn:hover {
    background-color: #f3f4f6;
}

.new-mic-btn.recording {
    background-color: #fef2f2;
    animation: pulse-recording 1.5s infinite;
}

.new-mic-btn.recording .mic-icon {
    display: none;
}

.new-mic-btn.recording .mic-recording-icon {
    display: block !important;
    color: #dc2626;
}

.new-mic-btn svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

@keyframes pulse-recording {
    0%, 100% {
        background-color: #fef2f2;
        transform: scale(1);
    }
    50% {
        background-color: #fee2e2;
        transform: scale(1.05);
    }
}

/* Send button - positioned at right inside input container */
.new-send-btn {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    flex-grow: 0;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    order: 3;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    margin-left: auto;
}

.new-send-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.new-send-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.new-send-btn svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Dark mode support */
.dark .new-input-container,
[data-theme="dark"] .new-input-container,
body.dark-mode .new-input-container {
    background-color: #1a1a1a;
    border-color: #2d2d2d;
}

.dark .new-input-container:focus-within,
[data-theme="dark"] .new-input-container:focus-within,
body.dark-mode .new-input-container:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dark .new-input,
[data-theme="dark"] .new-input,
body.dark-mode .new-input {
    color: #e5e5e5;
}

.dark .new-input::placeholder,
[data-theme="dark"] .new-input::placeholder,
body.dark-mode .new-input::placeholder {
    color: #6b7280;
}

.dark .new-attachment-btn:hover,
[data-theme="dark"] .new-attachment-btn:hover,
body.dark-mode .new-attachment-btn:hover {
    background-color: #2a2a2a;
}

.dark .new-attachment-btn svg,
[data-theme="dark"] .new-attachment-btn svg,
body.dark-mode .new-attachment-btn svg {
    color: #a3a3a3;
}

.dark .new-mic-btn:hover,
[data-theme="dark"] .new-mic-btn:hover,
body.dark-mode .new-mic-btn:hover {
    background-color: #2a2a2a;
}

.dark .new-mic-btn svg,
[data-theme="dark"] .new-mic-btn svg,
body.dark-mode .new-mic-btn svg {
    color: #a3a3a3;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .new-input-container {
        border-radius: 12px;
        padding: 4px;
        gap: 4px;
        max-width: calc(100% - 16px);
        margin: 0 8px;
        min-height: 48px;
    }
    
    .new-attachment-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        flex-shrink: 0;
        flex-grow: 0;
    }
    
    .new-attachment-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .new-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 8px 10px;
        min-height: 16px;
        -webkit-appearance: none;
        -webkit-user-select: text;
        -webkit-touch-callout: default;
        user-select: text;
        flex: 1;
        min-width: 0;
    }
    
    .new-send-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        flex-shrink: 0;
        flex-grow: 0;
    }
    
    .new-send-btn svg {
        width: 14px;
        height: 14px;
    }
    
    /* Better mobile focus states */
    .new-input-container:focus-within {
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5), 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* ======================== */
/* TYPING EFFECT ANIMATION  */
/* ======================== */

/* Typing cursor */
.typing-cursor {
    display: inline-block;
    background-color: #3b82f6;
    width: 2px;
    height: 1.2em;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: text-bottom;
    opacity: 1;
}

/* Dark mode cursor */
.dark .typing-cursor,
[data-theme="dark"] .typing-cursor,
body.dark-mode .typing-cursor {
    background-color: #60a5fa;
}

/* Cursor blinking animation */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Typing container */
.typing-text {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    min-height: 1.2em;
}

/* Enhanced typing effect for titles - JS-controlled only */
.typing-title {
    /* Removed CSS animation - using JS for better control */
}

/* Subtitle typing effect - JS-controlled only */
.typing-subtitle {
    /* Removed CSS animation - using JS for better control */
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* AI response typing effect */
.ai-typing {
    overflow: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
    padding: 2px 4px;
}

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

/* Responsive typing effects */
@media (max-width: 768px) {
    .typing-title {
        animation-duration: 1.5s;
    }
    
    .typing-subtitle {
        animation-duration: 1.2s;
        animation-delay: 2s;
    }
    
    .typing-cursor {
        width: 1.5px;
        margin-left: 1px;
    }
}

/* Reduced motion accessibility - comprehensive coverage */
@media (prefers-reduced-motion: reduce) {
    .typing-title,
    .typing-subtitle,
    .ai-typing {
        animation: none !important;
        width: auto !important;
        opacity: 1 !important;
    }
    
    .typing-cursor {
        animation: none !important;
        opacity: 0 !important; /* Hide cursor completely for reduced motion users */
    }
    
    /* Disable all typing animations */
    .typing-text {
        animation: none !important;
    }
}

/* ======================== */
/* Replit-style Input Dark Mode Support */
/* ======================== */

/* Dark mode for fieldset and input containers */
.dark fieldset div[class*="bg-white"] {
    background-color: #1a1a1a !important;
    border-color: #2d2d2d;
}

.dark fieldset input {
    color: #e5e5e5 !important;
}

.dark fieldset input::placeholder {
    color: #6b7280 !important;
}

.dark fieldset button[class*="border-gray-200"] {
    border-color: #404040 !important;
    color: #a3a3a3 !important;
}

.dark fieldset button[class*="border-gray-200"]:hover {
    background-color: #2a2a2a !important;
    border-color: #3b82f6 !important;
}

/* ======================== */
/* Image Generation Result Styling */
/* ======================== */

/* Container for generated images */
.image-generation-result {
    max-width: 500px;
    margin: 8px 0;
    width: 100%;
}

.image-generation-result img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dark mode support for image shadows */
.dark .image-generation-result img,
body.dark-mode .image-generation-result img {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Sidebar toggle button - more visible in dark mode */
.dark #sidebarToggle,
.dark #desktopSidebarToggle {
    background: #262626 !important;
    border: 1px solid #404040 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

.dark #sidebarToggle:hover,
.dark #desktopSidebarToggle:hover {
    background: #2a2a2a !important;
    border-color: #525252 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

.dark #mobilePanelLeftIcon,
.dark #mobilePanelRightIcon,
.dark #desktopPanelLeftIcon,
.dark #desktopPanelRightIcon {
    color: #e5e5e5 !important;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .image-generation-result {
        max-width: 100%;
    }
}
/* Dark mode fixes for input and buttons */
.dark #homeInput,
.dark #chatInput {
    color: #e5e5e5;
}

.dark #homeInput::placeholder,
.dark #chatInput::placeholder {
    color: #6b7280;
}

/* Fix borders in dark mode - remove blue border on focus */
.dark .shadow-\[0_0\.25rem_1\.25rem_hsla\(0\,0\%\,0\%\,3\.5\%\)\,0_0_0_0\.5px_hsla\(0\,0\%\,0\%\,15\%\)\] {
    box-shadow: 0 0.25rem 1.25rem hsla(0,0%,100%,7.5%), 0 0 0 0.5px hsla(0,0%,100%,20%) !important;
}

.dark .shadow-\[0_0\.25rem_1\.25rem_hsla\(0\,0\%\,0\%\,3\.5\%\)\,0_0_0_0\.5px_hsla\(0\,0\%\,0\%\,15\%\)\]:hover {
    box-shadow: 0 0.25rem 1.25rem hsla(0,0%,100%,7.5%), 0 0 0 0.5px hsla(0,0%,100%,25%) !important;
}

.dark .shadow-\[0_0\.25rem_1\.25rem_hsla\(0\,0\%\,0\%\,3\.5\%\)\,0_0_0_0\.5px_hsla\(0\,0\%\,0\%\,15\%\)\]:focus-within {
    box-shadow: 0 0.25rem 1.25rem hsla(0,0%,100%,10%), 0 0 0 0.5px hsla(0,0%,100%,30%) !important;
}

.dark .box-content {
    background: #1a1a1a !important;
}

/* Upload and config buttons dark mode */
.dark #homeUploadBtn,
.dark #chatUploadBtn,
.dark #homeConfigBtn,
.dark #chatConfigBtn {
    background: transparent;
}

.dark #homeUploadBtn:hover,
.dark #chatUploadBtn:hover,
.dark #homeConfigBtn:hover,
.dark #chatConfigBtn:hover {
    background: #2a2a2a;
}

.dark #homeUploadBtn svg,
.dark #chatUploadBtn svg,
.dark #homeConfigBtn svg,
.dark #chatConfigBtn svg {
    color: #a3a3a3;
}

/* Config dropdown dark mode */
.dark #homeConfigDropdown,
.dark #chatConfigDropdown {
    background: #141414;
    border-color: #262626;
}

.dark .config-option {
    color: #e5e5e5;
}

.dark .config-option:hover {
    background: #2a2a2a;
}

.dark .config-option svg {
    color: #a3a3a3;
}

/* File preview dark mode */
.dark #homeFilePreview > div,
.dark #chatFilePreview > div {
    background: #2a2a2a;
}

.dark #homeFilePreview span,
.dark #chatFilePreview span {
    color: #e5e5e5;
}

/* Send button - keep blue in dark mode but adjust shade */
.dark #homeSendBtn,
.dark #sendBtn {
    background: #3b82f6;
}

.dark #homeSendBtn:hover,
.dark #sendBtn:hover {
    background: #2563eb;
}

/* ===========================
   DUAL CHAT MODE STYLES
   =========================== */

/* Dual mode button - active state */
#homeDualModeBtn.active,
#chatDualModeBtn.active {
    background: #3b82f6 !important;
}

#homeDualModeBtn.active svg,
#chatDualModeBtn.active svg {
    color: #ffffff !important;
}

.dark #homeDualModeBtn.active,
.dark #chatDualModeBtn.active {
    background: #3b82f6 !important;
}

/* Dual mode button - locked state (cannot toggle when has messages) */
#homeDualModeBtn.locked,
#chatDualModeBtn.locked {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

#homeDualModeBtn.locked:hover,
#chatDualModeBtn.locked:hover {
    background: #3b82f6 !important;
    opacity: 0.5 !important;
}

/* Dual chat layout - Vertical split (top/bottom) */
#messagesContainer.dual-chat-mode {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    height: 100%;
}

.dual-chat-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    flex: 1;
}

/* Each panel in dual chat */
.dual-chat-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dual-chat-panel-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    margin-bottom: 12px;
}

.dual-chat-panel-header.gemini {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.dual-chat-panel-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 80px;
    background: #ffffff;
    border-radius: 0 0 12px 12px;
}

/* Dark mode for dual chat */
.dark .dual-chat-panel-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.dark .dual-chat-panel-header.gemini {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.dark .dual-chat-panel-messages {
    background: #1f2937;
}

/* Responsive - ensure minimum height on small screens */
@media (max-width: 768px) {
    .dual-chat-panel {
        min-height: 250px;
    }
}

/* Desktop layout - Side by side (ngang) cho màn hình lớn */
@media (min-width: 1024px) {
    .dual-chat-container {
        flex-direction: row;
        gap: 20px;
    }
    
    .dual-chat-panel {
        flex: 1;
        min-width: 0;
        max-width: 50%;
    }
}

/* Dual chat messages - adjust spacing */
.dual-chat-mode .message {
    margin-bottom: 12px !important;
}

/* Hide user messages duplication in dual mode */
.dual-chat-mode .message.user-message {
    display: none;
}

.dual-chat-panel .message.user-message {
    display: flex !important;
}

/* ============================================
   QUICK MODEL & CONFIG HIGHLIGHT
   ============================================ */

/* Quick Model Dropdown */
.quick-model-option {
    transition: all 0.2s;
}

.quick-model-option:hover {
    background-color: #f0f9ff;
}

.quick-model-option.active-model {
    background-color: #2563eb;
    color: white;
    font-weight: 600;
}

.quick-model-option.active-model:hover {
    background-color: #1d4ed8;
}

/* Config Option Active State */
.config-option.active-config {
    background-color: #2563eb;
    color: white;
    font-weight: 600;
}

.config-option.active-config:hover {
    background-color: #1d4ed8;
}

.config-option.active-config svg {
    color: white;
}
