/* === TEAM-INTELLIGENCE.CSS ===
   assets/css/team-intelligence.css
   НАЗНАЧЕНИЕ: Стили дашборда Team Intelligence - CommandOS
   СВЯЗИ: assets/js/team-intelligence.js, index.php
*/

/* Обертка */
.ti-wrap {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    overflow-y: auto;
}

/* === ШАПКА === */
.ti-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.ti-header-left { display: flex; flex-direction: column; gap: 2px; }
.ti-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 0; }
.ti-sub { font-size: 11px; color: var(--text-muted); }
.ti-header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Кнопки периода */
.ti-period-btns { display: flex; gap: 2px; background: var(--bg-primary); border-radius: 6px; padding: 2px; }
.ti-period-btn {
    padding: 5px 12px; font-size: 11px; border-radius: 4px; cursor: pointer;
    background: transparent; color: var(--text-muted);
    border: none; transition: all 0.15s; font-weight: 500;
}
.ti-period-btn:hover { color: var(--text-primary); }
.ti-period-btn.active { background: var(--color-primary); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

/* Кнопка анализа */
.ti-btn-analyze {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 16px; font-size: 12px; font-weight: 600;
    background: #10b981; color: #fff; border: 1px solid #10b981;
    border-radius: 6px; cursor: pointer; transition: all 0.15s; white-space: nowrap;
    box-shadow: 0 1px 4px rgba(16,185,129,0.25);
}
.ti-btn-analyze:hover { background: #059669; border-color: #059669; transform: translateY(-1px); box-shadow: 0 3px 10px rgba(16,185,129,0.35); }
.ti-btn-analyze:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* === ТРЕВОЖНЫЕ СИГНАЛЫ === */
.ti-alerts-wrap {
    background: hsl(0 60% 8%);
    border: 1px solid hsl(0 60% 25%);
    border-radius: 8px;
    padding: 10px;
}
html.light-theme .ti-alerts-wrap { background: hsl(0 100% 97%); border-color: hsl(0 60% 80%); }
.ti-alerts { display: flex; flex-direction: column; gap: 6px; }
.ti-alert { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-primary); }
.ti-alert-high_negativity svg { stroke: #f87171; }
.ti-alert-low_activity svg { stroke: #fb923c; }

/* === МЕТРИКИ === */
.ti-metrics-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.ti-metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 10px;
    text-align: center;
    transition: border-color 0.15s;
}
.ti-metric-card:hover { border-color: var(--text-muted); }
.ti-metric-val {
    font-size: 24px; font-weight: 700; color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace; line-height: 1.2;
}
.ti-metric-lbl { font-size: 10px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.ti-metric-pos .ti-metric-val { color: #4ade80; }
.ti-metric-neg .ti-metric-val { color: #f87171; }

/* === ОСНОВНАЯ СЕТКА === */
.ti-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 10px;
    min-height: 0;
    flex: 1;
}

/* === КАРТОЧКИ === */
.ti-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.ti-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; font-size: 11px; font-weight: 600; color: var(--text-muted);
    border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.5px;
    background: var(--bg-primary);
}

/* === ЛЕВАЯ КОЛОНКА === */
.ti-col-left { display: flex; flex-direction: column; gap: 10px; }

/* === УЧАСТНИКИ === */
.ti-members-list { padding: 4px 0; }
.ti-member-row {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.ti-member-row:last-child { border-bottom: none; }
.ti-member-row:hover { background: var(--bg-primary); }
.ti-member-row.ti-member-warn { border-left: 3px solid #f87171; }
.ti-member-name {
    font-size: 13px; color: var(--text-primary); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ti-member-user { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.ti-member-bar-wrap {
    height: 4px; background: var(--border); border-radius: 2px;
    margin: 6px 0; overflow: hidden;
}
.ti-member-bar {
    height: 4px; background: var(--color-primary); border-radius: 2px;
    transition: width 0.4s ease;
}
.ti-member-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.ti-stat { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.ti-stat-voice { color: #facc15; }
.ti-stat-pos { color: #4ade80; }
.ti-stat-neg { color: #f87171; }
.ti-stat-task { color: #60a5fa; }

/* === БЕЙДЖИ === */
.ti-badges-list { padding: 4px 0; }
.ti-badge-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.ti-badge-row:last-child { border-bottom: none; }
.ti-badge-icon { color: #facc15; flex-shrink: 0; }
.ti-badge-info { min-width: 0; }
.ti-badge-name { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.ti-badge-label { font-size: 11px; color: var(--text-muted); }

/* === ФИЛЬТРЫ ЛЕНТЫ === */
.ti-feed-filter { display: flex; gap: 2px; background: var(--bg-primary); border-radius: 4px; padding: 2px; }
.ti-filter-btn {
    padding: 3px 8px; font-size: 10px; border-radius: 3px; cursor: pointer;
    background: transparent; color: var(--text-muted);
    border: none; transition: all 0.15s; font-weight: 500;
}
.ti-filter-btn:hover { color: var(--text-primary); }
.ti-filter-btn.active { background: var(--color-primary); color: #fff; }

/* === ЛЕНТА СООБЩЕНИЙ === */
.ti-card-feed { display: flex; flex-direction: column; min-height: 0; }
.ti-feed { overflow-y: auto; flex: 1; max-height: calc(100vh - 380px); }
.ti-msg-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    transition: background 0.1s;
}
.ti-msg-row:hover { background: var(--bg-primary); }
.ti-msg-row:last-child { border-bottom: none; }
.ti-sent-pos { border-left-color: #4ade80; }
.ti-sent-neg { border-left-color: #f87171; }
.ti-sent-neu { border-left-color: var(--border); }

.ti-msg-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.ti-msg-kind { display: flex; align-items: center; }
.ti-msg-sender { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.ti-msg-time { font-size: 10px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
.ti-msg-voice-badge {
    font-size: 9px; color: #facc15; background: hsl(45 90% 15%);
    padding: 2px 6px; border-radius: 3px; font-weight: 500;
}
html.light-theme .ti-msg-voice-badge { background: hsl(45 90% 90%); color: hsl(45 80% 30%); }
.ti-msg-task-badge {
    font-size: 9px; color: #60a5fa; background: hsl(217 80% 15%);
    padding: 2px 6px; border-radius: 3px; font-weight: 500;
}
html.light-theme .ti-msg-task-badge { background: hsl(217 80% 92%); color: hsl(217 80% 35%); }
.ti-msg-text { font-size: 12px; color: var(--text-primary); line-height: 1.5; }
.ti-msg-transcript { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-style: italic; }

/* === ЗАГРУЗКА / ПУСТО === */
.ti-loading {
    padding: 30px 10px; text-align: center; color: var(--text-muted); font-size: 12px;
}
.ti-empty {
    padding: 24px 10px; text-align: center; color: var(--text-muted); font-size: 12px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}

/* === МОДАЛКА === */
.ti-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center; z-index: 9000;
    backdrop-filter: blur(4px);
}
html.light-theme .ti-modal { background: rgba(0,0,0,0.35); }
.ti-modal-box {
    background: var(--bg-card, #1a1a22); border: 1px solid var(--border, hsl(220,10%,18%));
    border-radius: 10px; width: 560px; max-width: 95vw; max-height: 80vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
html.light-theme .ti-modal-box {
    background: #fff; border-color: hsl(220,15%,82%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.ti-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border, hsl(220,10%,18%));
    font-size: 14px; font-weight: 600; color: var(--text-primary);
}
html.light-theme .ti-modal-header { border-color: hsl(220,15%,85%); color: hsl(220,20%,12%); }
.ti-modal-close {
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    font-size: 18px; padding: 2px 6px; line-height: 1; border-radius: 4px;
    transition: all 0.15s;
}
.ti-modal-close:hover { color: var(--text-primary); background: var(--bg-primary); }
.ti-analyze-result { padding: 16px; overflow-y: auto; }

/* Результат анализа */
.ti-result-info { font-size: 15px; color: var(--text-primary); margin-bottom: 12px; font-weight: 500; line-height: 1.6; }
html.light-theme .ti-result-info { color: hsl(220, 20%, 15%); }
.ti-result-error { font-size: 13px; color: #f87171; padding: 12px; background: hsl(0 60% 8%); border-radius: 6px; }
html.light-theme .ti-result-error { background: hsl(0 100% 97%); color: hsl(0, 70%, 40%); }
.ti-result-list { display: flex; flex-direction: column; gap: 8px; }
.ti-result-task {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 10px 12px; background: var(--bg-primary); border-radius: 6px;
    border-left: 3px solid var(--color-primary);
}
html.light-theme .ti-result-task { background: hsl(220, 20%, 96%); }
.ti-result-task-num { font-size: 12px; color: var(--text-muted); min-width: 20px; font-weight: 600; }
.ti-result-task-body { flex: 1; min-width: 0; }
.ti-result-task-title { font-size: 13px; color: var(--text-primary); font-weight: 500; margin-bottom: 4px; }
html.light-theme .ti-result-task-title { color: hsl(220, 20%, 12%); }
.ti-result-task-meta { display: flex; gap: 10px; font-size: 11px; color: var(--text-muted); }
.ti-urgency-critical { color: #f87171; font-weight: 600; }
.ti-urgency-high { color: #fb923c; font-weight: 500; }
.ti-urgency-normal { color: var(--text-muted); }
.ti-urgency-low { color: var(--text-muted); }

/* === БЛОК ЗАДАЧ К СОЗДАНИЮ === */
.ti-pending-wrap {
    background: hsl(217 60% 8%);
    border: 1px solid hsl(217 60% 22%);
    border-radius: 8px;
    overflow: hidden;
}
html.light-theme .ti-pending-wrap { background: hsl(217 100% 97%); border-color: hsl(217 60% 78%); }
.ti-pending-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px;
    background: hsl(217 60% 11%);
    border-bottom: 1px solid hsl(217 60% 22%);
}
html.light-theme .ti-pending-header { background: hsl(217 60% 94%); border-color: hsl(217 60% 80%); }
.ti-pending-title {
    font-size: 12px; font-weight: 600; color: #60a5fa;
    display: flex; align-items: center; gap: 6px;
}
.ti-pending-actions { display: flex; gap: 6px; }
.ti-btn-create-all {
    padding: 5px 14px; font-size: 11px; font-weight: 600;
    background: var(--color-primary); color: #fff;
    border: none; border-radius: 5px; cursor: pointer; transition: all 0.15s;
}
.ti-btn-create-all:hover { opacity: 0.85; }
.ti-btn-create-all:disabled { opacity: 0.4; cursor: not-allowed; }
.ti-btn-dismiss-all {
    padding: 5px 10px; font-size: 11px;
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 5px; cursor: pointer; transition: all 0.15s;
}
.ti-btn-dismiss-all:hover { color: var(--text-primary); }

.ti-pending-list { display: flex; flex-direction: column; }
.ti-pending-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.ti-pending-row:last-child { border-bottom: none; }
.ti-pending-check { margin-top: 2px; flex-shrink: 0; cursor: pointer; accent-color: var(--color-primary); }
.ti-pending-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ti-pending-row-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ti-pending-source { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.ti-pending-urgency-high { color: #fb923c; font-size: 10px; font-weight: 600; }
.ti-pending-urgency-critical { color: #f87171; font-size: 10px; font-weight: 600; }
.ti-pending-title-input {
    width: 100%; padding: 5px 8px; font-size: 12px;
    background: var(--bg-primary); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 4px;
    font-family: inherit;
}
.ti-pending-title-input:focus { outline: none; border-color: var(--color-primary); }
.ti-pending-row-bottom { display: flex; gap: 6px; flex-wrap: wrap; }
.ti-pending-select {
    padding: 4px 6px; font-size: 11px;
    background: var(--bg-primary); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 4px;
    font-family: inherit; cursor: pointer;
}
.ti-pending-select:focus { outline: none; border-color: var(--color-primary); }
.ti-pending-dismiss {
    margin-left: auto; background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 2px 4px; border-radius: 3px; transition: color 0.15s;
    flex-shrink: 0;
}
.ti-pending-dismiss:hover { color: #f87171; }
.ti-pending-analyzing {
    padding: 16px; text-align: center; font-size: 12px; color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .ti-grid { grid-template-columns: 1fr; }
    .ti-metrics-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .ti-metrics-row { grid-template-columns: repeat(2, 1fr); }
    .ti-header { flex-direction: column; align-items: flex-start; }
    .ti-header-right { width: 100%; justify-content: space-between; }
}
