/* ШІ-помічник (ai.html). Каркас — від чату (chat.css + human.css), тут лише своє. */

.ai_side_head { display: flex; align-items: center; justify-content: space-between; padding-right: 14px; }
.ai_new {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px;
    color: var(--accent); background: var(--accent-soft); border: none; border-radius: 10px; cursor: pointer;
    transition: filter 0.2s, transform 0.2s;
}
.ai_new:hover { filter: brightness(1.3); }
.ai_new:active { transform: scale(0.92); }
.ai_new svg { width: 18px; height: 18px; }

.ai_page .room { position: relative; padding-right: 40px; }
.ai_page .room_icon { width: 36px; height: 36px; font-size: 15px; }
.ai_page .room_name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; }
.ai_del {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; font-size: 14px; color: inherit; opacity: 0;
    background: none; border: none; border-radius: 8px; cursor: pointer; transition: opacity 0.2s, background 0.2s;
}
.room:hover .ai_del, .ai_del:focus-visible { opacity: 0.7; }
.ai_del:hover { opacity: 1; background: rgba(255, 69, 58, 0.18); }
@media (hover: none) { .ai_del { opacity: 0.6; } }
.ai_empty_list { padding: 8px 14px; font-size: 14px; color: var(--muted); }

.ai_logo { background: var(--accent) !important; color: #fff !important; }
.ai_logo svg { width: 22px; height: 22px; }

/* ---------- Повідомлення ---------- */
.ai_messages { gap: 14px; }
.ai_messages .bubble_out { max-width: min(80%, 640px); }
.ai_messages .bubble_out .b_text { white-space: pre-wrap; }

.ai_msg {
    align-self: stretch; display: flex; gap: 12px; max-width: 860px;
    animation: pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.ai_msg .room_icon { width: 32px; height: 32px; margin-top: 2px; }
.ai_msg .room_icon svg { width: 17px; height: 17px; }
.ai_body { flex: 1; min-width: 0; font-size: 16px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.ai_body > :first-child { margin-top: 0; }
.ai_body > :last-child { margin-bottom: 0; }
.ai_body p { margin: 0 0 10px; }
.ai_body h1, .ai_body h2, .ai_body h3, .ai_body h4 { margin: 18px 0 8px; line-height: 1.3; letter-spacing: -0.01em; }
.ai_body h1 { font-size: 22px; } .ai_body h2 { font-size: 20px; } .ai_body h3, .ai_body h4 { font-size: 17px; }
.ai_body ul, .ai_body ol { margin: 0 0 10px; padding-left: 24px; }
.ai_body li { margin: 4px 0; }
.ai_body li > ul, .ai_body li > ol { margin: 4px 0 0; }
.ai_body li > p { margin: 0 0 6px; }
.ai_body li > .ai_code { margin: 8px 0; }
.ai_body ul ul { list-style: circle; } .ai_body ul ul ul { list-style: square; }
.ai_body li::marker { color: var(--muted); }
.ai_body strong { font-weight: 700; color: var(--ink); }
.ai_body del { opacity: 0.7; }
.ai_body h1 code, .ai_body h2 code, .ai_body h3 code { font-size: 0.85em; }
.ai_body blockquote { margin: 0 0 10px; padding: 4px 14px; color: var(--muted); border-left: 3px solid var(--accent); }
.ai_body hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.ai_body a { color: var(--accent); }
.ai_table { margin: 0 0 12px; overflow-x: auto; scrollbar-width: thin; }
.ai_body table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.ai_body th, .ai_body td { padding: 6px 12px; border: 1px solid var(--line); text-align: left; }
.ai_body th { background: var(--accent-soft); }

.ai_body code {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; font-variant-ligatures: none;
    padding: 2px 6px; background: var(--accent-soft); border-radius: 6px;
}

/* Блок коду з назвою мови та кнопкою «Копіювати» */
.ai_code { margin: 0 0 12px; overflow: hidden; background: #0d1117; border: 1px solid var(--line); border-radius: 14px; }
.ai_code_bar {
    display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px;
    font-size: 12px; color: #8b949e; background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ai_copy {
    font: inherit; font-size: 12px; color: #c9d1d9; padding: 4px 10px;
    background: rgba(255, 255, 255, 0.06); border: none; border-radius: 8px; cursor: pointer;
}
.ai_copy:hover { background: rgba(255, 255, 255, 0.14); }
.ai_code pre { margin: 0; padding: 14px 16px; overflow-x: auto; scrollbar-width: thin; }
.ai_code pre code {
    display: block; padding: 0; font-size: 13.5px; line-height: 1.55; color: #e6edf3;
    background: none; border-radius: 0; white-space: pre; tab-size: 4;
}

/* Підсвітка синтаксису (класи highlight.js) — однакова в обох темах, бо фон коду завжди темний */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-type { color: #ff7b72; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-template-tag { color: #a5d6ff; }
.hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable, .hljs-symbol { color: #79c0ff; }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-selector-id { color: #d2a8ff; }
.hljs-title.class_, .hljs-class .hljs-title { color: #ffa657; }
.hljs-comment, .hljs-quote, .hljs-meta { color: #8b949e; font-style: italic; }
.hljs-name, .hljs-tag, .hljs-selector-class { color: #7ee787; }
.hljs-attr, .hljs-property, .hljs-params { color: #e6edf3; }
.hljs-deletion { color: #ffa198; }

.ai_actions { display: flex; gap: 6px; margin-top: 8px; }
.ai_actions button {
    font: inherit; font-size: 13px; color: var(--muted); padding: 4px 10px;
    background: none; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.ai_actions button:hover { color: var(--ink); background: var(--accent-soft); }
.ai_note { margin-top: 6px; font-size: 13px; color: var(--accent); }

.ai_error .ai_body { color: #ff6b61; }

/* Друкує… */
.ai_typing { display: inline-flex; gap: 5px; padding: 10px 0; }
.ai_typing i { width: 8px; height: 8px; background: var(--muted); border-radius: 50%; animation: ai_dot 1.2s infinite ease-in-out; }
.ai_typing i:nth-child(2) { animation-delay: 0.15s; }
.ai_typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai_dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

/* ---------- Порожній діалог: привітання та підказки ---------- */
.ai_welcome { margin: auto; max-width: 620px; padding: 20px 4px; text-align: center; }
.ai_welcome .room_icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 18px; }
.ai_welcome .room_icon svg { width: 32px; height: 32px; }
.ai_welcome h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -0.02em; color: var(--ink); }
.ai_welcome p { margin: 0 0 22px; font-size: 16px; line-height: 1.6; color: var(--muted); }
.ai_welcome p a { color: var(--accent); }
.ai_suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.ai_suggest button {
    padding: 14px 16px; font: inherit; font-size: 14px; line-height: 1.45; color: var(--ink);
    background: var(--bg); border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}
.ai_suggest button:hover { border-color: var(--accent); transform: translateY(-2px); }
.ai_suggest b { display: block; margin-bottom: 2px; font-size: 13px; color: var(--accent); }
.ai_langs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; }
.ai_langs span { padding: 3px 10px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; }

/* ---------- Поле вводу ---------- */
.ai_composer { align-items: flex-end; }
.ai_input {
    height: auto; min-height: 44px; max-height: 220px; padding: 11px 20px; resize: none;
    line-height: 1.4; box-sizing: border-box; overflow-y: auto; color: var(--ink);
}
.send:disabled { opacity: 0.5; cursor: default; }
.ai_hint { padding: 0 18px 10px; font-size: 12px; color: var(--muted); text-align: center; }

@media (max-width: 800px) {
    .ai_side_head { padding: 10px 0 10px 10px; }
    .ai_page .room { padding-right: 34px; max-width: 200px; }
    .ai_suggest { grid-template-columns: 1fr; }
    .ai_welcome h2 { font-size: 22px; }
    .ai_hint { display: none; }
    .ai_msg .room_icon { display: none; }
    .ai_body ul, .ai_body ol { padding-left: 20px; }
    .ai_body li > .ai_code { margin-left: -8px; }
}
