/*
 * DBS Workspace TM — Client Portal Styles
 */

/* ── Layout ─────────────────────────────────────────────────────────────── */
.tm-client-wrap { max-width: 1200px; margin: 0 auto; }

/* ── Level tree ─────────────────────────────────────────────────────────── */
.tm-level-row {
    border-left: 3px solid transparent;
    transition: border-color .15s;
}
.tm-level-row.depth-1 { border-left-color: #0d6efd; }
.tm-level-row.depth-2 { border-left-color: #6f42c1; margin-left: 1.5rem; }
.tm-level-row.depth-3 { border-left-color: #fd7e14; margin-left: 3rem; }

.tm-level-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    cursor: pointer;
    user-select: none;
    background: #f8f9fa;
    border-radius: .25rem;
}
.tm-level-header:hover { background: #e9ecef; }

.tm-level-toggle { font-size: 14px; transition: transform .2s; color: #6c757d; font-family: sans-serif; display: inline-block; }
.tm-level-toggle::before { content: '\25B8'; }
.tm-level-toggle.open { transform: rotate(90deg); }

.tm-level-title { font-weight: 700; flex: 1; font-size: 16px; }
.tm-level-badges { display: flex; gap: .25rem; flex-wrap: wrap; }

.tm-level-detail {
    display: none;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: 0;
    border-radius: 0 0 .25rem .25rem;
    font-size: 14px;
}
.tm-level-detail.open { display: block; }
.tm-level-detail small,
.tm-level-detail .small { font-size: 13px !important; }

/* ── Edit form within level detail ─────────────────────────────────────── */
.tm-edit-form label { font-size: 14px; font-weight: 600; color: #495057; }
.tm-edit-form .form-control,
.tm-edit-form .form-select { font-size: 14px; }
.tm-edit-form .btn { font-size: 14px; }

/* ── Save feedback ──────────────────────────────────────────────────────── */
.tm-save-msg {
    display: inline-block;
    font-size: 13px;
    margin-left: .5rem;
    opacity: 0;
    transition: opacity .3s;
}
.tm-save-msg.show { opacity: 1; }
.tm-save-msg.ok   { color: #198754; }
.tm-save-msg.err  { color: #dc3545; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge.tm-status-active,
.badge.tm-status-completed,
.badge.tm-status-onhold,
.badge.tm-status-canceled,
.badge.tm-priority-low,
.badge.tm-priority-normal,
.badge.tm-priority-high,
.badge.tm-priority-urgent,
.badge.tm-badge-date {
    display: inline-block;
    padding: .45em .85em;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    border-radius: .4rem;
    white-space: nowrap;
    vertical-align: middle;
}

/* ── Status badges ──────────────────────────────────────────────────────── */
.badge.tm-status-active    { background-color: #198754 !important; color: #fff !important; }
.badge.tm-status-completed { background-color: #0d6efd !important; color: #fff !important; }
.badge.tm-status-onhold    { background-color: #fd7e14 !important; color: #fff !important; }
.badge.tm-status-canceled  { background-color: #6c757d !important; color: #fff !important; }

/* ── Priority badges ────────────────────────────────────────────────────── */
.badge.tm-priority-low    { background-color: #20c997 !important; color: #fff !important; }
.badge.tm-priority-normal { background-color: #0dcaf0 !important; color: #000 !important; }
.badge.tm-priority-high   { background-color: #fd7e14 !important; color: #fff !important; }
.badge.tm-priority-urgent { background-color: #dc3545 !important; color: #fff !important; }

/* ── Date badges ────────────────────────────────────────────────────────── */
.badge.tm-badge-date { background-color: #f8f9fa !important; color: #212529 !important; border: 1px solid #dee2e6 !important; }

/* ── Drag-and-drop sort ─────────────────────────────────────────────────── */
.tm-drag-handle {
    cursor: grab;
    color: #adb5bd;
    font-size: 16px;
    padding: .2rem .4rem;
    flex-shrink: 0;
    border-radius: .2rem;
    transition: color .15s, background .15s;
    font-family: sans-serif;
    display: inline-block;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: element;
}
.tm-drag-handle::before { content: '\2630'; }
.tm-drag-handle:hover  { color: #495057; background: #dee2e6; }
.tm-drag-handle:active { cursor: grabbing; }

.tm-level-row.tm-dragging { opacity: .4; box-shadow: none !important; }
.tm-level-row.tm-drag-over-before { border-top: 3px solid #0d6efd !important; margin-top: -1px; }
.tm-level-row.tm-drag-over-after  { border-bottom: 3px solid #0d6efd !important; margin-bottom: -1px; }

/* ── Add task form ───────────────────────────────────────────────────────── */
.tm-add-task-card { max-width: 720px; }

/* ── Approved indicator ─────────────────────────────────────────────────── */
.tm-approved-badge { background: #198754 !important; color: #fff !important; font-size: 12px; font-weight: 600; padding: .45rem .85rem; border-radius: .4rem; }

/* ── Reference link display ─────────────────────────────────────────────── */
.tm-ref-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .5rem;
    font-size: 14px;
}
.tm-ref-link a { color: #0d6efd; text-decoration: none; word-break: break-all; }
.tm-ref-link a:hover { text-decoration: underline; }
.tm-ref-link .fa { color: #6c757d; flex-shrink: 0; }

/* ── File attachment list ───────────────────────────────────────────────── */
.tm-file-list { list-style: none !important; padding: 0 !important; margin: 0 0 .5rem !important; }
.tm-file-list li {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}
.tm-file-list li:last-child { border-bottom: none; }
.tm-file-list .tm-file-name {
    flex: 1;
    color: #0d6efd;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}
.tm-file-list .tm-file-name:hover { text-decoration: underline; }
.tm-file-list .tm-file-size { color: #6c757d; font-size: 12px; white-space: nowrap; }
.tm-file-delete-btn {
    border: none;
    background: none;
    color: #dc3545;
    cursor: pointer;
    padding: .1rem .3rem;
    font-size: 14px;
    border-radius: .2rem;
    flex-shrink: 0;
    line-height: 1;
}
.tm-file-delete-btn:hover { background: #fdf0f0; }

/* ── File upload area ───────────────────────────────────────────────────── */
.tm-files-section { font-size: 14px; }
.tm-files-section h6 { font-size: 14px; font-weight: 700; color: #495057; margin-bottom: .5rem; }
.tm-file-upload {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .5rem;
}
.tm-file-upload input[type=file] { flex: 1; min-width: 180px; font-size: 14px; }
.tm-upload-msg { font-size: 14px; }
.tm-upload-msg.ok  { color: #198754; }
.tm-upload-msg.err { color: #dc3545; }

/* ── Archived task section (collapsed) ──────────────────────────────────── */
.tm-archive-section { margin-top: .5rem; }
.tm-archive-toggle { transition: background .15s; }
.tm-archive-toggle:hover { background: #e9ecef !important; }
.tm-arc-arrow { transition: transform .2s; display: inline-block; font-family: sans-serif; font-style: normal; }
.tm-arc-arrow::before { content: '\25B8'; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.tm-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}
.tm-toolbar-left  { flex: 1; min-width: 200px; }
.tm-toolbar-right { flex-shrink: 0; align-self: center; }

/* ── Edit form row/col ───────────────────────────────────────────────────── */
.tm-form-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.tm-col-4    { flex: 0 0 calc(33.333% - .34rem); min-width: 110px; }
.tm-col-6    { flex: 0 0 calc(50% - .25rem); min-width: 140px; }
.tm-col-12   { flex: 0 0 100%; }
