/**
 * Підзавдання: бейджі у списках (Центр завдань, дерево справи) і блок
 * «Підзавдання» у спільній модалці завдання (task-modal.js).
 * Палітра узгоджена з чіпами модалки (slate/emerald, як tc-chip).
 */

/* ---- Бейдж прогресу «N/M» у рядках списків ---- */
.tc-subtasks-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.tc-subtasks-badge i { font-size: 0.8em; }
.tc-subtasks-badge--done {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #059669;
}

/* Мітка «↳ батьківське завдання» у рядку підзавдання */
.tc-parent-label {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Розрив у хлібних крихтах модалки: Справа › Батьківське завдання */
.tc-breadcrumb__sep {
    margin: 0 4px;
    color: #94a3b8;
}
.tc-breadcrumb__parent i {
    font-size: 0.85em;
    margin-right: 3px;
}

/* ---- Секція «Підзавдання» в модалці ---- */
.tc-subtasks-section {
    margin-top: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fcfdfe;
}
.tc-subtasks-section--empty {
    border-style: dashed;
    background: transparent;
    padding: 6px 8px;
}

.tc-subtasks-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.tc-subtasks-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.tc-subtasks-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}
.tc-subtasks-progress {
    flex: 1 1 60px;
    max-width: 140px;
    height: 5px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.tc-subtasks-progress__fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #10b981;
    transition: width 0.25s ease;
}

.tc-subtasks-list {
    display: flex;
    flex-direction: column;
}
.tc-subtasks-loading { padding: 4px 2px; }

/* Рядок підзавдання - клікабельний, відкриває його в цій же модалці */
.tc-subtask-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    font-size: 0.85rem;
    color: #1e293b;
    cursor: pointer;
}
.tc-subtask-row:hover { background: #f1f5f9; }
.tc-subtask-row + .tc-subtask-row { margin-top: 1px; }

.tc-subtask-status { font-size: 0.95rem; color: #94a3b8; flex: 0 0 auto; }
.tc-subtask-status--in_progress,
.tc-subtask-status--pending_review { color: #3D5BB5; }
.tc-subtask-row--done .tc-subtask-status { color: #10b981; }

.tc-subtask-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tc-subtask-row--done .tc-subtask-name {
    color: #94a3b8;
    text-decoration: line-through;
}

.tc-subtask-due {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: #64748b;
    white-space: nowrap;
}
.tc-subtask-due--overdue { color: #dc2626; font-weight: 600; }

.tc-subtask-assignee {
    flex: 0 0 auto;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.72rem;
    color: #94a3b8;
}

/* Швидке додавання підзавдання */
.tc-subtask-add { margin-top: 4px; }
.tc-subtask-add__toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
}
.tc-subtask-add__toggle:hover { background: #f1f5f9; color: #30478D; }
.tc-subtask-add__form {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 2px;
}
.tc-subtask-add__form .form-control { flex: 1 1 auto; }
.tc-subtask-add__submit { flex: 0 0 auto; white-space: nowrap; }

/* Замок замість селекта батька: завдання само має підзавдання */
.tc-linked-locked {
    padding: 7px 10px;
    border: 1px dashed #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

/* ТЕМНА ТЕМА (етап 2): згенеровано зі світлих правил - див. коментар у task-center.css */
body[data-theme="dark"] .tc-subtasks-badge {
    border: 1px solid var(--border-color);
    background: var(--card);
    color: var(--ink-2);
}
body[data-theme="dark"] .tc-subtasks-badge--done {
    border-color: color-mix(in srgb, #35E393 40%, var(--card));
    background: var(--card);
    color: #70EBC5;
}
body[data-theme="dark"] .tc-breadcrumb__sep {
    color: var(--muted);
}
body[data-theme="dark"] .tc-subtasks-section {
    border: 1px solid var(--border-color);
    background: var(--card);
}
body[data-theme="dark"] .tc-subtasks-title {
    color: var(--ink-2);
}
body[data-theme="dark"] .tc-subtasks-count {
    color: var(--muted);
}
body[data-theme="dark"] .tc-subtasks-progress {
    background: var(--soft);
}
body[data-theme="dark"] .tc-subtask-row {
    color: var(--ink);
}
body[data-theme="dark"] .tc-subtask-row:hover {
    background: var(--soft);
}
body[data-theme="dark"] .tc-subtask-status {
    color: var(--muted);
}
body[data-theme="dark"] .tc-subtask-status--in_progress,
body[data-theme="dark"] .tc-subtask-status--pending_review {
    color: #8599D6;
}
body[data-theme="dark"] .tc-subtask-row--done .tc-subtask-status {
    color: var(--muted);
}
body[data-theme="dark"] .tc-subtask-row--done .tc-subtask-name {
    color: var(--muted);
}
body[data-theme="dark"] .tc-subtask-due {
    color: var(--muted);
}
body[data-theme="dark"] .tc-subtask-due--overdue {
    color: #E87272;
}
body[data-theme="dark"] .tc-subtask-assignee {
    color: var(--muted);
}
body[data-theme="dark"] .tc-subtask-add__toggle {
    color: var(--muted);
}
body[data-theme="dark"] .tc-subtask-add__toggle:hover {
    background: var(--soft);
    color: #8599D6;
}
body[data-theme="dark"] .tc-linked-locked {
    border: 1px dashed var(--border-color);
    background: var(--card);
}
