/* Prevent body scroll */
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    max-height: 100vh;
}

html {
    overflow: hidden;
    height: 100vh;
    max-height: 100vh;
}

/* Chat Interface Styles */
.chat-container {
    height: 100vh;
    max-height: 100vh;
    background: #0f0f0f;
    padding: 0;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* Conversation Sidebar Styles */
.conversation-sidebar {
    width: 300px;
    background: #1a1a1a;
    border-right: 1px solid #333;
    overflow-y: auto;
    flex-shrink: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
    position: relative;
}

.conversation-sidebar.hidden {
    transform: translateX(-100%);
}

.main-chat-area.sidebar-hidden {
    margin-left: -300px;
}

/* Show Toggle Button when sidebar is hidden */
.sidebar-show-toggle {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border: none;
    color: white;
    padding: 12px 8px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    z-index: 1002;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(-100%);
}

.sidebar-show-toggle.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.sidebar-show-toggle:hover {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    transform: translateY(-50%) translateX(0) scale(1.05);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.sidebar-show-toggle:active {
    transform: translateY(-50%) translateX(0) scale(0.95);
}

/* Style the sidebar icon */
.sidebar-show-toggle svg {
    color: white;
    transition: all 0.3s ease;
}

.sidebar-show-toggle:hover svg {
    transform: scale(1.1);
    color: #f0f9ff;
}

.conversation-header {
    padding: 1rem;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #222;
    position: sticky;
    top: 0;
    z-index: 101;
}

.conversation-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.new-chat-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.new-chat-btn svg {
    width: 16px;
    height: 16px;
}

.conversations-list {
    padding: 0.5rem;
    height: calc(100vh - 160px);
    overflow-y: auto;
}

.conversation-item {
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.25rem;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid transparent;
    color: #e5e5e5;
}

.conversation-item:hover {
    background: #2a2a2a;
    border-color: #333;
    color: #f5f5f5;
}

.conversation-item.active {
    background: #2563eb;
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.conversation-item.active:hover {
    background: #1d4ed8;
}

.conversation-title {
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    padding-right: 2rem;
    cursor: pointer;
}

.conversation-title:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}

.conversation-title-input {
    background: #2a2a2a;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    color: #e5e5e5;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 4px 6px;
    width: calc(100% - 3rem);
    outline: none;
    font-family: inherit;
}

.conversation-title-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.conversation-date {
    font-size: 0.75rem;
    opacity: 0.7;
    color: inherit;
    cursor: pointer;
}

.conversation-date:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}

.conversation-date-input {
    background: #2a2a2a;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    color: #e5e5e5;
    font-size: 0.75rem;
    padding: 4px 6px;
    width: calc(100% - 3rem);
    outline: none;
    font-family: inherit;
}

.conversation-date-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.conversation-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: all 0.2s ease;
}

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

.edit-title-conversation,
.edit-date-conversation,
.delete-conversation {
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.edit-title-conversation:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    opacity: 1;
    transform: scale(1.1);
}

.edit-date-conversation:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    opacity: 1;
    transform: scale(1.1);
}

.delete-conversation:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    opacity: 1;
    transform: scale(1.1);
}

.delete-conversation svg {
    width: 14px;
    height: 14px;
}

/* Main Chat Area */
.main-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    transition: margin-left 0.3s ease;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #222;
    border-bottom: 1px solid #333;
    gap: 0.5rem;
}

.sidebar-toggle {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 36px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

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

.sidebar-toggle svg {
    color: white;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover svg {
    transform: scale(1.1);
}

.chat-header h1 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.chat-header p {
    color: #888;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.chat-grid {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    overflow-x: auto;
    padding: 1rem 1rem 160px 1rem;
    scroll-behavior: smooth;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    height: calc(100vh - 180px);
}

/* Custom scrollbar for chat grid */
.chat-grid::-webkit-scrollbar {
    height: 8px;
    margin-top: 10px;
}

.chat-grid::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.chat-grid::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.chat-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.chat-bot {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 320px;
    flex: 1;
    max-width: none;
    overflow: hidden;
    transition: var(--transition);
}

.chat-bot:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Chat selection states */
.chat-bot.dimmed {
    opacity: 0.5;
    transform: scale(0.98);
    transition: all 0.3s ease;
}

.chat-bot.active-target {
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: scale(1.01);
    transition: all 0.3s ease;
}

.chat-bot.active-target .chat-bot-header {
    background: #222;
}

.chat-bot-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #222;
    border-radius: 12px 12px 0 0;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 0.75rem;
    position: relative;
    overflow: hidden;
}

.bot-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.gemini-avatar { 
    background: linear-gradient(135deg, #4285f4, #34a853);
}
.chatgpt-avatar { 
    background: linear-gradient(135deg, #10a37f, #00d4aa);
}
.claude-avatar { 
    background: linear-gradient(135deg, #cc785c, #ff8c69);
}
.grok-avatar { 
    background: linear-gradient(135deg, #1d9bf0, #00bfff);
}

.bot-name {
    font-weight: 600;
    font-size: 1rem;
    color: #ffffff;
}

.bot-status {
    font-size: 0.75rem;
    color: #888;
    margin-left: auto;
}

.bot-status.online {
    color: #10b981;
}

.bot-status.loading {
    color: var(--primary-color);
}

.maximize-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
    color: #888;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.maximize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: scale(1.1);
}

.maximize-btn.minimized .maximize-icon {
    transform: rotate(45deg);
}

/* Maximized chat styles */
.chat-grid.has-maximized .chat-bot:not(.maximized) {
    display: none;
}

.chat-bot.maximized {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 5.5rem;
    z-index: 1000;
    width: auto;
    min-width: auto;
    max-width: none;
    height: auto;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    border: 1px solid #333;
    margin-bottom: 0;
}

.chat-bot.maximized .chat-messages {
    flex: 1;
    height: auto;
    max-height: none;
}

/* Action buttons positioning for maximized chat - align with AI response on left */
.chat-bot.maximized .message-wrapper {
    width: 100%;
}

.chat-bot.maximized .message-actions {
    align-self: flex-start;
    justify-content: flex-start;
    margin-left: 1rem;
    margin-right: auto;
}

/* Action buttons positioning for normal chat - keep aligned with messages */
.chat-bot:not(.maximized) .message-actions {
    align-self: flex-start;
    justify-content: flex-start;
    margin-left: 0.5rem;
}

/* Overlay for maximized state */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: none;
}

.chat-overlay.active {
    display: block;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #1a1a1a;
}

.message {
    max-width: 85%;
    padding: 1rem 1.25rem;
    border-radius: 1.125rem;
    word-wrap: break-word;
    line-height: 1.5;
    animation: messageSlideIn 0.3s ease-out;
}

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

.message.user {
    background: #2563eb;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0.375rem;
}

.message.bot {
    background: #2a2a2a;
    color: #ffffff !important;
    align-self: flex-start;
    border-bottom-left-radius: 0.375rem;
    border: 1px solid #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Markdown formatting styles */
.message.bot h1, .message.bot h2, .message.bot h3 {
    margin: 1rem 0 0.5rem 0;
    color: var(--primary-color);
    font-weight: 600;
}

.message.bot h1 { font-size: 1.25rem; }
.message.bot h2 { font-size: 1.15rem; }
.message.bot h3 { font-size: 1.1rem; }

.message.bot p {
    margin: 0.5rem 0;
    color: #ffffff !important;
}

.message.bot strong {
    font-weight: 600;
    color: #ffffff !important;
}

.message.bot code.inline-code {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    color: #6366f1;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.bot pre {
    background: #2d3748 !important;
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1rem 0;
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.bot pre code {
    background: none !important;
    padding: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    white-space: pre;
    color: #e2e8f0 !important;
}

/* Enhanced syntax highlighting colors */
.message.bot pre[class*="language-"] {
    background: #2d3748 !important;
}

.message.bot code[class*="language-"] {
    background: none !important;
    text-shadow: none;
}

/* Preserve syntax highlighting colors for Prism.js tokens */
.message.bot .token.comment,
.message.bot .token.prolog,
.message.bot .token.doctype,
.message.bot .token.cdata {
    color: #999999 !important;
}

.message.bot .token.punctuation {
    color: #cccccc !important;
}

.message.bot .token.property,
.message.bot .token.tag,
.message.bot .token.boolean,
.message.bot .token.number,
.message.bot .token.constant,
.message.bot .token.symbol,
.message.bot .token.deleted {
    color: #f2777a !important;
}

.message.bot .token.selector,
.message.bot .token.attr-name,
.message.bot .token.string,
.message.bot .token.char,
.message.bot .token.builtin,
.message.bot .token.inserted {
    color: #99cc99 !important;
}

.message.bot .token.operator,
.message.bot .token.entity,
.message.bot .token.url,
.message.bot .language-css .token.string,
.message.bot .style .token.string {
    color: #66cccc !important;
}

.message.bot .token.atrule,
.message.bot .token.attr-value,
.message.bot .token.keyword {
    color: #cc99cc !important;
}

.message.bot .token.function,
.message.bot .token.class-name {
    color: #ffcc66 !important;
}

.message.bot .token.regex,
.message.bot .token.important,
.message.bot .token.variable {
    color: #f99157 !important;
}

/* Add language label */
.message.bot pre[class*="language-"]:before {
    content: attr(class);
    content: attr(data-language);
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0 8px 0 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.message.bot ul, .message.bot ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message.bot li {
    margin: 0.25rem 0;
    line-height: 1.5;
    color: #ffffff !important;
}

/* Ensure all text within bot messages is visible, but exclude code elements */
.message.bot, 
.message.bot *:not(code):not(pre):not(.token) {
    color: #ffffff !important;
}

/* Override for specific elements that should have different colors */
.message.bot h1, 
.message.bot h2, 
.message.bot h3 {
    color: var(--primary-color) !important;
}

.message.bot ul li {
    list-style-type: disc;
}

.message.bot ol li {
    list-style-type: decimal;
}

.message.loading {
    background: #2a2a2a;
    align-self: flex-start;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    color: #e5e5e5;
    border: 1px solid #333;
    border-bottom-left-radius: 0.375rem;
    max-width: 85%;
    padding: 1rem 1.25rem;
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Like/Dislike Button Animations */
@keyframes likeAnimation {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3) rotate(-10deg);
    }
    50% {
        transform: scale(1.4) rotate(5deg);
    }
    75% {
        transform: scale(1.2) rotate(-2deg);
    }
    100% {
        transform: scale(1.1);
    }
}

@keyframes dislikeAnimation {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3) rotate(10deg);
    }
    50% {
        transform: scale(1.4) rotate(-5deg);
    }
    75% {
        transform: scale(1.2) rotate(2deg);
    }
    100% {
        transform: scale(1.1);
    }
}

/* Pulse effect for active states */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

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

.input-section {
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    padding: 1rem;
    position: fixed;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    border: 1px solid #333;
    max-width: 800px;
    width: calc(100% - 2rem);
    z-index: 1001;
    transition: box-shadow 0.3s ease;
    overflow: visible;
}

.input-section.draggable {
    cursor: move;
    user-select: none;
}

.input-section.dragging {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: none;
    opacity: 0.9;
}

.input-section .drag-handle {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 6px;
    background: var(--text-light);
    border-radius: 3px;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.input-section.draggable .drag-handle {
    opacity: 1;
}

.input-section .drag-handle:active {
    cursor: grabbing;
}

/* Button Group Styles */
.button-group {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    overflow: visible;
}

/* Dropdown Styles */
.dropdown-container {
    position: relative;
    min-width: 70px;
    max-width: 80px;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.6rem;
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border: none;
    border-radius: 8px;
    color: #e5e5e5;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
    font-weight: 500;
    height: 45px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.dropdown-toggle:hover {
    background: linear-gradient(135deg, #333, #2a2a2a);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px) scale(1.02);
}

.dropdown-toggle.open {
    border-color: #2563eb;
    background: #333;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.selected-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.2s ease;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Handle both emoji and image icons in selected state */
.selected-icon:not(img) {
    font-size: 1.1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-toggle:hover .selected-icon {
    transform: scale(1.1);
}

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

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    color: #888;
    transform: rotate(0deg); /* Default: arrow points up */
    position: absolute;
    bottom: 4px;
    right: 4px;
}

.dropdown-toggle.open .dropdown-arrow {
    transform: rotate(180deg); /* When open: arrow points down */
    color: #2563eb;
}

.dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    min-width: 220px;
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    margin-bottom: 0.25rem;
    backdrop-filter: blur(10px);
    pointer-events: none;
    overflow: visible;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
    white-space: nowrap;
    color: #e5e5e5;
    background: transparent;
}

.dropdown-option:last-child {
    border-bottom: none;
}

.dropdown-option:hover {
    background: #333;
    transform: translateX(4px);
}

.dropdown-option.active {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    border-left: 3px solid #2563eb;
}

.dropdown-option.active:hover {
    background: rgba(37, 99, 235, 0.25);
}

.dropdown-option .option-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Handle both emoji and image icons */
.dropdown-option .option-icon:not(img) {
    font-size: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropdown-option .option-text {
    flex: 1;
    font-weight: 500;
}

.dropdown-option .option-shortcut {
    font-size: 0.75rem;
    color: #888;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
}

.dropdown-option.active .option-shortcut {
    background: rgba(37, 99, 235, 0.3);
    color: #93c5fd;
}

@keyframes pulse-icon {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Selection change animation */
@keyframes selection-change {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.selector-option.active {
    animation: selection-change 0.6s ease-out;
}

.input-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.input-field {
    flex: 1;
    min-height: 45px;
    padding: 0.75rem 1rem;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    transition: var(--transition);
    background: #2a2a2a;
    color: #e5e5e5;
    line-height: 1.4;
}

.input-field:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-field::placeholder {
    color: #888;
}

.send-button {
    padding: 0.75rem;
    background: linear-gradient(135deg, #000000, #1a1a1a);
    color: white;
    border: none;
    border-radius: 50%;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    min-width: 45px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.send-button svg {
    transition: all 0.3s ease;
    stroke-width: 2.5;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
}

.send-button:hover:not(:disabled) svg {
    transform: translateX(2px) scale(1.1);
}

.send-button:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Improve Prompt Button */
.improve-prompt-button {
    padding: 0.75rem;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: white;
    border: none;
    border-radius: 50%;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    min-width: 45px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    position: relative;
    overflow: hidden;
}

.improve-prompt-button svg {
    transition: all 0.3s ease;
    stroke-width: 2.5;
}

.improve-prompt-button:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.improve-prompt-button:hover:not(:disabled) svg {
    transform: scale(1.1);
    animation: pulse-layers 1.5s infinite;
}

.improve-prompt-button:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.improve-prompt-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.improve-prompt-button.processing {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    animation: processing-pulse 2s infinite;
}

@keyframes pulse-layers {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(1.2); }
}

@keyframes processing-pulse {
    0%, 100% { 
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    }
    50% { 
        box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
    }
}

/* Tech Animation Overlay */
.tech-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: none;
    backdrop-filter: blur(8px);
}

.tech-animation-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 300px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #0f3460;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(15, 52, 96, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tech-animation-title {
    color: #64ffda;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    animation: glow-text 2s infinite alternate;
}

@keyframes glow-text {
    from { text-shadow: 0 0 5px #64ffda, 0 0 10px #64ffda; }
    to { text-shadow: 0 0 10px #64ffda, 0 0 20px #64ffda, 0 0 30px #64ffda; }
}

.neural-network {
    width: 200px;
    height: 150px;
    position: relative;
    margin: 1rem 0;
}

.neural-node {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #64ffda;
    border-radius: 50%;
    box-shadow: 0 0 10px #64ffda;
    animation: node-pulse 2s infinite;
}

.neural-connection {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, #0891b2, transparent);
    animation: data-flow 3s infinite;
    transform-origin: left center;
}

@keyframes node-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 10px #64ffda;
    }
    50% { 
        transform: scale(1.3);
        box-shadow: 0 0 20px #64ffda, 0 0 30px #64ffda;
    }
}

@keyframes data-flow {
    0% { 
        background: linear-gradient(90deg, transparent, transparent, transparent);
    }
    50% { 
        background: linear-gradient(90deg, transparent, #0891b2, transparent);
    }
    100% { 
        background: linear-gradient(90deg, transparent, transparent, transparent);
    }
}

.code-stream {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0.3;
}

.code-line {
    position: absolute;
    color: #22d3ee;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    white-space: nowrap;
    animation: stream-flow 4s linear infinite;
}

@keyframes stream-flow {
    0% { 
        transform: translateX(-100%);
        opacity: 0;
    }
    10% { 
        opacity: 1;
    }
    90% { 
        opacity: 1;
    }
    100% { 
        transform: translateX(100%);
        opacity: 0;
    }
}

.processing-text {
    color: #64ffda;
    font-size: 1rem;
    text-align: center;
    margin-top: 1rem;
    animation: typing 3s infinite;
}

@keyframes typing {
    0%, 100% { content: "Analyzing prompt..."; }
    33% { content: "Enhancing clarity..."; }
    66% { content: "Optimizing structure..."; }
}

.processing-text::after {
    content: "Analyzing prompt...";
    animation: typing-content 3s infinite;
}

@keyframes typing-content {
    0%, 33% { content: "Analyzing prompt..."; }
    34%, 66% { content: "Enhancing clarity..."; }
    67%, 100% { content: "Optimizing structure..."; }
}

/* Plus Dropdown Styles */
.plus-dropdown-container {
    position: relative;
    display: flex;
    align-items: center;
}

.plus-button {
    padding: 0.75rem;
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    border: none;
    border-radius: 50%;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    min-width: 45px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
    position: relative;
    overflow: visible;
}

.plus-button svg {
    transition: all 0.3s ease;
    stroke-width: 2.5;
}

.plus-button:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.4);
    background: linear-gradient(135deg, #10b981, #059669);
}

.plus-button:hover:not(:disabled) svg {
    transform: rotate(90deg) scale(1.1);
}

.plus-button:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.plus-button.active {
    background: linear-gradient(135deg, #10b981, #059669);
    transform: translateY(-2px);
}

.plus-button.active svg {
    transform: rotate(45deg);
}

/* Selected Features Icons */
.selected-features {
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    max-width: 30px;
}

.feature-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    border: 1px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    animation: pulse-indicator 2s infinite;
}

@keyframes pulse-indicator {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

/* Dropdown Menu */
.plus-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1f2937, #374151);
    border: 1px solid #4b5563;
    border-radius: 12px;
    padding: 0.5rem 0;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.plus-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.plus-dropdown-menu::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #374151;
}

/* Dropdown Items */
.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #e5e5e5;
    border-left: 3px solid transparent;
}

.dropdown-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    transform: translateX(4px);
}

.dropdown-item.active {
    background: rgba(34, 197, 94, 0.15);
    border-left-color: #22c55e;
    color: #22c55e;
}

.dropdown-item.active .dropdown-item-icon svg {
    stroke: #22c55e;
}

.dropdown-item-icon {
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.dropdown-item-icon svg {
    transition: all 0.2s ease;
}

.dropdown-item-text {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Think Longer Status */
.thinking-longer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: none;
    backdrop-filter: blur(4px);
}

.thinking-longer-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.thinking-longer-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    animation: thinking-pulse 2s infinite;
}

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

.thinking-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.thinking-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #06b6d4, #0891b2);
    border-radius: 2px;
    animation: thinking-progress 10s linear infinite;
}

@keyframes thinking-progress {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* .back-button {
    position: fixed !important;
    top: 1rem !important;
    right: 1rem !important;
    left: auto !important;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 50%, #1e40af 100%) !important;
    border: none !important;
    color: #ffffff !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: 12px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    line-height: 1 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    backdrop-filter: blur(20px) !important;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    min-width: auto !important;
    height: auto !important;
}

.back-button:hover {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%) !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
} */

/* Mobile responsive adjustments for back button */
/* @media (max-width: 768px) { */
    /* .back-button {
        top: 0.75rem;
        right: 0.75rem;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }
    
    .back-button:hover {
        transform: translateY(-1px) scale(1.02);
    }
}

.back-button:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.4);
} */

.clear-button {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    width: 45px;
    height: 45px;
    min-width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    position: relative;
    overflow: hidden;
}

.clear-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.clear-button:hover svg {
    transform: scale(1.1);
}

.clear-button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.clear-button svg {
    transition: all 0.3s ease;
    stroke-width: 2.5;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 120px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: #2a2a2a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: #888;
    margin-top: 0.25rem;
}

/* Responsive Design for Chat */
@media (max-width: 1200px) {
    .chat-bot {
        min-width: 300px;
        height: 450px;
    }
}

@media (max-width: 768px) {
    /* Keep the same layout but make it responsive */
    .chat-container {
        flex-direction: row; /* Keep horizontal layout */
        height: 100vh;
        overflow: hidden;
    }
    
    .conversation-sidebar {
        width: 280px; /* Slightly smaller width for tablets */
        min-width: 280px;
        max-width: 280px;
        height: 100vh;
        position: relative;
        border-right: 1px solid #333;
        flex-shrink: 0;
    }
    
    .conversation-header {
        padding: 0.75rem 1rem;
    }
    
    .conversation-header h3 {
        font-size: 0.95rem;
    }
    
    .new-chat-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .conversations-list {
        padding: 0.5rem;
        height: calc(100vh - 120px);
        overflow-y: auto;
        flex-direction: column;
    }
    
    .conversation-item {
        min-width: auto;
        flex-shrink: 0;
        margin-bottom: 0.5rem;
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
    }
    
    .main-chat-area {
        flex: 1;
        height: 100vh;
        overflow: hidden;
        margin-left: 0;
    }
    
    .main-chat-area.sidebar-hidden {
        margin-left: -280px !important; /* Match mobile sidebar width */
    }
    
    .conversation-sidebar.hidden {
        transform: translateX(-100%); /* Keep sliding to left */
    }
    
    .chat-grid {
        gap: 0.75rem;
        padding: 1rem 0.75rem 160px 0.75rem;
        height: calc(100vh - 180px);
    }
    
    .sidebar-header {
        flex-direction: row; /* Keep horizontal layout */
        gap: 0.5rem;
        padding: 0.75rem;
        justify-content: space-between;
    }
    
    .sidebar-toggle {
        order: 0;
        align-self: auto;
        min-width: 36px;
        height: 32px;
        padding: 0.4rem 0.6rem;
    }
    
    .sidebar-show-toggle {
        left: 8px;
        width: 36px;
        height: 36px;
    }
    
    .chat-bot {
        min-width: 280px;
        height: 100%;
    }
    
    .input-section {
        margin: 0 0.75rem;
        padding: 1rem;
        max-width: none;
    }
    
    .button-group {
        flex-direction: row; /* Keep horizontal layout */
        align-items: center;
        gap: 0.75rem;
    }
    
    .dropdown-container {
        min-width: 60px;
        max-width: 70px;
        order: 0;
    }
    
    .dropdown-toggle {
        padding: 0.55rem;
        font-size: 0.8rem;
        height: 42px;
    }
    
    .selected-icon {
        width: 22px;
        height: 22px;
    }
    
    .dropdown-option {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .dropdown-option .option-shortcut {
        font-size: 0.7rem;
        padding: 0.15rem 0.3rem;
    }
    
    .selected-text {
        display: inline; /* Keep text visible */
    }
    
    .improve-prompt-button,
    .send-button {
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 0.65rem;
    }
    
    .improve-prompt-button svg,
    .send-button svg {
        width: 16px;
        height: 16px;
    }
    
    .clear-button {
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 0.65rem;
    }
}

/* For mobile phones - keep same layout but optimize for small screens */
@media (max-width: 480px) {
    .conversation-sidebar {
        width: 260px; /* Smaller sidebar for phones */
        min-width: 260px;
        max-width: 260px;
    }
    
    .chat-bot {
        min-width: 240px;
        height: 100%;
    }
    
    .chat-grid {
        padding: 0.75rem 0.5rem 160px 0.5rem;
        height: calc(100vh - 180px);
        gap: 0.5rem;
    }
    
    .main-chat-area {
        height: 100vh;
        margin-left: 0;
    }
    
    .main-chat-area.sidebar-hidden {
        margin-left: -260px !important; /* Match mobile sidebar width */
    }
    
    .sidebar-header {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .sidebar-toggle {
        min-width: 32px;
        height: 28px;
        padding: 0.3rem 0.5rem;
    }
    
    .new-chat-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .conversation-item {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }
    
    .sidebar-show-toggle {
        left: 5px;
        width: 32px;
        height: 32px;
    }
    
    .input-section {
        margin: 0 0.5rem;
        padding: 0.75rem;
    }
    
    .input-container {
        flex-direction: row; /* Keep horizontal layout */
        align-items: center;
        gap: 0.5rem;
    }
    
    .input-field {
        min-height: 40px;
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .button-group {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }
    
    .dropdown-container {
        min-width: 55px;
        max-width: 65px;
    }
    
    .dropdown-toggle {
        padding: 0.5rem;
        font-size: 0.75rem;
        height: 40px;
    }
    
    .selected-icon {
        width: 20px;
        height: 20px;
    }
    
    .send-button {
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0.6rem;
    }
    
    .clear-button {
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0.6rem;
    }
}

/* Extra small screens (very small phones) */
@media (max-width: 360px) {
    .conversation-sidebar {
        width: 240px;
        min-width: 240px;
        max-width: 240px;
    }
    
    .chat-bot {
        min-width: 220px;
    }
    
    .chat-grid {
        padding: 0.5rem 0.25rem 160px 0.25rem;
        gap: 0.25rem;
    }
    
    .main-chat-area.sidebar-hidden {
        margin-left: -240px !important; /* Match extra small sidebar width */
    }
    
    .sidebar-header {
        padding: 0.4rem;
    }
    
    .new-chat-btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }
    
    .dropdown-container {
        min-width: 50px;
        max-width: 60px;
    }
    
    .send-button {
        width: 38px;
        height: 38px;
        min-width: 38px;
        padding: 0.5rem;
    }
    
    .clear-button {
        width: 38px;
        height: 38px;
        min-width: 38px;
        padding: 0.5rem;
    }
}

/* Landscape orientation on mobile devices */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-grid {
        height: calc(100vh - 140px);
        padding: 0.5rem 0.5rem 120px 0.5rem;
    }
    
    .input-section {
        padding: 0.5rem;
    }
    
    .conversation-sidebar {
        width: 220px;
        min-width: 220px;
        max-width: 220px;
    }
    
    .main-chat-area.sidebar-hidden {
        margin-left: -220px !important; /* Match landscape sidebar width */
    }
    
    .conversations-list {
        height: calc(100vh - 100px);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .sidebar-show-toggle svg,
    .sidebar-toggle svg {
        stroke-width: 1.5;
    }
}

/* Ensure touch targets are large enough on touch devices */
@media (pointer: coarse) {
    .sidebar-toggle,
    .sidebar-show-toggle,
    .new-chat-btn,
    .plus-button,
    .send-button,
    .clear-button,
    .edit-title-conversation,
    .edit-date-conversation,
    .delete-conversation {
        min-height: 44px;
        min-width: 44px;
    }
    
    .conversation-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .conversation-actions {
        position: relative;
        opacity: 1;
        margin-left: auto;
        padding-left: 0.5rem;
    }
    
    /* Improve touch scrolling */
    .conversations-list,
    .chat-messages,
    .chat-grid {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Prevent zoom on input focus on iOS */
    .input-field,
    .dropdown-toggle {
        font-size: 16px;
    }
    
    /* Tech Animation Mobile Styles */
    .tech-animation-container {
        width: 90%;
        height: 60%;
        max-width: 350px;
        max-height: 250px;
        padding: 1rem;
    }
    
    .tech-animation-title {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .neural-network {
        width: 150px;
        height: 100px;
        transform: scale(0.8);
    }
    
    .processing-text {
        font-size: 0.9rem;
    }
    
    /* Plus Dropdown Mobile Styles */
    .plus-button {
        width: 42px;
        height: 42px;
        min-width: 42px;
        padding: 0.65rem;
    }
    
    .plus-button svg {
        width: 16px;
        height: 16px;
    }
    
    .plus-dropdown-menu {
        min-width: 180px;
        left: 0;
        transform: none;
    }
    
    .plus-dropdown-menu.show {
        transform: translateY(0) scale(1);
    }
    
    .plus-dropdown-menu::before {
        left: 20px;
        transform: none;
    }
    
    .dropdown-item {
        padding: 0.8rem 1rem;
    }
    
    .dropdown-item-text {
        font-size: 0.85rem;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .chat-container {
        height: 100vh;
        height: -webkit-fill-available;
    }
    
    .main-chat-area,
    .conversation-sidebar {
        height: 100vh;
        height: -webkit-fill-available;
    }
    
    .chat-grid {
        height: calc(100vh - 180px);
        height: calc(-webkit-fill-available - 180px);
    }
}

/* Android Chrome address bar handling */
@media screen and (max-width: 768px) {
    .chat-container {
        min-height: 100vh;
        min-height: 100dvh;
    }
}
    
    .back-button {
        top: 1rem;
        left: 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }
    
    .stats-bar {
        gap: 0.75rem;
    }
    
    .stat-item {
        padding: 0.5rem 0.75rem;
        min-width: 90px;
    }
    
    .stat-number {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }


/* Message Wrapper for bot messages */
.message-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1rem;
}

/* Loading Wrapper */
.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1rem;
}

/* Response Action Buttons */
.message-actions {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: relative;
    align-self: flex-start;
}

/* Show actions when hovering over the message wrapper */
.message-wrapper:hover .message-actions,
.message-actions:hover {
    opacity: 1;
}

.action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 14px;
    color: #ffffff;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.action-btn.copy-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.5);
    color: #60a5fa;
}

.action-btn.like-btn:hover {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
    color: #4ade80;
}

.action-btn.like-btn.liked {
    background: rgba(34, 197, 94, 0.4);
    border-color: rgba(34, 197, 94, 0.7);
    color: #22c55e;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
    animation: likeAnimation 0.6s ease-out;
}

.action-btn.dislike-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
}

.action-btn.dislike-btn.disliked {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.7);
    color: #ef4444;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
    animation: dislikeAnimation 0.6s ease-out;
}

/* Copy feedback tooltip */
.copy-feedback {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    z-index: 1000;
}

.copy-feedback.show {
    opacity: 1;
}

.copy-feedback::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

/* Enhanced action feedback tooltips */
.action-feedback {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    top: -45px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-feedback.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.action-feedback.like-feedback {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(22, 163, 74, 0.95));
    border-color: rgba(34, 197, 94, 0.3);
    color: white;
}

.action-feedback.dislike-feedback {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    border-color: rgba(239, 68, 68, 0.3);
    color: white;
}

.action-feedback::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.action-feedback.like-feedback::after {
    border-top-color: rgba(34, 197, 94, 0.95);
}

.action-feedback.dislike-feedback::after {
    border-top-color: rgba(239, 68, 68, 0.95);
}

/* Custom Link Styles - Scoped to bot messages */
.message.bot .custom-link {
    color: #60a5fa !important;
    text-decoration: underline;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 2px 6px;
    border-radius: 6px;
    position: relative;
    display: inline;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(96, 165, 250, 0.3);
    font-weight: 500;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 100%;
}

.message.bot .custom-link:hover {
    color: #93c5fd !important;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.25), rgba(59, 130, 246, 0.2));
    border-color: rgba(96, 165, 250, 0.5);
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.4);
}

.message.bot .custom-link:active {
    transform: scale(0.98);
}

/* Link Options Menu */
.link-options-menu {
    position: absolute;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    min-width: 160px;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.link-options-menu.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.link-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #333;
    color: #e5e5e5;
    font-size: 0.9rem;
    font-weight: 500;
}

.link-option:last-child {
    border-bottom: none;
}

.link-option:hover {
    background: #333;
    color: #ffffff;
    transform: translateX(4px);
}

.link-option:active {
    background: #444;
    transform: translateX(2px);
}

.link-option-icon {
    margin-right: 12px;
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.link-option-text {
    flex: 1;
}

/* Link Feedback Notification */
.link-feedback {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 300px;
    backdrop-filter: blur(10px);
}

.link-feedback.show {
    opacity: 1;
    transform: translateX(0);
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}
