/* ========================================================================
   list.css - List View Table
   Table, grouped headers, row states, inline editing.
   ======================================================================== */
.list-view {
    display: none;
}

.list-view.active {
    display: block;
}

.table-card {
    background: white;
    border: 1px solid var(--gray-200);
    overflow: hidden;
    margin-bottom: 8px;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

thead {
    background: var(--gray-50);
}

th {
    padding: 7px 10px;
    text-align: left;
    font-size: 9.5px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    position: relative;
}

th:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

th .sort-icon {
    display: inline-block;
    margin-left: 3px;
    font-size: 8px;
    opacity: 0.3;
    transition: var(--transition);
}

th.sorted .sort-icon {
    opacity: 1;
    color: var(--primary);
}

th.no-sort {
    cursor: default;
}

th.no-sort:hover {
    background: var(--gray-50);
    color: var(--gray-500);
}

td {
    padding: 6px 10px;
    font-size: var(--font-size-sm);
    border-bottom: 1px solid var(--gray-100);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    vertical-align: middle;
}

/* Data-row hover — a horizontal band with accent bars only at the row ends.
   Refinement of the reports/_shared row-hover standard, which draws a bar at
   every cell edge (fine for 3-4 column reports, noisy on this ~10-column grid).
   The inset fill stacks over any row/cell background instead of replacing it,
   so zebra rows, group rows and the editable-cell tint all survive underneath. */
.table-card tbody tr:not(.group-header-row):hover > td {
    box-shadow: inset 0 0 0 9999px var(--row-hover-bg);
}
.table-card tbody tr:not(.group-header-row):hover > td:first-child {
    box-shadow:
        inset 0 0 0 9999px var(--row-hover-bg),
        inset 3px 0 0 0 var(--row-hover-accent);
}
.table-card tbody tr:not(.group-header-row):hover > td:last-child {
    box-shadow:
        inset 0 0 0 9999px var(--row-hover-bg),
        inset -3px 0 0 0 var(--row-hover-accent);
}

/* Project group header row */
.group-header-row {
    cursor: pointer;
    user-select: none;
}

.group-header-row td {
    padding: 6px 10px;
    font-weight: 600;
    font-size: var(--font-size-base);
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    border-left: 3px solid var(--primary);
}

.group-header-row:hover td {
    background: var(--gray-100);
}

.group-toggle {
    display: inline-block;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    font-size: 10px;
    margin-right: 6px;
    transition: transform 0.2s ease;
    color: var(--gray-500);
}

.group-toggle.collapsed {
    transform: rotate(-90deg);
}

.group-project-name {
    color: var(--gray-800);
}

.group-project-code {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    font-weight: 400;
    margin-left: 8px;
}

.group-count {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
    font-weight: 400;
    margin-left: 4px;
}

.group-pm {
    float: right;
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    font-weight: 400;
}

/* Hidden rows when group collapsed */
.group-row-hidden {
    display: none;
}

/* ========================================================================
   INLINE EDITING
   ======================================================================== */
.cell-editable {
    cursor: pointer;
    padding: 2px 4px;
    transition: var(--transition);
    position: relative;
}

.cell-editable:hover {
    background: var(--primary-bg);
}

.cell-editable.editing {
    padding: 0;
}

.cell-editable .cell-display {
    display: block;
}

.cell-editable.editing .cell-display {
    display: none;
}

.cell-editable .cell-edit-input {
    display: none;
}

.cell-editable.editing .cell-edit-input {
    display: block;
}

.cell-edit-input input,
.cell-edit-input select {
    width: 100%;
    padding: 2px 6px;
    border: 2px solid var(--primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    background: white;
    outline: none;
}

.cell-saving {
    opacity: 0.6;
}

.cell-saving::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 4px;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: cell-spin 0.6s linear infinite;
}

@keyframes cell-spin {
    to { transform: rotate(360deg); }
}

/* Cells that open the edit modal on click */
.cell-modal-trigger {
    cursor: pointer;
}

/* Title cell — the row anchor. Keep the <td> a normal table cell (so it
   stretches to the row height and the hover band fills it); flex lives on an
   inner wrapper: title text + comment indicator. */
.cell-title-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cell-title-text {
    flex: 1;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--gray-900);
}

/* Inline title editing: the input fills the row, comment indicator stays put */
.cell-title .cell-edit-input {
    flex: 1;
}

/* Comment indicator — sits to the right of the title. Subtle until there are
   comments, then green with a count. Still opens the comments modal. */
.btn-comment-indicator {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--gray-300);
    cursor: pointer;
    transition: var(--transition);
}
.btn-comment-indicator svg { width: 14px; height: 14px; }
.btn-comment-indicator:hover { color: var(--primary); }
.btn-comment-indicator.has-comments { color: var(--success); }
.btn-comment-indicator.has-comments:hover { color: var(--success-dark); }
.btn-comment-indicator .comment-count {
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* Row options (kebab) button + its Edit/Copy/Delete menu */
.row-options {
    display: flex;
    justify-content: center;
}
.btn-options {
    width: 22px;
    height: 22px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-options svg { width: 16px; height: 16px; }
.btn-options:hover,
.btn-options.active {
    color: var(--primary);
    background: var(--gray-100);
}

.options-menu {
    position: fixed;
    z-index: 9500;
    background: white;
    border: 1px solid var(--gray-300);
    box-shadow: var(--shadow-overlay);
    min-width: 132px;
    padding: 3px;
    display: flex;
    flex-direction: column;
}
.options-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
}
.options-menu-item svg {
    width: 14px;
    height: 14px;
    color: var(--gray-500);
    flex-shrink: 0;
}
.options-menu-item:hover {
    background: var(--primary-bg);
    color: var(--primary-dark);
}
.options-menu-item:hover svg { color: var(--primary); }
.options-menu-item-delete:hover {
    background: var(--danger-light);
    color: var(--danger-dark);
}
.options-menu-item-delete:hover svg { color: var(--danger); }

/* Owner cell: monogram + short name inline */
.cell-owner .cell-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Assignees cell: a row of monograms */
.cell-assignees-wrapper .cell-display {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
}

/* Attention stripe — red left edge for high-priority / overdue rows.
   Every data row reserves the 3px gutter so the table edge stays straight;
   only rows needing action light it up. Group headers keep their own accent. */
#listViewBody tr:not(.group-header-row) > td:first-child {
    border-left: 3px solid transparent;
}
#listViewBody tr.attn > td:first-child {
    border-left-color: var(--danger);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

/* Project cell - two-line layout */
.cell-project-bt {
    font-size: var(--font-size-sm);
    color: var(--gray-700);
    line-height: 1.3;
}

.cell-project-wbs {
    font-size: 10px;
    color: var(--gray-400);
    line-height: 1.3;
    margin-top: 1px;
}

/* Details cell — read-only long text, wraps naturally (edit via modal) */
.cell-details {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    line-height: 1.35;
    cursor: pointer;
}
.cell-details:empty::before {
    content: '\2014';
    color: var(--gray-300);
}

/* ========================================================================
   INLINE EDIT - SAVE FEEDBACK FLASH
   ======================================================================== */

@keyframes cell-flash-success {
    0%   { background-color: var(--success-light); }
    100% { background-color: transparent; }
}

@keyframes cell-flash-error {
    0%   { background-color: var(--danger-light); }
    100% { background-color: transparent; }
}

.cell-flash-success {
    animation: cell-flash-success 0.8s ease-out forwards;
}

.cell-flash-error {
    animation: cell-flash-error 0.8s ease-out forwards;
}

/* ========================================================================
   INLINE EDIT - DATE INPUT
   ======================================================================== */

/* Native date inputs need min-width so they don't collapse */
.cell-edit-input input[type="date"] {
    min-width: 110px;
}

/* ========================================================================
   INLINE EDIT - ASSIGNEES CELL
   ======================================================================== */

/* The outer td gets a position context for the dropdown */
.cell-assignees-editable {
    position: relative;
}

/* Wrapper sits inside td; inherits .cell-editable base styles */
.cell-assignees-wrapper {
    min-width: 80px;
}

/* Placeholder dash when no assignees */
.cell-assignees-placeholder {
    color: var(--gray-300);
}

/* Overflow badge: "+2" style */
.cell-assignees-overflow {
    display: inline-block;
    padding: 0 4px;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 10px;
    font-weight: 600;
    vertical-align: middle;
}

/* The inline edit panel (chips + search + list) */
.cell-assignees-edit {
    position: relative;
    display: none;
    background: white;
    border: 2px solid var(--primary);
    padding: 4px;
    /* Overflow visible so the dropdown list can escape the td */
    overflow: visible;
    z-index: 200;
}

.cell-editable.editing .cell-assignees-edit {
    display: block;
}

/* Chips row */
.ia-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 3px;
}

.ia-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 5px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.ia-chip-remove {
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    color: var(--gray-500);
    margin-left: 1px;
}

.ia-chip-remove:hover {
    color: var(--danger);
}

/* Search input inside the panel */
.ia-search {
    width: 100%;
    padding: 2px 5px;
    border: 1px solid var(--gray-300);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    background: white;
    outline: none;
    box-sizing: border-box;
}

.ia-search:focus {
    border-color: var(--primary);
}

/* Dropdown list — floats below the edit panel */
.ia-list {
    position: absolute;
    top: 100%;
    left: -2px;   /* align with the 2px border */
    right: -2px;
    max-height: 180px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--gray-300);
    border-top: none;
    box-shadow: var(--shadow-overlay);
    z-index: 300;
}

.ia-item {
    padding: 4px 8px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--gray-100);
}

.ia-item:last-child {
    border-bottom: none;
}

.ia-item:hover {
    background: var(--gray-50);
}

.ia-item.ia-selected {
    background: var(--primary-bg);
    font-weight: 500;
}

.ia-check {
    width: 13px;
    height: 13px;
    border: 1px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    flex-shrink: 0;
    color: white;
}

.ia-item.ia-selected .ia-check {
    background: var(--primary);
    border-color: var(--primary);
}

.ia-no-results {
    padding: 8px;
    font-size: var(--font-size-sm);
    color: var(--gray-400);
    font-style: italic;
    text-align: center;
}

/* Print: show plain names, hide the edit panel */
@media print {
    .cell-assignees-edit {
        display: none !important;
    }
    .cell-editable.editing .cell-display {
        display: block !important;
    }
    /* Never carry the hover band into a PDF */
    .table-card tbody tr:hover > td {
        box-shadow: none !important;
    }
}

