/* =============================================
   TABLE.CSS — Restyled to match the new design system.
   Uses the same class names as the existing table
   markup so no HTML changes are needed.
   All values reference variables from root.css.
   ============================================= */


/* ---- Wrapper -------------------------------- */

.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.modal-table-container {
    padding: 0 1rem;
}


/* ---- Table base ----------------------------- */

.table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    font-size: var(--font-size-base);
    background: white;
}


/* ---- Header --------------------------------- */

.table__thead {
    background-color: var(--brand-blue);
    color: white;
}

.table__th {
    padding: 12px 16px;
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.table__th:hover {
    background-color: var(--blue-700);
}

.table__th.center {
    text-align: center;
}


/* ---- Body rows ------------------------------ */

.table__tbody {
    /* block layout handled in responsive section */
}

.table-row {
    border-bottom: 1px solid var(--zinc-200);
    transition: background-color 0.15s ease;
}

.table-row:nth-child(odd)  { background-color: var(--zinc-50); }
.table-row:nth-child(even) { background-color: var(--zinc-100); }

.table-row:hover {
    background-color: var(--blue-100);
}

.table-row:last-child {
    border-bottom: none;
}


/* ---- Cells ---------------------------------- */

.table-row__td {
    padding: 12px 16px;
    vertical-align: middle;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 1.5;
    border: none;
    position: relative;
}

.table-row__td.center {
    text-align: center;
}

.table-row__td.center button {
    margin: 0 auto;
}


/* ---- Cell utilities ------------------------- */

.table-row__small {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-weight: 400;
    display: block;
    margin-top: 2px;
}

.table-row__img {
    width: 36px;
    height: 36px;
    display: inline-block;
    border-radius: 50%;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    vertical-align: middle;
}

.table-row__cta {
    display: flex;
    gap: var(--gap-sm);
}

.table-row__cta button {
    flex: 1;
}

.truncate {
    max-width: 135px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}


/* ---- Status indicators ---------------------- */

.status--green  { color: var(--btn-success-bg); }
.status--red    { color: var(--btn-danger-bg); }
.status--blue   { color: var(--brand-blue); }
.status--yellow { color: var(--amber-500); }
.status--grey   { color: var(--text-muted); }

.status--green::before,
.status--red::before,
.status--blue::before,
.status--yellow::before,
.status--grey::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.status--green::before  { background-color: var(--btn-success-bg); }
.status--red::before    { background-color: var(--btn-danger-bg); }
.status--blue::before   { background-color: var(--brand-blue); }
.status--yellow::before { background-color: var(--amber-500); }
.status--grey::before   { background-color: var(--text-muted); }


/* ---- Row select checkbox -------------------- */

.table--select-all,
.table__select-row {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    margin: 0 0 0 5px;
    vertical-align: middle;
    border: 2px solid var(--zinc-400);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.table__select-row:hover {
    border-color: var(--brand-blue);
}

.table__select-row:checked {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3 4L11 1' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: center;
    background-size: 10px;
    background-repeat: no-repeat;
}


/* =============================================
   RESPONSIVE — collapses to cards below 768px
   ============================================= */

@media screen and (max-width: 768px) {

    .table-container {
        box-shadow: none;
    }

    .table__thead {
        display: none;
    }

    .table__tbody {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: var(--gap-2xl);
        padding: var(--gap-2xl) 0;
    }

    .table-row {
        display: block;
        border: 2px solid var(--zinc-200);
        border-radius: 10px;
        background-color: white !important;
        box-shadow: var(--shadow-sm);
        padding: var(--gap-lg) var(--gap-2xl);
        transition: box-shadow 0.2s ease, border-color 0.2s ease;
    }

    .table-row:hover {
        border-color: var(--brand-blue);
        box-shadow: var(--shadow-md);
        background-color: white !important;
    }

    .table-row__img {
        width: 42px;
        height: 42px;
        margin-bottom: var(--gap-lg);
    }

    .table-row__td {
        display: flex;
        align-items: flex-start;
        padding: 6px 0;
        border: none;
        gap: var(--gap-xl);
    }

    .table-row__td::before {
        content: attr(data-column);
        color: var(--text-muted);
        font-size: var(--font-size-xs);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        min-width: 100px;
        flex-shrink: 0;
        padding-top: 2px;
    }

    .table__select-row {
        display: none;
    }

    .table-row__cta {
        padding-top: var(--gap-md);
    }

}