/* assistant.css — стили модального окна «Ассистент построения процесса» */

.assist-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.assist-modal-content {
    background: #f8f9fa;
    color: #333;
    width: min(640px, 95vw);
    max-height: 85vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* --- Шапка --- */
.assist-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.assist-header h3 {
    margin: 0;
    font-size: 17px;
    flex: 1;
}

.assist-header-icon {
    color: #1976D2;
    font-size: 26px;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.assist-close {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0 4px;
}
.assist-close:hover { color: #f44336; }

/* --- Прогресс --- */
.assist-progress {
    display: flex;
    gap: 6px;
    padding: 12px 20px 0 20px;
}

.assist-step-dot {
    width: 24px;
    height: 4px;
    border-radius: 2px;
    background: #d0d5da;
    transition: background 0.25s ease;
}
.assist-step-dot.done   { background: #90caf9; }
.assist-step-dot.active { background: #1976D2; }

/* --- Тело --- */
.assist-body {
    padding: 20px;
    overflow-y: auto;
    min-height: 160px;
    font-size: 14px;
    line-height: 1.5;
}

.assist-welcome p { margin: 0 0 12px 0; }

.assist-feature-list {
    list-style: none;
    margin: 0 0 12px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.assist-feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.assist-feature-list .material-symbols-outlined {
    font-size: 20px;
    color: #1976D2;
    font-variation-settings: 'FILL' 0, 'wght' 350, 'GRAD' 0, 'opsz' 24;
}

.assist-note {
    font-size: 12px;
    color: #888;
    border-top: 1px dashed #ccc;
    padding-top: 10px;
}

.assist-label {
    display: block;
    margin: 0 0 10px 0;
    color: #555;
}

.assist-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #ffffff;
    color: #333;
    font-size: 14px;
    font-family: inherit;
}
.assist-input:focus {
    outline: none;
    border-color: #1976D2;
}

.assist-error {
    color: #f44336;
    font-size: 12px;
    margin-top: 8px;
}

.assist-json {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    font-size: 12px;
    line-height: 1.45;
    overflow-x: auto;
    margin: 0;
}

/* --- Футер --- */
.assist-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e0e0e0;
}

.assist-btn {
    padding: 8px 22px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}

.assist-btn-primary {
    background: #1976D2;
    color: white;
    font-weight: bold;
}
.assist-btn-primary:hover { background: #1565c0; }

.assist-btn-ghost {
    background: transparent;
    color: #888;
    border: 1px solid #bbb;
}
.assist-btn-ghost:hover { color: #333; border-color: #888; }

/* --- Индикатор ИИ на кнопке-роботе в шапке --- */
#btn-assistant { position: relative; }
#btn-assistant.assist-ai-on::after {
    content: '';
    position: absolute;
    top: 5px; right: 5px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #4caf50;
    box-shadow: 0 0 4px rgba(76, 175, 80, 0.9);
}

/* --- Карточка статуса ИИ (приветственный экран) --- */
.assist-ai-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #ffffff;
    margin-bottom: 12px;
}

.assist-ai-text { flex: 1; font-size: 13px; }

.assist-ai-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.assist-ai-dot.on       { background: #4caf50; }
.assist-ai-dot.off      { background: #f44336; }
.assist-ai-dot.checking { background: #ff9800; animation: assist-pulse 1s ease-in-out infinite; }

@keyframes assist-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

.assist-btn-small {
    padding: 5px 14px;
    font-size: 12px;
    font-weight: normal;
}

/* --- Экран подключения ИИ --- */
.assist-setup-step {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #ffffff;
    margin-bottom: 10px;
    align-items: flex-start;
}

.assist-setup-badge {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #d0d5da;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    flex-shrink: 0;
}
.assist-setup-badge .material-symbols-outlined { font-size: 18px; }

.assist-setup-step.ok  .assist-setup-badge { background: #4caf50; color: white; }
.assist-setup-step.err .assist-setup-badge { background: #f44336; color: white; }
.assist-setup-step.wait .assist-setup-badge { background: #e3f2fd; }

.assist-setup-info  { flex: 1; min-width: 0; }
.assist-setup-title { font-weight: bold; font-size: 14px; margin-bottom: 3px; }
.assist-setup-detail { font-size: 13px; color: #555; line-height: 1.45; }
.assist-setup-hint  { font-size: 11.5px; color: #999; margin-top: 6px; }

.assist-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(25, 118, 210, 0.25);
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: assist-spin 0.75s linear infinite;
}
@keyframes assist-spin { to { transform: rotate(360deg); } }

/* Прогресс-бар загрузки модели */
.assist-pbar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}
.assist-pbar-fill {
    height: 100%;
    width: 0%;
    background: #1976D2;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* --- Редакторы-списки в мастере --- */
.assist-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.assist-row { display: flex; gap: 6px; align-items: center; }
.assist-row-del {
    background: transparent; border: none; color: #999; font-size: 20px;
    cursor: pointer; line-height: 1; padding: 0 4px; flex-shrink: 0;
}
.assist-row-del:hover { color: #f44336; }
.assist-input-compact { padding: 7px 9px; font-size: 13px; }
.assist-radio, .assist-check {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; margin: 6px 0; cursor: pointer;
}

/* --- Док-панель маршрута --- */
.assist-dock {
    position: fixed;
    top: 52px; right: 0; bottom: 0;
    width: 400px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    color: #333;
    border-left: 1px solid #d0d5da;
    box-shadow: -6px 0 18px rgba(0,0,0,0.12);
    font-size: 13px;
}

.assist-dock-header {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
}
.assist-dock-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.assist-dock-title b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assist-dock-title span { font-size: 11px; color: #888; }

.assist-dock-phase {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #e0e0e0;
}
.assist-dock-phase-label { font-weight: bold; flex-shrink: 0; }
.assist-dock-phase select { flex: 1; min-width: 0; }

.assist-dock-cursor {
    padding: 10px 14px;
    background: #eef4fb;
    border-bottom: 1px solid #e0e0e0;
    line-height: 1.45;
}

.assist-dock-branches { padding: 0 14px; }
.assist-dock-branches:not(:empty) { padding: 8px 14px; border-bottom: 1px solid #e0e0e0; }

.assist-branch-chip {
    display: inline-block;
    padding: 3px 10px;
    margin: 2px 4px 2px 0;
    border-radius: 12px;
    background: #e3eaf2;
    border: 1px solid #c6d4e2;
    font-size: 12px;
    cursor: pointer;
}
.assist-branch-chip.active { background: #1976D2; color: white; border-color: #1976D2; }

.assist-dock-hint {
    margin: 8px 14px 0 14px;
    padding: 8px 10px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.assist-dock-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 12px 14px;
}
.assist-card {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px;
    border: 1px solid #d0d5da;
    border-radius: 8px;
    background: #ffffff;
    color: #333;
    font-size: 11.5px;
    cursor: pointer;
    font-family: inherit;
}
.assist-card:hover:not(:disabled) { border-color: #1976D2; color: #1976D2; }
.assist-card:disabled { opacity: 0.45; cursor: default; }
.assist-card .material-symbols-outlined { font-size: 22px; }

.assist-dock-form {
    flex: 1;
    overflow-y: auto;
    padding: 0 14px 10px 14px;
}
.assist-form-title { font-weight: bold; font-size: 14px; margin: 6px 0 8px 0; }
.assist-dock-form .assist-input { width: 100%; box-sizing: border-box; }

.assist-dock-footer {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #e0e0e0;
}

.assist-issues { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.assist-issue { padding: 7px 10px; border-radius: 6px; font-size: 12px; line-height: 1.4; }
.assist-issue.err  { background: #fdecea; border: 1px solid #f5c6c0; }
.assist-issue.warn { background: #fff8e1; border: 1px solid #ffe082; }

/* --- Тёмная тема --- */
[data-theme="dark"] .assist-modal-content { background: #2a3342; color: #cbcbcb; }
[data-theme="dark"] .assist-header        { border-bottom-color: #4c637a; }
[data-theme="dark"] .assist-footer        { border-top-color: #4c637a; }
[data-theme="dark"] .assist-label         { color: #a8b3bf; }
[data-theme="dark"] .assist-input {
    background: #21272d;
    color: white;
    border-color: #4c637a;
}
[data-theme="dark"] .assist-input:focus   { border-color: #2196f3; }
[data-theme="dark"] .assist-json {
    background: #21272d;
    border-color: #4c637a;
    color: #cbcbcb;
}
[data-theme="dark"] .assist-step-dot      { background: #4c637a; }
[data-theme="dark"] .assist-step-dot.done { background: #35576e; }
[data-theme="dark"] .assist-step-dot.active { background: #2196f3; }
[data-theme="dark"] .assist-note          { color: #7d8894; border-top-color: #4c637a; }
[data-theme="dark"] .assist-btn-ghost     { color: #a8b3bf; border-color: #4c637a; }
[data-theme="dark"] .assist-btn-ghost:hover { color: white; border-color: #a8b3bf; }
[data-theme="dark"] .assist-dock          { background: #2a3342; color: #cbcbcb; border-left-color: #4c637a; }
[data-theme="dark"] .assist-dock-header,
[data-theme="dark"] .assist-dock-phase    { border-bottom-color: #4c637a; }
[data-theme="dark"] .assist-dock-footer   { border-top-color: #4c637a; }
[data-theme="dark"] .assist-dock-cursor   { background: #1e2a38; border-bottom-color: #4c637a; }
[data-theme="dark"] .assist-dock-branches:not(:empty) { border-bottom-color: #4c637a; }
[data-theme="dark"] .assist-branch-chip   { background: #21272d; border-color: #4c637a; color: #cbcbcb; }
[data-theme="dark"] .assist-branch-chip.active { background: #2196f3; border-color: #2196f3; color: white; }
[data-theme="dark"] .assist-card          { background: #21272d; border-color: #4c637a; color: #cbcbcb; }
[data-theme="dark"] .assist-card:hover:not(:disabled) { border-color: #2196f3; color: #2196f3; }
[data-theme="dark"] .assist-dock-hint     { background: #33301e; border-color: #6b5f2a; }
[data-theme="dark"] .assist-issue.err     { background: #3a2422; border-color: #7a3f39; }
[data-theme="dark"] .assist-issue.warn    { background: #33301e; border-color: #6b5f2a; }
[data-theme="dark"] .assist-dock-title span { color: #7d8894; }
[data-theme="dark"] .assist-ai-card       { background: #21272d; border-color: #4c637a; }
[data-theme="dark"] .assist-setup-step    { background: #21272d; border-color: #4c637a; }
[data-theme="dark"] .assist-setup-badge   { background: #4c637a; color: #cbcbcb; }
[data-theme="dark"] .assist-setup-step.wait .assist-setup-badge { background: #1e2a38; }
[data-theme="dark"] .assist-setup-detail  { color: #a8b3bf; }
[data-theme="dark"] .assist-setup-hint    { color: #7d8894; }
[data-theme="dark"] .assist-pbar          { background: #374151; }
