/* Lists of things — every screen that shows one row per document, person or dictionary entry.
   Loaded on every page from _Layout, with wwwroot/js/list.js doing the filtering. A list is:
   .list-stats (optional) → .list-toolbar (search, chips, dropdowns) → .list-card > .list-table.
   A hundred rows is a normal size for one placówka, so every list gets a search and chips. */

/* ─── Summary strip ─────────────────────────────────────────────────────────── */

.list-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: #F7FAFB;
    border: 1px solid #DCE7EA;
    border-radius: 10px;
    font-size: 13.5px;
    color: #4A6B75;
}

.list-stats__warn {
    color: #8A6100;
}

/* ─── Toolbar ───────────────────────────────────────────────────────────────── */

.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

/* One height for the whole bar. The global .form-control/.form-select rule forces 12px padding
   and 16px type with !important, which would make the search twice the height of the chips. */
.list-toolbar .list-search,
.list-toolbar .list-select {
    height: 32px;
    padding: 0 12px !important;
    font-size: 13.5px !important;
    line-height: 1.3;
}

.list-toolbar .list-search {
    flex: 0 1 280px;
    min-width: 180px;
}

.list-toolbar .list-select {
    flex: 0 1 220px;
    width: auto;
    min-width: 160px;
    padding-right: 32px !important;
    background-position: right 10px center;
}

.list-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: 1px solid #D3DEE2;
    border-radius: 999px;
    background: #fff;
    color: #4A6B75;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.list-chip:hover {
    border-color: #9CBCC6;
}

.list-chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 95, 111, 0.15);
}

.list-chip.is-active {
    background: #2D5F6F;
    border-color: #2D5F6F;
    color: #fff;
}

.list-chip__count {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.7;
}

/* A switch, not a choice among the chips: it adds rows rather than picking a subset, so it is
   dashed while off and only tinted while on. */
.list-chip--toggle {
    border-style: dashed;
}

.list-chip--toggle.is-active {
    border-style: solid;
    border-color: #9CBCC6;
    background: #EAF1F3;
    color: #35606D;
}

.list-toolbar__divider {
    width: 1px;
    height: 20px;
    margin: 0 4px;
    background: #DCE4E6;
}

/* ─── Table ─────────────────────────────────────────────────────────────────── */

/* No overflow: hidden — it would clip the ⋯ menu of the last rows. The head rounds itself. */
.list-card {
    background: #fff;
    border: 1px solid #E3EAEC;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(38, 51, 58, 0.04);
}

.list-table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.list-table th {
    padding: 11px 16px;
    border-bottom: 1px solid #EDF2F3;
    background: #FBFCFD;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    color: #8A9599;
}

.list-card .list-table th:first-child {
    border-top-left-radius: 11px;
}

.list-card .list-table th:last-child {
    border-top-right-radius: 11px;
}

.list-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #F1F5F6;
    font-size: 14px;
    color: #33434A;
    vertical-align: middle;
}

.list-table tbody tr:last-child td {
    border-bottom: 0;
}

/* The row is the thing it lists: list.js opens the row's link from anywhere on the row. */
.list-table__row:has(.list-table__link) {
    cursor: pointer;
}

.list-table__row:hover td {
    background: #F7FAFB;
}

/* break-word, not anywhere: "anywhere" lets the table squeeze the name column to one letter
   ("Kowalsk / i") whenever another column is long. */
.list-table__link {
    font-weight: 600;
    color: #26333A;
    text-decoration: none;
    overflow-wrap: break-word;
}

.list-table__link:hover,
.list-table__row:hover .list-table__link {
    color: #2D5F6F;
    text-decoration: none;
}

.list-table__link:focus-visible {
    outline: none;
    border-radius: 4px;
    box-shadow: 0 0 0 3px rgba(45, 95, 111, 0.2);
}

.list-table__name {
    font-weight: 600;
    color: #26333A;
}

.list-table__sub {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    font-weight: 400;
    color: #8A9599;
}

.list-table__muted {
    color: #8A9599;
}

.list-table__nowrap {
    white-space: nowrap;
}

/* Long free text (a skill, a dictionary description) stops at two lines; the title has the rest. */
.list-table__clamp {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-table__actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.list-table__actions > * + * {
    margin-left: 6px;
}

.list-no-match {
    padding: 18px;
    text-align: center;
    font-size: 14px;
    color: #8A9599;
}

/* A fact about the row, not a status: "usunięto z listy". */
.list-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #F1F3F4;
    color: #7C8A90;
    font-size: 11.5px;
    font-weight: 600;
    vertical-align: 1px;
}

/* ─── Row menu (⋯) ─────────────────────────────────────────────────────────── */

/* No z-index on the wrapper: it would become a stacking context and the next row's ⋯ would
   paint over the open menu. */
.list-menu {
    display: inline-block;
    position: relative;
}

.list-menu__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #E3EAEC;
    border-radius: 7px;
    background: #fff;
    color: #8A9599;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.list-menu__btn:hover,
.list-menu__btn[aria-expanded="true"] {
    background: #F2F6F7;
    border-color: #9CBCC6;
    color: #2D5F6F;
}

.list-menu__btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 95, 111, 0.15);
}

.list-menu .dropdown-menu {
    border: 1px solid #E3EAEC;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(38, 51, 58, 0.12);
    font-size: 13.5px;
}

.list-menu .dropdown-item {
    padding: 8px 16px;
    color: #33434A;
}

.list-menu .dropdown-item--danger {
    color: #B4483A;
}

.list-menu .dropdown-item--danger:hover,
.list-menu .dropdown-item--danger:focus {
    background-color: #FBF3F2;
    color: #A03C2F;
}

/* ─── Status pill ──────────────────────────────────────────────────────────────
   Keys come from Helpers/DocumentListStatus.cs; overdue/pending/compliant are the Dashboard's. */

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.status-pill--draft { background: #F1F3F4; color: #5F6B70; }
.status-pill--progress,
.status-pill--pending { background: #FBF2DF; color: #8A5A00; }
.status-pill--active,
.status-pill--compliant { background: #E9F6EF; color: #2E7D54; }
.status-pill--overdue { background: #FCEDEB; color: #B23A2E; }
.status-pill--archived,
.status-pill--none { background: #fff; color: #97A3A8; box-shadow: inset 0 0 0 1px #E3EAEC; }

/* ─── Empty state ──────────────────────────────────────────────────────────────
   An alert is a colour reserved for something that needs attention; an empty list needs none. */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 34px 20px;
    background: #FBFCFC;
    border: 1px dashed #DCE4E6;
    border-radius: 12px;
    color: #7C8A90;
}

.empty-state svg {
    width: 30px;
    height: 30px;
    margin-bottom: 4px;
    color: #B4C3C7;
}

.empty-state__title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    color: #55656B;
}

.empty-state__hint {
    margin: 0;
    font-size: 13px;
    max-width: 460px;
    line-height: 1.55;
}

.empty-state__hint a {
    color: #2D5F6F;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 1199px) {
    .list-table th,
    .list-table td {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* A phone gets one card per row: the header goes, and each cell prints its column name from
   data-label. The first cell is the row's name and carries no label. */
@media (max-width: 767px) {
    .list-stats {
        flex-direction: column;
        gap: 6px;
    }

    .list-toolbar .list-search,
    .list-toolbar .list-select {
        flex: 1 1 100%;
    }

    .list-toolbar__divider {
        display: none;
    }

    .list-table thead {
        display: none;
    }

    .list-table,
    .list-table tbody,
    .list-table tr,
    .list-table td {
        display: block;
        width: 100%;
    }

    .list-table tr {
        padding: 12px 14px;
        border-bottom: 1px solid #F1F5F6;
    }

    .list-table tbody tr:last-child {
        border-bottom: 0;
    }

    .list-table td {
        display: flex;
        align-items: baseline;
        gap: 10px;
        padding: 3px 0;
        border-bottom: 0;
        font-size: 13.5px;
    }

    .list-table td[data-label]::before {
        content: attr(data-label);
        flex: 0 0 112px;
        font-size: 12.5px;
        color: #8A9599;
    }

    .list-table td:first-child {
        display: block;
        padding-bottom: 6px;
        font-size: 15px;
    }

    .list-table__row:hover td {
        background: transparent;
    }

    .list-table__actions {
        width: 100%;
        justify-content: flex-start;
        padding-top: 8px !important;
        text-align: left;
    }
}
