/* Text-based AI chat */

/* =========================================
   1. ПЕРЕМЕННЫЕ
   ========================================= */
:root {
    --tc-primary: #FABF3C;
    --tc-primary-rgb: 250, 191, 60;
    --tc-surface: #1a1a1a;
    --tc-surface-2: #151515;
    --tc-border: rgba(255, 255, 255, 0.1);
    --tc-border-code: #30363d;
    --tc-bg-code: #0d1117;
    --tc-bg-code-header: #161b22;
    --tc-text-primary: #fff;
    --tc-text-secondary: #e0e0e0;
    --tc-text-muted: #8b8b8b;
    --tc-text-placeholder: #666;
    --tc-radius-sm: 8px;
    --tc-radius-md: 12px;
    --tc-radius-lg: 20px;
    --tc-font-mono: 'Fira Code', 'Courier New', monospace;
    --tc-transition: all 0.2s ease;
}

/* =========================================
   2. АНИМАЦИИ
   ========================================= */
@keyframes fadeInMessage {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes tc-typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40%           { transform: scale(1); opacity: 1; background: var(--tc-primary); }
}

/* =========================================
   3. ШАПКА
   ========================================= */
.text-chat-header {
    background: rgba(16, 16, 16, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#dd-text-model {
    width: 310px;
    margin-bottom: 0;
}

#dd-text-model .tc-model-dropdown-header {
    min-height: 48px;
    padding: 6px 10px;
    justify-content: flex-start;
    gap: 10px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015)),
        rgba(18, 18, 20, 0.9);
}

.tc-model-logo {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 16px rgba(0, 0, 0, 0.18);
}

.tc-model-logo::before {
    position: relative;
    z-index: 1;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
}

.tc-model-logo--gemini {
    background: linear-gradient(145deg, #3f7cf4, #8d5be8 55%, #f07ba8);
}
.tc-model-logo--gemini::before { content: "✦"; }

.tc-model-logo--claude {
    background: linear-gradient(145deg, #d88a58, #a95635);
}
.tc-model-logo--claude::before {
    content: "AI";
    font-family: Georgia, serif;
    font-size: 0.72rem;
    letter-spacing: -0.08em;
}

.tc-model-logo--gpt {
    background: linear-gradient(145deg, #1fa37f, #087f68);
}
.tc-model-logo--gpt::before {
    content: "◎";
    font-size: 1.18rem;
}

.tc-model-logo--ai {
    background: linear-gradient(145deg, #6b7280, #374151);
}
.tc-model-logo--ai::before { content: "AI"; font-size: 0.68rem; }

.tc-model-selected-copy,
.tc-model-option-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

#dd-text-model .selected-text {
    overflow: hidden;
    color: #f7f7f8;
    font-size: 0.84rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-model-provider,
.tc-model-option-copy small {
    overflow: hidden;
    margin-top: 4px;
    color: #777b86;
    font-size: 0.62rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-header-pro-badge {
    padding: 2px 5px;
    color: #0b0b0c;
    background: var(--tc-primary);
    border-radius: 5px;
    font-size: 0.52rem;
    font-weight: 900;
    line-height: 1.2;
}

#dd-text-model .dropdown-arrow {
    flex: 0 0 auto;
    margin-left: 1px;
}

#dd-text-model .dropdown-list {
    padding: 6px;
}

#dd-text-model .tc-model-option {
    gap: 10px;
    min-height: 54px;
    padding: 8px 9px;
    border-bottom: 0;
    border-radius: 9px;
}

#dd-text-model .tc-model-option + .tc-model-option {
    margin-top: 3px;
}

.tc-model-option-copy strong {
    color: #e8e9ec;
    font-size: 0.78rem;
    font-weight: 700;
}

.tc-model-availability {
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.65);
}

.chat-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(var(--tc-primary-rgb), 0.1);
    border-radius: var(--tc-radius-sm);
    color: var(--primary);
}

.btn-icon-ghost {
    background: transparent;
    border: none;
    color: #888;
    width: 34px;
    height: 34px;
    border-radius: var(--tc-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tc-transition);
}
.btn-icon-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--tc-text-primary);
}

/* =========================================
   4. ЭКРАН ПРИВЕТСТВИЯ
   ========================================= */
.tc-welcome {
    position: relative;
    width: min(720px, calc(100% - 32px));
    margin: auto;
    padding: 18px 0 120px;
    text-align: center;
    animation: fadeInMessage 420ms ease both;
}

.tc-welcome::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -90px;
    left: 50%;
    width: 520px;
    height: 340px;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(var(--tc-primary-rgb), 0.09), transparent 68%);
    pointer-events: none;
}

.tc-welcome-orb {
    position: relative;
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    margin: 0 auto 18px;
    color: var(--tc-primary);
    background:
        radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.13), transparent 32%),
        rgba(var(--tc-primary-rgb), 0.07);
    border: 1px solid rgba(var(--tc-primary-rgb), 0.28);
    border-radius: 26px;
    box-shadow: 0 16px 50px rgba(var(--tc-primary-rgb), 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.09);
    transform: rotate(7deg);
}

.tc-welcome-orb svg {
    transform: rotate(-7deg);
    filter: drop-shadow(0 0 12px rgba(var(--tc-primary-rgb), 0.38));
}

.tc-welcome-orbit {
    position: absolute;
    inset: -9px;
    border: 1px dashed rgba(var(--tc-primary-rgb), 0.2);
    border-radius: 31px;
    transform: rotate(-7deg);
}

.tc-welcome-eyebrow {
    display: inline-block;
    margin-bottom: 9px;
    color: var(--tc-primary);
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.17em;
}

.tc-welcome h2 {
    margin: 0 0 10px;
    color: #f8f8fa;
    font-size: clamp(1.55rem, 2.5vw, 2.15rem);
    font-weight: 750;
    letter-spacing: -0.035em;
}

.tc-welcome > p {
    max-width: 610px;
    margin: 0 auto 25px;
    color: #858995;
    font-size: 0.86rem;
    line-height: 1.65;
}

.tc-welcome kbd {
    padding: 2px 6px;
    color: #d7d8dc;
    background: rgba(255, 255, 255, 0.065);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
    font-family: inherit;
    font-size: 0.68rem;
}

.tc-suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    text-align: left;
}

.suggestion-btn.tc-suggestion-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 11px;
    min-height: 78px;
    padding: 12px;
    color: #d7d8dc;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
        rgba(17, 18, 21, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.085);
    border-radius: 15px;
    font-size: 0.82rem;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.suggestion-btn.tc-suggestion-card:hover {
    transform: translateY(-3px);
    color: #fff;
    background:
        linear-gradient(145deg, rgba(var(--tc-primary-rgb), 0.1), rgba(255, 255, 255, 0.025)),
        rgba(18, 18, 20, 0.94);
    border-color: rgba(var(--tc-primary-rgb), 0.38);
    box-shadow: 0 13px 30px rgba(0, 0, 0, 0.22);
}

.tc-suggestion-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
    font-size: 0.85rem;
}
.tc-suggestion-icon--strategy { color: #c4a7ff; background: rgba(139, 92, 246, 0.12); }
.tc-suggestion-icon--campaign { color: #ffbc6f; background: rgba(249, 115, 22, 0.12); }
.tc-suggestion-icon--research { color: #73c7ff; background: rgba(14, 165, 233, 0.12); }
.tc-suggestion-icon--visual { color: #ffd76d; background: rgba(var(--tc-primary-rgb), 0.12); }

.tc-suggestion-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}
.tc-suggestion-copy strong { color: #f2f2f4; font-size: 0.82rem; font-weight: 720; }
.tc-suggestion-copy small { margin-top: 4px; color: #777b86; font-size: 0.66rem; line-height: 1.35; }
.tc-suggestion-arrow { color: #5d616b; font-size: 0.68rem; transition: transform 180ms ease, color 180ms ease; }
.tc-suggestion-card:hover .tc-suggestion-arrow { color: var(--tc-primary); transform: translateX(3px); }

/* =========================================
   5. ПОЛЕ ВВОДА
   ========================================= */
.text-chat-input-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 20px 40px;
    background: linear-gradient(0deg, rgba(16,16,16,1) 40%, rgba(16,16,16,0) 100%);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-input-box {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: var(--tc-surface);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-lg);
    padding: 8px 16px;
    display: flex;
    align-items: flex-end;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    transition: border-color 0.3s;
}
.chat-input-box:focus-within {
    border-color: rgba(var(--tc-primary-rgb), 0.4);
}

#text-chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--tc-text-primary);
    resize: none;
    min-height: 40px;
    max-height: 200px;
    padding: 8px 12px 8px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    outline: none;
    box-shadow: none;
    overflow-y: hidden;
}
#text-chat-input::placeholder {
    color: var(--tc-text-placeholder);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--tc-radius-sm);
    border: none;
    background: var(--tc-primary);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--tc-transition);
    flex-shrink: 0;
    margin-bottom: 2px;
    outline: none;
}
.chat-send-btn:disabled {
    background: #333;
    color: var(--tc-text-placeholder);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.chat-send-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(var(--tc-primary-rgb), 0.4);
}

/* =========================================
   6. СООБЩЕНИЯ (БАБЛЫ) — БАЗОВЫЕ СТИЛИ
   ========================================= */
.tc-message-wrapper {
    display: flex;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    animation: fadeInMessage 0.3s ease forwards;
    opacity: 0;
}

/* Пользователь */
.tc-message-wrapper.user {
    justify-content: flex-end;
}
.tc-message-wrapper.user .tc-bubble {
    background: #2a2a2a;
    border-radius: 20px 20px 4px 20px;
    padding: 12px 18px;
    max-width: 80%;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Бот */
.tc-message-wrapper.bot {
    justify-content: flex-start;
    gap: 24px;
}
.tc-message-wrapper.bot .tc-bubble {
    max-width: 85%;
    padding: 8px 0;
}

/* Общие стили для всех баблов */
.tc-bubble {
    color: var(--tc-text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Аватар бота */
.tc-bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--tc-radius-sm);
    background: rgba(var(--tc-primary-rgb), 0.15);
    border: 1px solid rgba(var(--tc-primary-rgb), 0.3);
    color: var(--tc-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

/* Последнее сообщение */
.tc-message-wrapper:last-of-type {
    margin-bottom: 0;
}

/* =========================================
   7. ВЛОЖЕНИЯ В СООБЩЕНИЯХ
   ========================================= */
.tc-attached-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 282px;
    margin-bottom: 8px;
}
.tc-attached-image-box {
    width: 52px;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 9px;
    border: 1px solid var(--tc-border);
    background: var(--tc-surface-2);
}
.tc-attached-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tc-bubble.only-image {
    background: transparent;
    border: none;
    padding: 0;
}

/* Бейдж стоимости */
.tc-message-cost {
    font-size: 0.65rem;
    color: var(--tc-text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.8;
}
.tc-message-cost svg {
    color: var(--tc-primary);
}

/* =========================================
   8. АНИМАЦИЯ "ПЕЧАТАЕТ..."
   ========================================= */
.tc-typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
    height: 24px;
}
.tc-dot {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: tc-typing 1.4s infinite ease-in-out both;
}
.tc-dot:nth-child(1) { animation-delay: -0.32s; }
.tc-dot:nth-child(2) { animation-delay: -0.16s; }

/* =========================================
   9. MARKDOWN — ФОРМАТИРОВАНИЕ ОТВЕТА БОТА
   ========================================= */
.tc-markdown-body {
    width: 100%;
    color: var(--tc-text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Абзацы */
.tc-markdown-body p {
    margin-bottom: 1rem;
}
.tc-markdown-body p:last-child {
    margin-bottom: 0;
}

/* Заголовки */
.tc-markdown-body h1,
.tc-markdown-body h2,
.tc-markdown-body h3,
.tc-markdown-body h4 {
    color: var(--tc-text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}
.tc-markdown-body h1 { font-size: 1.5rem; }
.tc-markdown-body h2 { font-size: 1.3rem; }
.tc-markdown-body h3 { font-size: 1.15rem; }

/* Списки */
.tc-markdown-body ul,
.tc-markdown-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}
.tc-markdown-body li {
    margin-bottom: 0.3rem;
}

/* Инлайн-код */
.tc-markdown-body code:not(.hljs) {
    font-family: var(--tc-font-mono);
    background: rgba(var(--tc-primary-rgb), 0.15);
    color: var(--tc-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Таблицы */
.tc-markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2rem 0;
    font-size: 0.9rem;
}
.tc-markdown-body th,
.tc-markdown-body td {
    border: 1px solid var(--tc-border);
    padding: 8px 12px;
    text-align: left;
}
.tc-markdown-body th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--tc-text-primary);
}
.tc-markdown-body tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Цитаты */
.tc-markdown-body blockquote {
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--tc-primary);
    background: rgba(var(--tc-primary-rgb), 0.05);
    color: #b0b0b0;
    border-radius: 0 4px 4px 0;
}

/* Ссылки */
.tc-markdown-body a {
    color: var(--tc-primary);
    text-decoration: none;
}
.tc-markdown-body a:hover {
    text-decoration: underline;
}

/* Горизонтальные линии */
.tc-markdown-body hr {
    border: 0;
    height: 1px;
    background: var(--tc-border);
    margin: 1.5rem 0;
}

/* =========================================
   10. БЛОКИ КОДА (продолжение)
   ========================================= */
.tc-code-lang {
    font-size: 0.75rem;
    color: #8b949e;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.tc-code-copy {
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--tc-transition);
}
.tc-code-copy:hover {
    color: #c9d1d9;
    background: rgba(255, 255, 255, 0.05);
}

.tc-code-wrapper pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
}
.tc-code-wrapper pre code {
    font-family: var(--tc-font-mono);
    font-size: 0.85rem;
    background: transparent;
    padding: 0;
    color: #c9d1d9;
}

/* Обертка всего блока кода */
.tc-code-wrapper {
    background: var(--tc-bg-code);
    border: 1px solid var(--tc-border-code);
    border-radius: var(--tc-radius-md);
    margin: 12px 0;
    overflow: hidden; /* Чтобы скрыть острые углы внутренних элементов */
}

/* Шапка с названием языка и кнопкой копирования */
.tc-code-header {
    display: flex;
    justify-content: space-between; /* Расталкивает язык и кнопку по разным краям */
    align-items: center;
    padding: 8px 12px;
    background: var(--tc-bg-code-header);
    border-bottom: 1px solid var(--tc-border-code);
}

/* =========================================
   11. ПРЕВЬЮ ИЗОБРАЖЕНИЯ НАД ПОЛЕМ ВВОДА
   ========================================= */
#tc-image-preview-container {
    pointer-events: auto;
    border-color: #333;
    background: var(--tc-surface);
}
.tc-reference-strip {
    width: 100%;
    max-width: 800px;
    position: relative;
    padding: 10px 42px 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
}
.tc-reference-preview-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tc-reference-preview { position: relative; width: 52px; aspect-ratio: 1; }
.tc-reference-preview-image {
    width: 100%; height: 100%; display: block; object-fit: cover;
    border-radius: 9px; border: 1px solid var(--tc-border);
}
.tc-reference-preview-remove,
.tc-reference-clear { border: 0; color: #fff; background: #d94a4a; cursor: pointer; }
.tc-reference-preview-remove {
    position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
    padding: 0; border-radius: 50%; line-height: 1; font-size: 15px;
}
.tc-reference-clear {
    position: absolute; top: 50%; right: 12px; width: 24px; height: 24px;
    padding: 0; border-radius: 7px; transform: translateY(-50%); line-height: 1; font-size: 19px;
}
.tc-reference-preview-remove:hover,
.tc-reference-clear:hover { background: #ff4d4d; }

.tc-pricing-modal-content {
    color: var(--tc-text-secondary); background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1); border-radius: 16px;
}
.tc-pricing-modal-body { font-size: .92rem; line-height: 1.5; }
.tc-pricing-grid { display: grid; gap: 10px; }
.tc-pricing-card {
    padding: 13px; border: 1px solid rgba(var(--tc-primary-rgb), .22);
    border-radius: 12px; background: rgba(var(--tc-primary-rgb), .05);
}
.tc-pricing-card h6 { margin: 0 0 9px; color: var(--tc-text-primary); font-weight: 700; }
.tc-pricing-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid rgba(255,255,255,.08); }
.tc-pricing-row strong { color: var(--tc-primary); white-space: nowrap; }
.tc-pricing-card small { display: block; margin-top: 4px; color: var(--tc-text-muted); }

/* =========================================
   12. ОТСТУП СНИЗУ (СПЕЙСЕР)
   ========================================= */
#chat-bottom-spacer {
    flex-shrink: 0;
    width: 100%;
    min-height: 150px;
    pointer-events: none;
}

/* =========================================
   13. ИСТОРИЯ ЧАТОВ
   ========================================= */
.tc-history-item {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 10px;
    min-height: 86px;
    margin-bottom: 10px;
    padding: 12px 9px 12px 11px;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.022)),
        rgba(12, 13, 16, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.085);
    border-radius: 15px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.tc-history-item::before {
    content: "";
    position: absolute;
    inset: 12px auto 12px 0;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--tc-primary), #f97316);
    opacity: 0;
    transition: opacity 180ms ease;
}
.tc-history-item:hover {
    transform: translateY(-2px);
    background:
        linear-gradient(145deg, rgba(var(--tc-primary-rgb), 0.09), rgba(255, 255, 255, 0.026)),
        rgba(12, 13, 16, 0.9);
    border-color: rgba(var(--tc-primary-rgb), 0.34);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}
.tc-history-item.active {
    background:
        linear-gradient(145deg, rgba(var(--tc-primary-rgb), 0.14), rgba(var(--tc-primary-rgb), 0.035)),
        rgba(18, 16, 12, 0.92);
    border-color: rgba(var(--tc-primary-rgb), 0.62);
}
.tc-history-item:hover::before,
.tc-history-item.active::before {
    opacity: 1;
}

.tc-history-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--tc-primary);
    background: linear-gradient(145deg, rgba(var(--tc-primary-rgb), 0.18), rgba(249, 115, 22, 0.07));
    border: 1px solid rgba(var(--tc-primary-rgb), 0.18);
    border-radius: 11px;
    font-size: 0.82rem;
}

.tc-history-body {
    min-width: 0;
}

.tc-history-title {
    display: -webkit-box;
    overflow: hidden;
    margin-bottom: 9px;
    color: #f1f1f3;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.tc-history-item.active .tc-history-title {
    color: #fff5d8;
}

.tc-history-date {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 8px;
    color: #787c86;
    font-size: 0.64rem;
    line-height: 1;
}

.tc-history-date > i {
    color: #60646d;
    font-size: 0.58rem;
}

.tc-history-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #66d79a;
}

.tc-history-item.active .tc-history-state {
    color: var(--tc-primary);
}

.tc-history-state-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 7px currentColor;
}

.tc-history-delete {
    display: grid;
    place-items: center;
    width: 30px;
    height: 32px;
    padding: 0;
    color: #666a74;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 0.72rem;
    opacity: 0.7;
    cursor: pointer;
    transition: color 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}
.tc-history-item:hover .tc-history-delete {
    opacity: 1;
}
.tc-history-delete:hover {
    color: #ff6b6b !important;
    background: rgba(255, 77, 77, 0.1) !important;
    border-color: rgba(255, 77, 77, 0.16);
}

/* =========================================
   14. ШАПКА САЙДБАРА И КНОПКА "НОВЫЙ ЧАТ"
   ========================================= */
#text-chat-sidebar-view .chat-sidebar-header {
    font-family: 'Manrope', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--tc-text-muted);
    padding: 24px 16px 12px 16px;
    border-bottom: none;
    background: transparent;
}
#text-chat-sidebar-view .chat-sidebar-header span {
    font-weight: 700;
    opacity: 0.8;
}

#text-chat-sidebar-view .p-3.pb-0 {
    padding: 0 16px 16px 16px;
}

#tc-new-chat-btn {
    background: rgba(var(--tc-primary-rgb), 0.08);
    border: 1px solid rgba(var(--tc-primary-rgb), 0.2);
    color: var(--tc-primary);
    border-radius: var(--tc-radius-md);
    padding: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
}
#tc-new-chat-btn:hover {
    background: rgba(var(--tc-primary-rgb), 0.15);
    border-color: rgba(var(--tc-primary-rgb), 0.5);
    color: var(--tc-text-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--tc-primary-rgb), 0.15);
}

#tc-new-chat-btn svg {
    transition: transform 0.3s ease;
}
#tc-new-chat-btn:hover svg {
    transform: rotate(90deg);
}

/* =========================================
   15. МОБИЛЬНАЯ АДАПТАЦИЯ
   ========================================= */
@media (max-width: 991px) {

    /* --- Шапка --- */
    .text-chat-header {
        padding-left: 12px;
        padding-right: 12px;
    }
    .text-chat-header > div.d-flex {
        gap: 4px;
    }
    #dd-text-model {
        width: min(255px, calc(100vw - 120px));
        min-width: 180px;
        flex-shrink: 1;
    }
    #dd-text-model .selected-text {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 115px;
        display: inline-block;
        vertical-align: bottom;
    }
    #dd-text-model .tc-model-provider {
        display: none;
    }
    #dd-text-model .tc-model-dropdown-header {
        min-height: 42px;
        gap: 7px;
    }
    #dd-text-model .tc-model-logo {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }
    #dd-text-model .tc-header-pro-badge {
        display: none;
    }
    #tc-pricing-btn,
    #text-chat-clear-btn {
        width: 32px;
        height: 32px;
        padding: 0;
        margin: 0;
    }

    /* --- Приветственный экран --- */
    #text-chat-welcome {
        transform: none;
        width: calc(100% - 18px);
        padding: 20px 0 155px;
    }
    .tc-welcome-orb {
        width: 66px;
        height: 66px;
        border-radius: 21px;
    }
    .tc-welcome-orb svg {
        width: 36px;
        height: 36px;
    }
    .tc-welcome h2 {
        font-size: 1.35rem;
    }
    .tc-welcome > p {
        font-size: 0.77rem;
    }
    .tc-suggestion-grid {
        grid-template-columns: 1fr;
    }
    .suggestion-btn.tc-suggestion-card {
        min-height: 68px;
    }

    /* --- Сайдбар (аккордеон) --- */
    #text-chat-sidebar-view {
        height: auto;
        background: var(--tc-surface-2);
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.05);
        flex-direction: column;
        overflow: hidden;
        flex-shrink: 0;
    }
    #text-chat-sidebar-view .chat-sidebar-header {
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 20px;
        transition: var(--tc-transition);
    }
    #text-chat-sidebar-view .chat-sidebar-header::after {
        content: '';
        display: block;
        width: 8px;
        height: 8px;
        border-bottom: 2px solid var(--tc-text-muted);
        border-right: 2px solid var(--tc-text-muted);
        transform: rotate(45deg);
        transition: transform 0.3s ease, border-color 0.3s ease;
    }

    /* Скрытое состояние */
    #text-chat-sidebar-view .p-3,
    #tc-history-list {
        display: none;
    }

    /* Открытое состояние */
    #text-chat-sidebar-view.mobile-open .chat-sidebar-header::after {
        transform: rotate(-135deg);
        border-color: var(--tc-primary);
    }
    #text-chat-sidebar-view.mobile-open .chat-sidebar-header span {
        color: var(--tc-primary);
    }
    #text-chat-sidebar-view.mobile-open .p-3,
    #text-chat-sidebar-view.mobile-open #tc-history-list {
        display: block;
        animation: fadeInDown 0.3s ease forwards;
    }

    /* Ограничение высоты списка */
    #tc-history-list {
        max-height: 45vh;
        overflow-y: auto;
        padding-bottom: 15px;
    }
}
