/* --- START OF FILE Chatalpha-main/static/css/style.css --- */

html, body {
    height: 100%;
    overflow: hidden;
}
body { font-family: 'Vazirmatn', 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }
.custom-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(209, 213, 219, 0.7); border-radius: 10px; }
.dark .custom-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(107, 114, 128, 0.5); }
.hidden { display: none !important; }
#history-sidebar, #confirm-modal-content, #rename-modal-content, #edit-modal-content, #html-preview-content, #settings-modal-content { transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1); }
#sidebar-overlay, #confirm-modal-overlay, #rename-modal-overlay, #edit-modal-overlay, #html-preview-overlay, #settings-modal #settings-modal-overlay { transition: opacity 300ms ease-in-out; }
#modal-content { transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes fade-slide-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message-entry { animation: fade-slide-in 300ms ease-out forwards; }
.typing-indicator span { height: 8px; width: 8px; background-color: #9ca3af; border-radius: 50%; display: inline-block; animation: typing-blink 1.4s infinite both; }
.dark .typing-indicator span { background-color: #6b7280; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-blink { 0% { opacity: 0.2; } 20% { opacity: 1; } 100% { opacity: 0.2; } }

/* === استایل بلوک کد === */
.prose pre {
    position: relative;
    background-color: #282c34;
    border-radius: 0.75rem;
    padding-top: 2.8rem;
    overflow-x: auto;
    margin-top: 1em;
    margin-bottom: 1em;
    direction: ltr;
    text-align: left;
}
.prose pre code {
    white-space: pre;
    word-break: normal;
    display: block;
    padding: 0.75rem 1rem;
    direction: ltr;
    text-align: left;
}
.code-button-container {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}
.prose pre:hover .code-button-container {
    opacity: 1;
}
.code-button {
    padding: 0.25rem 0.6rem;
    background-color: rgba(75, 85, 99, 0.8);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: background-color 0.2s;
}
.code-button:hover { background-color: rgba(107, 114, 128, 0.8); }
.code-button:active { background-color: #4b5563; }

/* === استایل دکمه‌های اکشن پیام === */
.message-actions { opacity: 0; transition: opacity 0.3s ease-in-out; position: absolute; bottom: -1rem; left: 0; display: flex; align-items: center; }
.group:hover .message-actions { opacity: 1; }
.action-button { padding: 0.375rem; border-radius: 9999px; background-color: rgba(255, 255, 255, 0.7); backdrop-filter: blur(4px); border: 1px solid #e5e7eb; color: #6b7280; transition: all 0.2s; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.dark .action-button { background-color: rgba(55, 65, 81, 0.7); border-color: #4b5563; color: #9ca3af; }
.action-button:hover { color: #1f2937; background-color: rgba(243, 244, 246, 0.9); border-color: #d1d5db; }
.dark .action-button:hover { color: #e5e7eb; background-color: rgba(75, 85, 99, 0.9); border-color: #6b7280; }
.action-button.active { color: #3b82f6; border-color: #93c5fd; background-color: #eff6ff; }
.dark .action-button.active { color: #60a5fa; border-color: #3b82f6; background-color: #1e3a8a; }
.like-animation { animation: like-pop 0.4s ease-in-out; }
@keyframes like-pop { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }
.action-button .copy-feedback {
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background-color: #1f2937;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
    pointer-events: none;
}
.action-button .copy-feedback.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(-4px);
}

/* === بخش اصلاح شده برای دکمه سه نقطه و منو === */

/* 1. اطمینان از کلیک‌خور بودن دکمه سه نقطه */
.history-item-button { 
    opacity: 1; 
    position: relative; /* برای کار کردن z-index */
    z-index: 50; /* بالاتر از متن آیتم */
    cursor: pointer;
    padding: 8px; /* فضای کلیک بیشتر */
    margin: -8px; /* جبران فضای اضافه شده */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 2. حذف استایل‌های مزاحم لیست */
#history-list, #history-list li {
    list-style-type: none !important;
    padding: 0;
    margin: 0;
}

/* 3. تنظیمات جدید و قدرتمند برای منوی بازشونده */
#history-item-menu { 
    position: fixed !important; /* حتما fixed باشد */
    top: 0; left: 0; /* پیش‌فرض */
    z-index: 2147483647 !important; /* بالاترین لایه ممکن در مرورگر */
    transform-origin: top right; 
    transform: scale(0.95); 
    opacity: 0; 
    visibility: hidden; /* مخفی کردن کامل */
    transition: transform 150ms ease-out, opacity 150ms ease-out, visibility 0s linear 150ms; /* تاخیر در visibility هنگام بسته شدن */
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.dark #history-item-menu {
    background-color: #1f2937;
    border: 1px solid #374151;
}

/* کلاس نمایش منو */
#history-item-menu.visible { 
    transform: scale(1); 
    opacity: 1; 
    visibility: visible !important; /* نمایش فوری */
    pointer-events: auto; 
    transition: transform 150ms ease-out, opacity 150ms ease-out, visibility 0s; /* بدون تاخیر هنگام باز شدن */
}

#message-item-menu { transition: opacity 200ms ease-in-out; }
#message-item-menu-content { transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1); transform: scale(0.95); opacity: 0; }
#message-item-menu.visible { opacity: 1; }
#message-item-menu.visible #message-item-menu-content { transform: scale(1); opacity: 1; }
.message-preview-container { padding: 0.75rem 1rem; border-bottom: 1px solid #e5e7eb; margin-bottom: 0.5rem; }
.dark .message-preview-container { border-bottom-color: #374151; }
.message-preview-text { font-size: 0.875rem; color: #6b7280; line-height: 1.5; max-height: 4.5rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-overflow: ellipsis; }
.dark .message-preview-text { color: #d1d5db; }

#confirm-modal-content, #rename-modal-content, #edit-modal-content, #html-preview-content { transform: scale(0.95); opacity: 0; }

#message-input, #edit-input { resize: none; overflow-y: auto; max-height: 120px; line-height: 1.5; padding-top: 10px; padding-bottom: 10px; }

#app-container { display: flex; flex-direction: column; }
#main-header, #main-footer { position: static; flex-shrink: 0; }
#chat-window { flex-grow: 1; }

#html-preview-modal { position: fixed; inset: 0; background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 60; }
#html-preview-content { background-color: #fff; border-radius: 1rem; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3); width: 100%; height: 90%; max-width: 800px; display: flex; flex-direction: column; overflow: hidden; transform: scale(0.95); opacity: 0; }
#html-preview-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid #e2e8f0; background-color: #f8fafc; }
.dark #html-preview-header { border-bottom-color: #374151; background-color: #1f2937; }
#html-preview-iframe-container { flex-grow: 1; overflow: hidden; }
#html-preview-iframe { width: 100%; height: 100%; border: none; background-color: #fff; }

.message-entry p.whitespace-pre-wrap {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

.prose {
    overflow-wrap: break-word;
    word-break: break-word;
}
.dark .prose { --tw-prose-body: #d1d5db; --tw-prose-headings: #fff; --tw-prose-lead: #9ca3af; --tw-prose-links: #fff; --tw-prose-bold: #fff; --tw-prose-counters: #9ca3af; --tw-prose-bullets: #4b5563; --tw-prose-hr: #374151; --tw-prose-quotes: #f3f4f6; --tw-prose-quote-borders: #374151; --tw-prose-captions: #9ca3af; --tw-prose-code: #fff; --tw-prose-pre-code: #d1d5db; --tw-prose-pre-bg: #1f2937; --tw-prose-th-borders: #4b5563; --tw-prose-td-borders: #374151; }

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
    margin-bottom: 1em;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    min-width: 100%;
    table-layout: auto;
}

.prose th,
.prose td {
    border: 1px solid #e2e8f0;
    padding: 0.75em 0.5em;
    text-align: right;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
}
.dark .prose th, .dark .prose td { border-color: #4b5563; }

.prose th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #334155;
}
.dark .prose th { background-color: #374151; color: #d1d5db; }

.prose tr:nth-child(even) {
    background-color: #fcfdfe;
}
.dark .prose tr:nth-child(even) { background-color: #1f2937; }

@media (max-width: 768px) {
    .prose th,
    .prose td {
        font-size: 0.85rem;
        padding: 0.6em 0.4em;
    }
}

#image-preview-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    width: fit-content;
}
#image-preview-container.hidden { display: none !important; }

#file-info-text {
    font-size: 0.875rem;
    color: #475569;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark #file-info-text {
    color: #cbd5e1;
}

/* === استایل‌های صفحه خوش‌آمدگویی === */
.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    overflow-x: hidden;
    box-sizing: border-box;
}

.welcome-container {
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.chatbot-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #0ea5e9, #6f42c1, #fd7e14);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    display: inline-block;
    line-height: 1.2;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    animation: gradient-flow 8s linear infinite alternate;
}

@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.main-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: #2c3e50;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.8s ease-in;
}
.dark .main-title { color: #e5e7eb; }

/* === استایل‌های جدید برای دکمه‌های پیشنهادی (بدون کارت پس‌زمینه) === */
.suggestions-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.suggestion-button {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid #eef0f2;
    border-radius: 40px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease-in-out;
}
.dark .suggestion-button {
    background-color: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.suggestion-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    border-color: #e0e2e5;
}
.dark .suggestion-button:hover {
    background-color: #4b5563;
    border-color: #6b7280;
}
        
.suggestion-button:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.suggestion-button svg {
    width: 20px;
    height: 20px;
    margin-left: 10px;
}

@media (max-width: 480px) {
    .chatbot-name, .main-title { font-size: 1.5rem; }
    .suggestion-button { padding: 10px 14px; font-size: 14px; }
}

#image-gallery-modal {
    transition: opacity 300ms ease-in-out;
}
#image-gallery-modal.hidden {
    pointer-events: none;
}
#image-gallery-modal.visible {
    opacity: 1;
}
#image-gallery-modal.visible #image-gallery-content {
    opacity: 1;
    transform: scale(1);
}
#gallery-thumbnails .gallery-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease-in-out;
    opacity: 0.6;
}
#gallery-thumbnails .gallery-thumb:hover {
    opacity: 1;
    transform: scale(1.05);
}
#gallery-thumbnails .gallery-thumb.active {
    border-color: #3b82f6;
    opacity: 1;
    transform: scale(1.1);
}

#gallery-download-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 9999px;
    background: linear-gradient(45deg, #3b82f6, #6366f1);
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
    transition: all 0.3s ease-in-out;
    cursor: pointer;
    min-width: 150px;
    min-height: 48px;
    animation: download-pulse 2.5s infinite;
}
#gallery-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.45);
    animation-play-state: paused;
}
#gallery-download-btn:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 2px 8px 0 rgba(59, 130, 246, 0.3);
}
#gallery-download-btn .typing-indicator span {
    background-color: white;
}
@keyframes download-pulse {
  0% {
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
  }
  50% {
    box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.5);
  }
  100% {
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
  }
}

@keyframes fade-slide-in-button {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.clarification-message {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #1e293b;
}
.dark .clarification-message { background-color: #1f2937; border-color: #374151; color: #d1d5db; }


.clarification-button.glass-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(200, 200, 200, 0.4);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fade-slide-in-button 0.5s ease-out forwards;
    opacity: 0;
}
.dark .clarification-button.glass-button { color: #e5e7eb; background: rgba(55, 65, 81, 0.5); border-color: rgba(107, 114, 128, 0.4); }

.clarification-button.glass-button:nth-of-type(1) {
    animation-delay: 0.1s;
}
.clarification-button.glass-button:nth-of-type(2) {
    animation-delay: 0.2s;
}

.clarification-button.glass-button:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(107, 114, 128, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
}
.dark .clarification-button.glass-button:hover { background: rgba(75, 85, 99, 0.8); border-color: rgba(156, 163, 175, 0.5); }

.clarification-button.glass-button:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: none;
}

.clarification-button.glass-button svg {
    flex-shrink: 0;
    color: #4f46e5;
}
.dark .clarification-button.glass-button svg { color: #818cf8; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #374151;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    cursor: pointer;
    width: 100%;
}
.dark .menu-item { color: #d1d5db; }
.menu-item:hover {
    background-color: #f3f4f6;
}
.dark .menu-item:hover { background-color: #374151; }
.menu-item.danger:hover {
    background-color: #fee2e2;
    color: #b91c1c;
}
.dark .menu-item.danger:hover { background-color: #450a0a; color: #f87171; }
.menu-item svg {
    width: 1.25rem;
    height: 1.25rem;
}
.menu-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0.5rem 0;
}
.dark .menu-divider { background-color: #374151; }

.sidebar-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    width: 100%;
    text-align: right;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    color: #4b5563;
    transition: background-color 0.2s, color 0.2s;
}
.dark .sidebar-button { color: #d1d5db; }
.sidebar-button:hover { background-color: #e5e7eb; color: #1f2937; }
.dark .sidebar-button:hover { background-color: #374151; color: #f9fafb; }
.sidebar-button svg { flex-shrink: 0; }

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}
.dark .slider { background-color: #374151; }
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #4f46e5;
}
input:checked + .slider:before {
    transform: translateX(22px);
}

.message-entry.model {
    align-items: start;
}

.message-entry .message-content.model-bubble {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
}

.thinking-header-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
}

.model-icon-in-bubble {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #334155;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 0.75rem;
}
.dark .model-icon-in-bubble {
    background-color: #475569;
}

.thinking-head {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}
.dark .thinking-head {
    background-color: #334151;
    border-color: #475569;
}

.thinking-atom-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.thinking-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334151;
}
.dark .thinking-label {
    color: #cbd5e1;
}

.thinking-chevron {
    width: 1rem;
    height: 1rem;
    color: #94a3b8;
    transition: transform 0.3s;
}
.thinking-chevron.collapsed {
    transform: rotate(-180deg);
}

.thinking-body {
    max-height: 500px;
    overflow-y: auto;
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    font-size: 0.875rem;
    line-height: 1.6;
    transition: all 0.4s ease-in-out;
}
.dark .thinking-body {
    background-color: #1e293b;
    border-color: #334151;
    color: #e2e8f0;
}
.thinking-body.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border: none;
    margin-top: 0;
    overflow: hidden;
}

.final-answer-wrapper {
     width: 100%;
     transition: opacity 0.5s, transform 0.5s;
}

.message-content.user-bubble-multipart {
    padding: 0;
    overflow: hidden;
}

.user-file-part {
    padding: 8px;
}

.user-file-part.single {
    padding: 0;
}

.user-file-part img,
.user-file-part video {
    width: 100%;
    display: block;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-text-part {
    padding: 10px 16px;
    background-color: rgba(0, 0, 0, 0.1); 
}

.beautiful-upgrade-btn {
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.8rem 2rem;
    border-radius: 9999px;
    color: white;
    background-size: 200% auto;
    background-image: linear-gradient(45deg, #f87171 0%, #fb923c 50%, #f87171 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(251, 146, 60, 0.4);
    transition: all 0.4s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.dark .beautiful-upgrade-btn {
    box-shadow: 0 4px 20px rgba(251, 146, 60, 0.5);
}

.beautiful-upgrade-btn:hover {
    background-position: right center;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(251, 146, 60, 0.5);
}

.beautiful-upgrade-btn:active {
    transform: translateY(0px) scale(1);
    box-shadow: 0 2px 10px rgba(251, 146, 60, 0.3);
}

.premium-modal-content {
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(0.95);
    opacity: 0;
}
#premium-feature-modal.visible .premium-modal-content {
    transform: scale(1);
    opacity: 1;
}
#plus-required-modal.visible .premium-modal-content {
    transform: scale(1);
    opacity: 1;
}

@keyframes icon-float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

#premium-modal-icon-container svg,
#plus-modal-icon-container svg {
    animation: icon-float 3s ease-in-out infinite;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.15));
}

.settings-tier-container {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fade-slide-in 0.5s ease-out;
}
.settings-tier-icon {
    width: 40px;
    height: 40px;
}
.settings-tier-text {
    font-size: 1rem;
    font-weight: 600;
}
.settings-tier-text .tier-name-premium {
    background: linear-gradient(45deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.settings-tier-text .tier-name-free {
    color: #64748b;
}
.dark .settings-tier-text .tier-name-free {
    color: #94a3b8;
}

#main-footer {
    background: none;
}

.chat-input-box {
    display: flex;
    flex-direction: column; 
    justify-content: space-between;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 28px;
    padding: 12px 16px;
    padding-top: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    transform: scale(1);
    transition: all 0.2s ease-out;
}
.dark .chat-input-box {
    background-color: #1f2937;
    border-color: #374151;
}

.chat-input-box:focus-within {
    border-color: #a0a0a0;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: scale(1.01);
}
.dark .chat-input-box:focus-within {
    border-color: #6b7280;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chat-text-input {
    width: 100%;
    border: none;
    outline: none;
    background-color: transparent;
    font-size: 17px;
    font-family: 'Vazirmatn', sans-serif;
    color: #111827;
    padding: 0;
    margin-bottom: 10px;
    resize: none;
    max-height: 150px;
    overflow-y: auto;
}
.dark .chat-text-input {
    color: #f3f4f6;
}

.chat-text-input::placeholder {
    color: #8e8e8e;
}
.dark .chat-text-input::placeholder {
    color: #6b7280;
}

.buttons-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    flex-shrink: 0;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background-color: #f0f2f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #1f2937;
    transition: all 0.3s ease;
}
.dark .icon-button {
    background-color: #374151;
    color: #e5e7eb;
}

.icon-button:hover {
    background-color: #e4e6e9;
}
.dark .icon-button:hover {
    background-color: #4b5563;
}

.send-button {
    position: relative;
    transition: all 0.3s ease !important;
}
.send-button.active {
    background: linear-gradient(45deg, #4f46e5, #a259ff);
    color: white;
    transform: scale(1.05);
}
.send-button.active svg {
    stroke: white;
}
.send-button svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.send-button #stop-icon {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}
.send-button.is-loading #send-icon {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}
.send-button.is-loading #stop-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    display: block !important;
}
.dark .send-button.active {
    background: linear-gradient(45deg, #6366f1, #c084fc);
}

.tools-container, .attach-container {
    position: relative;
    display: flex;
}

.tools-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #f0f2f5;
    border: none;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 15px;
    font-family: 'Vazirmatn', sans-serif;
    cursor: pointer;
    color: #1f2937;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.dark .tools-button {
    background-color: #374151;
    color: #e5e7eb;
}

.tools-button:hover {
    background-color: #e4e6e9;
}
.dark .tools-button:hover {
    background-color: #4b5563;
}

.tools-button.tool-selected {
    padding: 8px 10px;
    gap: 4px;
}

.tools-icon svg {
    width: 20px;
    height: 20px;
    stroke: #333;
}
.dark .tools-icon svg {
    stroke: #e5e7eb;
}

.tools-menu, #file-popup-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0; 
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px;
    width: max-content;
    z-index: 50;
    list-style: none;
    margin: 0;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    transform-origin: bottom left;
}
.dark .tools-menu, .dark #file-popup-menu {
    background-color: #262f3d;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}


.tools-menu.active, #file-popup-menu.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.tool-item, .popup-option {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    color: #374151;
    font-size: 16px;
    background: none;
    border: none;
    font-family: 'Vazirmatn', sans-serif;
    width: 100%;
    text-align: right;
}
.dark .tool-item, .dark .popup-option {
    color: #e5e7eb;
}

.tool-item:hover, .popup-option:hover {
    background-color: #f0f2f5;
}
.dark .tool-item:hover, .dark .popup-option:hover {
    background-color: #374151;
}

.tool-item-svg, .popup-option-svg {
    width: 32px;
    height: 32px;
    margin-left: 15px;
    flex-shrink: 0;
    filter: drop-shadow(0px 2px 3px rgba(0,0,0,0.2));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.tool-item:hover .tool-item-svg, .popup-option:hover .popup-option-svg {
    transform: translateY(-3px) scale(1.05);
    filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.3));
}

.clear-tool-selection {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8e8e8e;
    transition: color 0.2s ease;
}
.dark .clear-tool-selection {
    color: #9ca3af;
}

.clear-tool-selection:hover {
    color: #333;
}
.dark .clear-tool-selection:hover {
    color: #e5e7eb;
}

.clear-tool-selection svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.popup-option .upload-arrow {
    animation: uploadPulse 1.5s infinite alternate ease-in-out;
}
@keyframes uploadPulse {
    0% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(-3px); opacity: 0.8; }
    100% { transform: translateY(0); opacity: 1; }
}

.popup-option .magnifier-group {
    transform-origin: 12px 14px;
    animation: magnifierFloatScan 3s infinite alternate ease-in-out;
}
@keyframes magnifierFloatScan {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(1px, -1px) scale(1.02); }
    66% { transform: translate(-1px, 1px) scale(1.02); }
    100% { transform: translate(0px, 0px) scale(1); }
}

.popup-option .magnifying-lens {
    animation: lensGlow 2s infinite alternate ease-in-out;
}
@keyframes lensGlow {
    0% { fill: rgba(180, 220, 255, 0.7); }
    50% { fill: rgba(220, 240, 255, 1); }
    100% { fill: rgba(180, 220, 255, 0.7); }
}

/* DEEP THINK TV STYLES */
.deep-think-tv-container {
    padding: 1rem;
    box-sizing: border-box;
    width: 100%;
}
.deep-think-tv {
    width: 100%;
    aspect-ratio: 16 / 9;
    position:relative;
    border-radius: 12px;
    padding: 1.5vmin;
    isolation:isolate;
    transition: background .3s ease, box-shadow .3s ease;
    background: #dbe1e8;
    box-shadow: 0 4vmin 9vmin rgba(0,0,0,.25), 0 0 0 1px #fff inset;
}
.dark .deep-think-tv {
    background: #0a0f1e;
    box-shadow: 0 4vmin 9vmin rgba(0,0,0,.45), 0 0 0 2px rgba(255,255,255,.04) inset;
}
.deep-think-tv::before{
    content:"";
    position:absolute; inset:-2px;
    border-radius: calc(12px + 2px);
    padding:2px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events:none;
    filter: blur(.3px);
}
.deep-think-tv .screen{
    position:relative;
    width:100%; height:100%;
    border-radius: 8px;
    overflow:hidden;
    transition: background .3s ease, box-shadow .3s ease;
    background: linear-gradient(135deg, #e1e7f0, #f8f9fc);
    box-shadow: inset 0 0 4vmin rgba(0,0,0,.15);
}
.dark .deep-think-tv .screen {
    background: radial-gradient(120% 140% at 50% 10%, rgba(167,139,250,.12), rgba(96,165,250,.10) 40%, transparent 60%), radial-gradient(120% 170% at 50% 120%, rgba(10,16,34,1) 40%, rgba(7,11,20,1) 100%), linear-gradient(135deg, #0b1430, #0b1026);
    box-shadow: inset 0 0 4vmin rgba(0,0,0,.55), inset 0 0 14vmin rgba(88, 101, 242, .12);
}
.deep-think-tv .scanlines::after{
    content:"";
    position:absolute; inset:0;
    background: repeating-linear-gradient( to bottom, rgba(0,0,0,.08) 0 1px, transparent 1px 3px );
    opacity:.15;
    pointer-events:none;
}
.dark .deep-think-tv .scanlines::after {
     background: repeating-linear-gradient( to bottom, rgba(255,255,255,.04) 0 1px, rgba(0,0,0,0) 1px 3px );
     mix-blend-mode: overlay;
     opacity:.35;
}
.deep-think-tv .gloss::before{
    content:"";
    position:absolute;
    top:-10%; left:-10%;
    width:80%; height:80%;
    background:linear-gradient(160deg, rgba(255,255,255,.35), rgba(255,255,255,0) 60%);
    border-radius:80% 50% 40% 60% / 50% 50% 40% 50%;
    filter: blur(6px);
    transform: rotate(4deg);
    pointer-events:none;
}
.dark .deep-think-tv .gloss::before {
     background:linear-gradient(160deg, rgba(255,255,255,.18), rgba(255,255,255,0) 60%);
}
.deep-think-tv .ui{
    position:absolute; inset:0;
    display:flex; flex-direction:column;
    padding: 2vmin 2.2vmin;
    gap: 1.5vmin;
    color: #2c3e50;
}
.dark .deep-think-tv .ui { color: #e6ecff; }
.deep-think-tv .header { display: flex; flex-direction: column; gap: 1.2vmin; }
.deep-think-tv .topbar{ display:flex; align-items:center; justify-content:space-between; gap: 1.2vmin; }
.deep-think-tv .badge{
    display:inline-flex; align-items:center; gap: .8vmin;
    padding: .8vmin 1.2vmin;
    border-radius:999px;
    font-weight:600;
    letter-spacing:.2px;
    font-size: 1.4vmin;
    background: rgba(0, 0, 0, 0.05);
    border:1px solid rgba(0, 0, 0, 0.1);
}
.dark .deep-think-tv .badge {
    background: linear-gradient(135deg, rgba(96,165,250,.18), rgba(167,139,250,.18));
    border:1px solid rgba(255,255,255,.08);
    box-shadow: inset 0 0 1.2vmin rgba(96,165,250,.18);
}
.deep-think-tv .dot{
    width: .8vmin; height: .8vmin; border-radius:50%;
    background: #34d399;
    box-shadow: 0 0 1vmin #34d399, 0 0 2vmin #34d399;
    animation: blink 1.4s infinite;
}
@keyframes blink{ 0%, 100% { opacity: .25 } 50% { opacity: 1 } }
.deep-think-tv .topic{
    display:flex; align-items:center; gap: .8vmin; flex-wrap:nowrap;
    font-size: 1.5vmin;
    color: #52617a;
    overflow: hidden;
}
.dark .deep-think-tv .topic { color: #a9b3d1; }
.deep-think-tv .topic strong{
    font-weight:700;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
.dark .deep-think-tv .topic strong {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text; background-clip: text;
    color: #f0f4ff;
}
.deep-think-tv .steps{ display:flex; gap: .8vmin; flex-wrap:wrap; }
.deep-think-tv .step{
    padding: .8vmin 1vmin;
    border-radius: 1vmin;
    font-size: 1.3vmin;
    opacity:.65;
    transition:.25s ease;
    background: rgba(0,0,0,.05);
    border: 1px solid rgba(0,0,0,.08);
}
.dark .deep-think-tv .step {
    background: linear-gradient(135deg, rgba(96,165,250,.14), rgba(167,139,250,.14));
    border: 1px solid rgba(255,255,255,.08);
}
.deep-think-tv .step.active{
    opacity:1;
    box-shadow: 0 0 1.8vmin rgba(96,165,250,.28);
}
.deep-think-tv .step .mini{
    display:inline-block; width: .8vmin; height: .8vmin; border-radius:50%; margin-left: .6vmin;
    background:linear-gradient(135deg, #60a5fa, #a78bfa);
    box-shadow:0 0 .8vmin rgba(167,139,250,.6);
}
.deep-think-tv .progress{
    height: 1vmin; border-radius: .8vmin; overflow:hidden;
    background: rgba(0,0,0,.1);
    border:1px solid rgba(0,0,0,.08);
}
.dark .deep-think-tv .progress {
    background: rgba(255,255,255,.07);
    border:1px solid rgba(255,255,255,.06);
}
.deep-think-tv .bar{
    height:100%; width:0%;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    box-shadow: 0 0 2.4vmin rgba(167,139,250,.45);
    transition: width .6s cubic-bezier(.4, .0, .2, 1);
}
.deep-think-tv .log{
    flex:1;
    display:flex; flex-direction:column; gap: 1vmin;
    padding: 1.2vmin;
    border-radius: 1.2vmin;
    overflow:auto;
    background: rgba(255,255,255,.4);
    border:1px solid rgba(255,255,255,.6);
}
.dark .deep-think-tv .log {
    background: linear-gradient(180deg, rgba(10,16,34,.65), rgba(10,16,34,.35));
    border:1px solid rgba(255,255,255,.06);
}
.deep-think-tv .row{
    display:flex; align-items:flex-start; gap: 1vmin;
    font-size: 1.5vmin;
    color: #3d4c66;
    animation: fade-in-item 0.4s ease-out;
}
.dark .deep-think-tv .row { color: #eaf1ff; }
.deep-think-tv .row .icon{
    width: 1.8vmin; height: 1.8vmin; flex:none;
    border-radius: .6vmin;
    display:grid; place-items:center;
    font-size: 1.1vmin;
    background: rgba(0,0,0,.08);
}
.dark .deep-think-tv .row .icon {
    background: linear-gradient(135deg, rgba(96,165,250,.22), rgba(167,139,250,.22));
    box-shadow: inset 0 0 1vmin rgba(167,139,250,.22);
}
.deep-think-tv .final-answer-wrapper {
    transition: opacity 0.5s ease-in-out, max-height 0.5s ease-in-out;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}
.deep-think-tv .final-answer-wrapper.visible {
    max-height: 1000px; /* or a large enough value */
    opacity: 1;
}
@keyframes fade-in-item {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.ws-loading-container .dots {
  display: flex;
  gap: 8px;
  padding: 0.5rem 0.2rem;
}

.ws-loading-container .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3a8fff, #a44fff);
  animation: bounce 1s infinite ease-in-out;
}

.ws-loading-container .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ws-loading-container .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
}

/* Premium Feature Animation */
@keyframes premium-glow-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.8);
  }
}

.animate-premium-lock > * {
  animation: premium-glow-pulse 0.8s ease-in-out;
}

.premium-locked-item {
  position: relative;
}

.premium-required-notice {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: #1f2937;
    color: #f9fafb;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease-out;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.dark .premium-required-notice {
    background-color: #f9fafb;
    color: #1f2937;
}

.premium-locked-item.show-notice .premium-required-notice {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* === START: REASONING HUD STYLES === */
.reasoning-hud-container {
    padding: 1rem;
    box-sizing: border-box;
    width: 100%;
}
.reasoning-hud {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    border-radius: 12px;
    padding: 1.5vmin;
    isolation: isolate;
    transition: background .3s ease, box-shadow .3s ease;
    background: #eef2f7;
    box-shadow: 0 4vmin 9vmin rgba(0,0,0,.15), 0 0 0 1px #fff inset;
    overflow: hidden;
}
.dark .reasoning-hud {
    background: #111827;
    box-shadow: 0 4vmin 9vmin rgba(0,0,0,.35), 0 0 0 2px rgba(255,255,255,.04) inset;
}

.reasoning-hud::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: calc(12px + 2px);
    padding: 2px;
    background: linear-gradient(135deg, #34d399, #3b82f6);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    filter: blur(.3px);
}

.reasoning-hud .grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 160, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 160, 255, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
    animation: pan-grid 10s linear infinite;
}
.dark .reasoning-hud .grid-bg {
     background-image:
        linear-gradient(rgba(59, 130, 246, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.15) 1px, transparent 1px);
}

@keyframes pan-grid {
    from { background-position: 0 0; }
    to { background-position: -20px -20px; }
}

.reasoning-hud .ui-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5vmin;
    gap: 1.5vmin;
    color: #1f2937;
}
.dark .reasoning-hud .ui-content {
    color: #e5e7eb;
}

.reasoning-hud .header {
    display: flex;
    flex-direction: column;
    gap: 1vmin;
}

.reasoning-hud .badge {
    display: inline-flex;
    align-items: center;
    gap: .8vmin;
    padding: .8vmin 1.2vmin;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 1.4vmin;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
}
.dark .reasoning-hud .badge {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.reasoning-hud .dot {
    width: .8vmin;
    height: .8vmin;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 1vmin #34d399, 0 0 2vmin #34d399;
    animation: blink 1.4s infinite;
}

.reasoning-hud .topic {
    font-size: 1.5vmin;
    color: #4b5563;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.dark .reasoning-hud .topic {
    color: #9ca3af;
}

.reasoning-hud .topic strong {
    font-weight: 700;
    color: #1d4ed8;
}
.dark .reasoning-hud .topic strong {
    color: #60a5fa;
}

.reasoning-hud .progress {
    height: 1vmin;
    border-radius: .8vmin;
    overflow: hidden;
    background: rgba(0,0,0,.1);
    border: 1px solid rgba(0,0,0,.08);
}
.dark .reasoning-hud .progress {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.1);
}

.reasoning-hud .bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #34d399, #3b82f6);
    box-shadow: 0 0 2.4vmin rgba(59, 130, 246, .45);
    transition: width .6s cubic-bezier(.4, .0, .2, 1);
}

.reasoning-hud .log {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1vmin;
    padding: 1.2vmin;
    border-radius: 1vmin;
    overflow: auto;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(2px);
}
.dark .reasoning-hud .log {
    background: rgba(31, 41, 55, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.reasoning-hud .row {
    display: flex;
    align-items: flex-start;
    gap: 1vmin;
    font-size: 1.5vmin;
    color: #374151;
    animation: fade-in-item 0.4s ease-out;
}
.dark .reasoning-hud .row {
    color: #d1d5db;
}

.reasoning-hud .row .icon {
    width: 1.8vmin;
    height: 1.8vmin;
    flex: none;
    color: #3b82f6;
}
.dark .reasoning-hud .row .icon {
    color: #60a5fa;
}
/* === END: REASONING HUD STYLES === */

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

#global-audio-player.visible {
    transform: translateY(0);
}
.action-button .loading-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border-width: 2px;
    border-color: #9ca3af;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.dark .action-button .loading-spinner {
    border-color: #6b7280;
    border-top-color: #60a5fa;
}
.action-button.loading .speak-icon {
    display: none;
}
.action-button.loading .loading-spinner {
    display: block;
}
/* ... (کدهای قبلی شما) ... */

/* === START: استایل‌های جدید برای دکمه پخش/توقف صدا === */
.action-button .loading-spinner,
.action-button .speak-icon,
.action-button .pause-icon {
    display: none; /* در حالت عادی همه مخفی هستند */
}

.action-button .speak-icon {
    display: block; /* آیکون پخش به صورت پیش‌فرض نمایش داده می‌شود */
}

.action-button.loading .speak-icon,
.action-button.loading .pause-icon {
    display: none;
}
.action-button.loading .loading-spinner {
    display: block;
}

.action-button.playing .speak-icon,
.action-button.playing .loading-spinner {
    display: none;
}
.action-button.playing .pause-icon {
    display: block !important;
}
/* === END: استایل‌های جدید === */


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

#global-audio-player.visible {
    transform: translateY(0);
}
/* START: CSS for Thoughts Toggle Switch */
.tool-item-full-width {
    padding: 0.5rem 0.75rem;
    width: 100%;
    cursor: default;
}
.tool-item-full-width:hover {
    background-color: transparent !important;
}
.dark .tool-item-full-width:hover {
    background-color: transparent !important;
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.toggle-label {
    font-size: 16px;
    color: #374151;
    font-weight: 500;
    user-select: none;
}
.dark .toggle-label {
    color: #e5e7eb;
}

.toggle-switch {
    --switch-width: 60px;
    --switch-height: 30px;
    --thumb-size: 24px;
    --padding: 3px;
    width: var(--switch-width);
    height: var(--switch-height);
    background-color: #d1d5db; /* Gray for inactive */
    border-radius: calc(var(--switch-height) / 2);
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    padding: var(--padding);
    box-sizing: border-box;
    flex-shrink: 0;
}
.dark .toggle-switch {
    background-color: #4b5563;
}

.toggle-switch.active {
    background-color: #28a745; /* Green for active */
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.25), 0 0 8px rgba(40, 167, 69, 0.4);
}

.toggle-thumb {
    width: var(--thumb-size);
    height: var(--thumb-size);
    background: linear-gradient(145deg, #ffd700, #ccac00);
    border-radius: 50%;
    position: absolute;
    left: var(--padding);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
}

.toggle-switch.active .toggle-thumb {
    transform: translateX(calc(var(--switch-width) - var(--thumb-size) - 2 * var(--padding)));
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.thumb-text {
    color: #4a4a4a;
    font-size: 11px;
    font-weight: 900;
    user-select: none;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}
/* END: CSS for Thoughts Toggle Switch */

/* START: NEW STYLES for Final Answer Wrapper */
.final-answer-wrapper {
    transition: opacity 0.5s ease-in-out, max-height 0.5s ease-in-out;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.final-answer-wrapper.visible {
    max-height: 50000px;
    opacity: 1;
}
/* END: NEW STYLES for Final Answer Wrapper */
