/* list.css -- shared chrome for full-height list pages (events, organizations).
 *
 * The page itself does not scroll: the header/toolbar stay put and only
 * .table-wrap scrolls, so the sticky <thead> is always visible. Load this
 * after components.css and keep page-specific bits in the page's own
 * {% block extra_css %}.
 */

/* Full-height layout: table scrolls, not the page */
body { height: 100vh; overflow: hidden; }
.site-footer { display: none; }
.page-content { display: flex; flex-direction: column; overflow: hidden; min-height: 0; padding: 0; }

.list-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
    gap: 1rem;
}

/* ── Header ─────────────────────────────── */
.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 2.4375rem;
}
.list-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}
.list-title h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}
/* Create button: the "+" is an SVG, not a text/icon-font glyph — a glyph sits on
   the label's baseline and is pushed down by the font's own ascent/descent, which
   no amount of nudging fixes reliably. An SVG box centres exactly. */
.btn-create {
    gap: 0.4375rem;
    padding: 0.5rem 0.9375rem 0.5rem 0.8125rem;
    box-shadow: var(--shadow-sm);
}
.btn-create:hover { box-shadow: var(--shadow-md); }
.btn-create-plus {
    display: block;
    width: 0.9375rem;
    height: 0.9375rem;
    flex-shrink: 0;
}

.count-pill {
    padding: 0.125rem 0.5rem;
    border-radius: 100px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── Toolbar: search + segmented filter ─── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 420px;
    display: flex;
    align-items: center;
}
.search-box .bi-search {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: block;
    font-size: 0.875rem;
    line-height: 1;
    color: var(--text-muted);
    pointer-events: none;
}
.search-box .bi-search::before { vertical-align: 0; display: block; }
.search-clear i { display: block; line-height: 1; }
.search-clear i::before { vertical-align: 0; display: block; }
.search-box input {
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 2.125rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.search-box input:focus {
    outline: none;
    background: var(--bg-primary);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear {
    position: absolute;
    right: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.search-clear:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.seg {
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}
.seg a {
    padding: 0.3125rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.seg a:hover { color: var(--text-primary); }
.seg a.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.active-search {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.active-search a { color: var(--accent-color); text-decoration: none; font-weight: 600; }
.active-search a:hover { text-decoration: underline; }

/* ── Table ──────────────────────────────── */
.table-wrap {
    flex: 1;
    overflow: auto;
    min-height: 0;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}
.list-table thead th {
    padding: 0.625rem 0.875rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-bottom: none;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.list-table th:first-child, .list-table td:first-child { padding-left: 1.125rem; }
.list-table th:last-child, .list-table td:last-child { padding-right: 1.125rem; text-align: right; }

.list-table tbody tr { transition: background 0.1s; }
.list-table tbody tr:hover { background: var(--bg-tertiary); }
.list-table tbody tr:hover td { background: transparent; }
.list-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--bg-tertiary); }
.list-table td {
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
    vertical-align: middle;
    border-bottom: none;
}

/* Cell primitives */
.cell-title {
    display: block;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-title:hover { color: var(--accent-color); text-decoration: underline; }
.cell-sub {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-strong {
    color: var(--text-primary);
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}
.cell-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}
.cell-date {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.cell-empty { color: var(--text-muted); }
.cell-more {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
}
.cell-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-width: 100%;
    font-size: 0.8125rem;
    color: var(--accent-color);
    text-decoration: none;
}
.cell-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-link:hover { text-decoration: underline; }
.cell-link i { font-size: 0.75rem; flex-shrink: 0; opacity: 0.7; }
.status-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }

/* Row actions */
.row-actions {
    display: flex;
    gap: 0.375rem;
    justify-content: flex-end;
}
.row-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Base .ic geometry lives in components.css (shared with the form icons) */
.cell-link .ic { width: 13px; height: 13px; stroke-width: 1.5; opacity: 0.75; }

/* ── Empty state: a quiet row inside the table ── */
.list-table tbody tr.empty-row:hover { background: transparent; }
.list-table tbody tr.empty-row > td {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}
.empty-row .empty-msg { color: var(--text-secondary); }
.empty-row .empty-action {
    margin-left: 0.375rem;
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
}
.empty-row .empty-action:hover { text-decoration: underline; }

/* ── Responsive: rows become cards ──────── */
@media (max-width: 900px) {
    .list-table { table-layout: auto; }
    .list-table col { width: auto !important; }
    .list-table thead { display: none; }
    .list-table, .list-table tbody, .list-table tr, .list-table td { display: block; width: 100%; }
    .list-table tbody tr { padding: 0.875rem 1rem; }
    .list-table tbody tr:not(:last-child) { border-bottom: 1px solid var(--border-color); }
    .list-table tbody tr:not(:last-child) td { border-bottom: none; }
    .list-table td,
    .list-table th:first-child, .list-table td:first-child,
    .list-table th:last-child, .list-table td:last-child {
        padding: 0.1875rem 0;
        text-align: left;
    }
    .list-table td[data-label]:not(:first-child)::before {
        content: attr(data-label) " · ";
        font-size: 0.6875rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
    }
    .list-table td[data-label]:not(:first-child) {
        display: flex;
        align-items: baseline;
        gap: 0.375rem;
    }
    .list-table td.cell-hide-sm { display: none; }
    .row-actions { justify-content: flex-start; padding-top: 0.5rem; }
    .status-stack { flex-direction: row; }
    .list-layout { padding: 1rem; gap: 0.875rem; }
    .search-box { max-width: none; }
}
