/* === TEAM-CHAT-WIDGET.CSS ===
   assets/css/team-chat-widget.css
   НАЗНАЧЕНИЕ: Стили плавающего виджета командного чата AI-ассистента
   РАЗМЕР: ~200 строк */

/* --- Плавающая кнопка --- */
.tf-tcw-btn {
    position: fixed; bottom: 20px; right: 20px; z-index: 1000;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--color-primary, hsl(217, 91%, 60%));
    color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform 0.15s, box-shadow 0.15s;
}
.tf-tcw-btn:hover { transform: scale(1.08); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.tf-tcw-btn svg { width: 22px; height: 22px; }

/* Бейдж непрочитанных */
.tf-tcw-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--color-danger, hsl(0, 84%, 60%));
    color: #fff; font-size: 11px; font-weight: 600;
    border-radius: 9px; display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.tf-tcw-badge:empty, .tf-tcw-badge[data-count="0"] { display: none; }

/* Пульсация при новых сообщениях */
@keyframes tf-tcw-pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
    70% { box-shadow: 0 0 0 12px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
.tf-tcw-btn.has-new { animation: tf-tcw-pulse 1.5s ease-out infinite; }

/* --- Панель чата --- */
.tf-tcw-panel {
    position: fixed; bottom: 76px; right: 20px; z-index: 1001;
    width: 380px; height: 500px;
    background: var(--bg-primary, hsl(220, 13%, 5%));
    border: 1px solid var(--border, hsl(220, 10%, 16%));
    border-radius: 12px;
    display: none; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    overflow: hidden;
    animation: tf-tcw-slideUp 0.2s ease-out;
}
.tf-tcw-panel.open { display: flex; }

@keyframes tf-tcw-slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Заголовок панели */
.tf-tcw-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; border-bottom: 1px solid var(--border, hsl(220, 10%, 16%));
    flex-shrink: 0;
}
.tf-tcw-header-title {
    font-size: 13px; font-weight: 600;
    color: var(--text-primary, hsl(0, 0%, 92%));
    display: flex; align-items: center; gap: 6px;
}
.tf-tcw-header-title svg { width: 16px; height: 16px; opacity: 0.7; }
.tf-tcw-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-secondary, hsl(0, 0%, 55%)); padding: 4px;
}
.tf-tcw-close:hover { color: var(--text-primary, hsl(0, 0%, 92%)); }

/* Область сообщений */
.tf-tcw-messages {
    flex: 1; overflow-y: auto; padding: 10px;
    display: flex; flex-direction: column; gap: 8px;
}

/* Пустое состояние */
.tf-tcw-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: var(--text-muted, hsl(0, 0%, 45%));
    font-size: 13px;
}

/* Сообщения */
.tf-tcw-msg {
    max-width: 85%; padding: 8px 10px;
    border-radius: 10px; font-size: 13px; line-height: 1.45;
    color: var(--text-primary, hsl(0, 0%, 92%));
    word-wrap: break-word;
}
.tf-tcw-msg--ai {
    align-self: flex-start;
    background: var(--card-bg, hsl(220, 13%, 8%));
    border: 1px solid var(--border, hsl(220, 10%, 16%));
    border-bottom-left-radius: 3px;
}
.tf-tcw-msg--user {
    align-self: flex-end;
    background: hsla(217, 91%, 60%, 0.15);
    border: 1px solid hsla(217, 91%, 60%, 0.2);
    border-bottom-right-radius: 3px;
}
.tf-tcw-msg--system {
    align-self: center; max-width: 90%;
    background: hsla(160, 60%, 45%, 0.08);
    border: 1px solid hsla(160, 60%, 45%, 0.15);
    text-align: center; font-size: 12px;
    color: var(--text-muted, hsl(0, 0%, 55%));
}

/* Мета сообщения */
.tf-tcw-msg-meta {
    font-size: 10px; margin-top: 4px;
    color: var(--text-muted, hsl(0, 0%, 45%));
    display: flex; align-items: center; gap: 4px;
}
.tf-tcw-msg--ai .tf-tcw-msg-meta { justify-content: flex-start; }
.tf-tcw-msg--user .tf-tcw-msg-meta { justify-content: flex-end; }

/* @mention выделение */
.tf-tcw-mention { font-weight: 600; color: var(--color-primary, hsl(217, 91%, 60%)); }

/* Ссылка на задачу */
.tf-tcw-task-link {
    color: var(--color-primary, hsl(217, 91%, 60%));
    cursor: pointer; text-decoration: underline;
    font-weight: 500;
}
.tf-tcw-task-link:hover { opacity: 0.8; }

/* Поле ввода */
.tf-tcw-input-wrap {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--border, hsl(220, 10%, 16%));
    flex-shrink: 0;
}
.tf-tcw-input {
    flex: 1; background: var(--bg-hover, hsl(220, 13%, 10%));
    border: 1px solid var(--border, hsl(220, 10%, 16%));
    border-radius: 8px; padding: 8px 10px;
    color: var(--text-primary, hsl(0, 0%, 92%));
    font-size: 13px; outline: none; resize: none;
    min-height: 36px; max-height: 80px;
}
.tf-tcw-input::placeholder { color: var(--text-muted, hsl(0, 0%, 45%)); }
.tf-tcw-input:focus { border-color: var(--color-primary, hsl(217, 91%, 60%)); }
.tf-tcw-send {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--color-primary, hsl(217, 91%, 60%));
    color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: opacity 0.15s;
}
.tf-tcw-send:hover { opacity: 0.85; }
.tf-tcw-send:disabled { opacity: 0.4; cursor: not-allowed; }
.tf-tcw-send svg { width: 16px; height: 16px; }

/* AI typing indicator */
.tf-tcw-typing {
    padding: 8px 10px; font-size: 12px;
    color: var(--text-muted, hsl(0, 0%, 45%));
    display: none;
}
.tf-tcw-typing.active { display: block; }

/* --- Light theme --- */
html.light-theme .tf-tcw-panel {
    background: var(--bg-primary, hsl(220, 20%, 97%));
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
html.light-theme .tf-tcw-msg--ai {
    background: var(--card-bg, hsl(220, 20%, 94%));
}
html.light-theme .tf-tcw-msg--user {
    background: hsla(217, 91%, 55%, 0.1);
    border-color: hsla(217, 91%, 55%, 0.15);
}
html.light-theme .tf-tcw-input {
    background: var(--bg-hover, hsl(220, 20%, 93%));
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .tf-tcw-panel {
        width: calc(100vw - 20px); right: 10px; bottom: 70px;
        height: 60vh;
    }
    .tf-tcw-btn { bottom: 14px; right: 14px; }
}
