/* FL Chat Widget — визуальный слой утверждённого прототипа (чистая пересборка).
   Shell прозрачный: фон/рамку/radius даёт обёртка .consultant темы.
   Высота определяется содержимым; внутреннего scrollbar истории нет. */

/* ============================================================
   1. Shell
   ============================================================ */
.fl-chat-widget-wrap { width: 100%; max-width: 100%; }
.fl-chat-widget-title { margin: 0 0 12px; }
.fl-chat-widget-root { width: 100%; min-height: 0; }

.flcw-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ============================================================
   2. Compact / full
   ============================================================ */
.flcw-shell--compact,
.flcw-shell--full {
    min-height: 0;
    height: auto;
}
/* Стартовое состояние: история скрыта, видна только область ввода */
.flcw-shell--compact .flcw-messages-wrap { display: none; }

/* ============================================================
   3. History (растёт по контенту, без внутреннего scrollbar)
   ============================================================ */
.flcw-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.flcw-messages-wrap {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}
.flcw-messages {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ============================================================
   4. User
   ============================================================ */
.flcw-row { display: flex; gap: 10px; }
.flcw-row.user { justify-content: flex-end; }
.flcw-row.user .flcw-bubble {
    max-width: 88%;
    background: #f1f1ee;
    border: 1px solid #ececea;
    border-radius: 16px 16px 4px 16px;
    padding: 10px 14px;
    color: #1f2937;
    font-size: 15px;
    line-height: 1.58;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}

/* ============================================================
   5. Assistant
   ============================================================ */
.flcw-row.assistant { align-items: flex-start; justify-content: flex-start; }
.flcw-ai-icon {
    flex: none;
    width: 14px;
    height: 14px;
    margin-top: 4px;
    color: #c2c2bb;
}
.flcw-ai-icon svg { display: block; }
.flcw-row.assistant .flcw-bubble {
    max-width: 88%;
    background: transparent;
    border: 0;
    padding: 0;
    color: #3f3f46;
    font-size: 15px;
    line-height: 1.62;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
}
.flcw-link { color: #1f2937; text-decoration: underline; text-underline-offset: 2px; }
.flcw-link:hover { color: #111827; }

/* ============================================================
   6. Waiting indicator: [часы] Готовлю ответ · 2.8 c
   ============================================================ */
.flcw-typing {
    display: flex;
    align-items: center;
    padding: 2px 2px 14px;
    color: #6b7280;
    font-size: 13px;
}
.flcw-typing-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.flcw-clock {
    position: relative;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid #a1a1aa;
}
.flcw-clock::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 15%;
    width: 1.8px;
    height: 40%;
    margin-left: -.9px;
    background: #71717a;
    border-radius: 1px;
    transform-origin: 50% 100%;
    animation: flcw-clock-spin 1.1s linear infinite;
}
@keyframes flcw-clock-spin { to { transform: rotate(360deg); } }
.flcw-typing-label { white-space: nowrap; }
.flcw-typing-time { font-variant-numeric: tabular-nums; }

/* ============================================================
   7. Composer
   ============================================================ */
.flcw-bottom { margin-top: 16px; }
.flcw-input-card {
    position: relative;
    background: #fff;
    border: 1px solid #d4d7db;
    border-radius: 12px;
}
.flcw-input-card:focus-within {
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, .07);
}
/* Кнопка отправки позиционируется абсолютно внутри input-card;
   пустой обёрточный footer не занимает места. */
.flcw-input-footer {
    height: 0;
    overflow: visible;
}
.flcw-controls { display: flex; align-items: center; justify-content: flex-end; width: 100%; }

/* ============================================================
   8. Textarea (auto-grow в chat.js, без внутреннего scrollbar)
   ============================================================ */
.flcw-textarea {
    display: block;
    width: 100%;
    min-height: 56px;
    padding: 12px 54px 12px 14px;
    border: 0;
    outline: none;
    resize: none;
    overflow: hidden;
    background: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 22px;
    color: #1f2937;
    box-sizing: border-box;
}
.flcw-textarea::placeholder { color: #9ca3af; }

/* ============================================================
   9. Send button (круглая, стрелка вверх — SVG в chat.js)
   ============================================================ */
.flcw-send {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: #e7e7e2;
    color: #b7b7b0;
    cursor: default;
}
.flcw-send svg { display: block; }
.flcw-send:disabled { cursor: default; }
.flcw-send:not(:disabled) { background: #1f2937; color: #fff; cursor: pointer; }
.flcw-send:not(:disabled):hover { background: #111827; }

/* ============================================================
   10. Errors / loading
   ============================================================ */
.flcw-error {
    margin-top: 8px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 14px;
    text-align: center;
    border-radius: 10px;
    padding: 10px 12px;
}
.flcw-error[hidden] { display: none; }
.flcw-center { display: flex; align-items: flex-start; justify-content: center; padding: 24px 0; }
.flcw-brand { color: #9ca3af; font-size: 14px; }

/* ============================================================
   11. Responsive
   ============================================================ */
@media (max-width: 760px) {
    .flcw-row.user .flcw-bubble,
    .flcw-row.assistant .flcw-bubble { max-width: 90%; }
    .flcw-textarea { min-height: 50px; padding-right: 52px; }
    .flcw-send { right: 5px; bottom: 5px; }
}


