/*
 * trash-list.css — the reusable Trash control (controls/trash/*.js).
 *
 * Self-contained by necessity: the Chaos trash chrome lives in chaos.css /
 * chaos-shell.css / chaos-views.css, which only the Chaos and Forge apps load,
 * so nothing here may borrow it.
 */

.lp-trash {
    --lp-trash-col-type: 90px;
    --lp-trash-col-location: 140px;
    --lp-trash-col-deleted-on: 160px;
    --lp-trash-col-deleted-by: 120px;
    --lp-trash-col-actions: 200px;
    --lp-trash-embedded-max-height: 52vh;

    display: flex;
    flex-direction: column;
    min-width: 0;
}

.lp-trash--page {
    height: 100%;
    padding: 20px;
    overflow: hidden;
}

.lp-trash-title-block { margin-bottom: 16px; flex-shrink: 0; }
.lp-trash-title { margin: 0; font-size: 18px; color: var(--text-primary); }
.lp-trash-description { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.lp-trash--embedded .lp-trash-description { margin-top: 0; }

.lp-trash-toolbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 6px;
    width: 100%;
    max-width: 420px;
    margin-bottom: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
    transition: border-color 0.15s;
}
.lp-trash-toolbar:focus-within { border-color: var(--accent); }

.lp-trash-search {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text-muted);
}
.lp-trash-search svg { flex-shrink: 0; }

.lp-trash-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    outline: none;
    font: inherit;
    font-size: 12px;
    color: var(--text-primary);
}
.lp-trash-search-input::placeholder { color: var(--text-muted); }

.lp-trash-search-clear {
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0 2px;
    font: inherit;
    font-size: 14px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}
.lp-trash-search-clear:hover { color: var(--text-primary); }

.lp-trash-toolbar-separator {
    width: 1px;
    height: 16px;
    background: var(--border);
    flex-shrink: 0;
}

.lp-trash-filter-wrap { position: relative; flex-shrink: 0; }

.lp-trash-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.lp-trash-filter-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.lp-trash-filter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Badge and clear-all occupy the same spot; hover swaps them without reflow. */
.lp-trash-filter-badge,
.lp-trash-filter-clear {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 14px;
    height: 14px;
    font-size: 9px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    color: #fff;
    background: var(--accent);
    border-radius: 7px;
    transition: opacity 0.15s;
}
.lp-trash-filter-badge { padding: 0 3px; pointer-events: none; opacity: 1; }
.lp-trash-filter-clear {
    padding: 0;
    border: none;
    font: inherit;
    font-size: 12px;
    line-height: 14px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
}
.lp-trash-filter-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.lp-trash-filter-popover {
    min-width: 220px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
    background: var(--bg-panel, var(--bg-surface));
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
    z-index: 10001;
}

.lp-trash-facet + .lp-trash-facet {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

.lp-trash-facet-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 5px;
    background: none;
    font: inherit;
    font-size: 13px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}
.lp-trash-facet-header:hover { background: var(--bg-hover); }

.lp-trash-facet-preview {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
}

.lp-trash-facet-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}
.lp-trash-facet-option:hover { background: var(--bg-hover); }
.lp-trash-facet-option input[type="checkbox"] { cursor: pointer; margin: 0; }

.lp-trash-facet-option .ch-avatar,
.lp-trash-facet-preview .ch-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    flex-shrink: 0;
    vertical-align: middle;
}

.lp-trash-body-wrap {
    min-width: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.lp-trash-body-wrap::-webkit-scrollbar { width: 4px; }
.lp-trash-body-wrap::-webkit-scrollbar-track { background: transparent; }
.lp-trash-body-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.lp-trash-body-wrap::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* The page variant fills its surface; an embedded host is bounded so the list
   scrolls inside the card instead of growing the host panel. */
.lp-trash--page .lp-trash-body-wrap { flex: 1; min-height: 0; }
.lp-trash--embedded .lp-trash-body-wrap { max-height: var(--lp-trash-embedded-max-height); }

.lp-trash-header,
.lp-trash-row {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.lp-trash-header {
    padding: 6px 10px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.lp-trash--page .lp-trash-header { background: var(--bg-primary); }
.lp-trash--embedded .lp-trash-header { background: var(--bg-surface); }

.lp-trash-body { display: flex; flex-direction: column; }

.lp-trash-row { padding: 8px 10px; }
.lp-trash-row:hover { background: var(--bg-hover); }

.lp-trash-th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.lp-trash-td { font-size: 12px; color: var(--text-muted); }

.lp-trash-col-name {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.lp-trash-col-name-icon { flex-shrink: 0; color: var(--text-muted); }
.lp-trash-col-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.lp-trash-col-location,
.lp-trash-col-deleted-by {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lp-trash-col-type { width: var(--lp-trash-col-type); flex-shrink: 0; }
.lp-trash-col-location { width: var(--lp-trash-col-location); flex-shrink: 0; }
.lp-trash-col-deleted-on { width: var(--lp-trash-col-deleted-on); flex-shrink: 0; }
.lp-trash-col-deleted-by { width: var(--lp-trash-col-deleted-by); flex-shrink: 0; }

/* Fixed width though the header cell is empty — keeps the name column's
   flex:1 leftover identical between the header and every row. */
.lp-trash-col-actions {
    width: var(--lp-trash-col-actions);
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.lp-trash-action {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-surface);
    font: inherit;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.lp-trash-action:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--text-muted); }
.lp-trash-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lp-trash-action:disabled { opacity: 0.5; cursor: not-allowed; }

.lp-trash-action--danger {
    color: var(--error, #ef4444);
    border-color: color-mix(in srgb, var(--error, #ef4444) 30%, transparent);
}

.lp-trash-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border: 1px dashed var(--border);
    border-radius: 6px;
}
.lp-trash--embedded .lp-trash-empty { padding: 18px; }

.lp-trash-retention {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    flex-shrink: 0;
}

.lp-trash-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
}

.lp-trash-dialog {
    width: 420px;
    max-width: 92vw;
    padding: 24px;
    background: var(--bg-panel, var(--bg-surface));
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.lp-trash-dialog h2 { margin: 0 0 12px; font-size: 16px; color: var(--text-primary); }

.lp-trash-dialog-warning {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 8px 0;
    padding: 12px;
    background: color-mix(in srgb, var(--error, #e74c3c) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--error, #e74c3c) 20%, transparent);
    border-radius: 6px;
}
.lp-trash-dialog-warning svg { flex-shrink: 0; margin-top: 2px; }
.lp-trash-dialog-warning p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

.lp-trash-dialog label {
    display: block;
    margin: 14px 0 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.lp-trash-dialog input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font: inherit;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.lp-trash-dialog input[type="text"]:focus { outline: none; border-color: var(--accent); }

.lp-trash-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.lp-trash-dialog-cancel,
.lp-trash-dialog-confirm {
    padding: 8px 16px;
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s;
}

.lp-trash-dialog-cancel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.lp-trash-dialog-cancel:hover { background: var(--bg-hover); }

.lp-trash-dialog-confirm {
    background: var(--error, #e74c3c);
    border: none;
    color: #fff;
    font-weight: 600;
}
.lp-trash-dialog-confirm:hover:not(:disabled) { opacity: 0.85; }
.lp-trash-dialog-confirm:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 900px) {
    .lp-trash { --lp-trash-col-actions: 170px; }
    .lp-trash-col-location { display: none; }
}

@media (max-width: 720px) {
    .lp-trash-col-deleted-by { display: none; }
    .lp-trash--page { padding: 12px; }
}

@media (max-width: 560px) {
    .lp-trash { --lp-trash-col-actions: auto; }
    .lp-trash-col-deleted-on,
    .lp-trash-col-type { display: none; }
    .lp-trash-header { display: none; }
    .lp-trash-row { flex-wrap: wrap; }
    .lp-trash-col-actions { width: auto; flex: 1 1 100%; justify-content: flex-start; }
}
