/*
 * The customers list's first cell (resources/views/filament/customers/customer-cell.blade.php).
 * The panel has no Tailwind build, so every rule is written out here and scoped under .cust-cell.
 * Light and dark come from Filament's own --gray-* scale.
 */

.cust-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    max-width: 24rem;
    /* Filament's own text cell padding (16px 12px), so a row is as tall as in any other table. */
    padding-block: 16px;
    padding-inline-start: 12px;
    /* Keeps a long email, cut short with an ellipsis, clear of the Residence column. */
    padding-inline-end: 16px;
}

.cust-cell__avatar {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    overflow: hidden;
    background-color: var(--gray-100);
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
}

.cust-cell__avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The faint ring sits above the photo, so it shows on both a picture and the initials. */
.cust-cell__avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
    pointer-events: none;
}

.cust-cell__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cust-cell__email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: var(--gray-950);
}

.cust-cell__meta {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
    font-size: 12px;
    line-height: 16px;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}

.cust-cell__id,
.cust-cell__linked {
    white-space: nowrap;
}

.cust-cell__linked::before {
    content: '\00b7';
    margin-right: 6px;
}

/* The status badge keeps Filament's own badge size, the same as the Residence, Band and KYC badges. */
.cust-cell .cust-cell__status {
    flex: none;
}

.fi-ta-cell:has(.cust-cell) {
    vertical-align: middle;
}

/* The Money totals: Filament's summarizer has no font family API, so match the mono, right-aligned cells here. */
.cust-money-summary {
    justify-items: end;
    text-align: end;
}

.cust-money-summary > :not(.fi-ta-text-summary-label) {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
}

.dark .cust-cell__avatar {
    background-color: var(--gray-800);
    color: var(--gray-300);
}

.dark .cust-cell__avatar::after {
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
}

.dark .cust-cell__email {
    color: var(--gray-50);
}

.dark .cust-cell__meta {
    color: var(--gray-400);
}

/* The only motion: a background tint on rows of this table, for a real pointer only.
   One step darker than Filament's stripe (gray-50, white 5%), so hover still shows on striped rows. */
@media (hover: hover) and (pointer: fine) {
    .fi-ta-row:has(.cust-cell) {
        transition: background-color 150ms ease;
    }

    .fi-ta-row:has(.cust-cell):hover {
        background-color: var(--gray-100);
    }

    .dark .fi-ta-row:has(.cust-cell):hover {
        background-color: rgb(255 255 255 / 0.08);
    }
}

/*
 * Headers: 12px semibold, still readable, on one line so the header row stays one line tall.
 * Scoped to this table through its cust-table class.
 */
.cust-table .fi-ta-header-cell,
.cust-table .fi-ta-header-group-cell {
    font-size: 12px;
    line-height: 16px;
}

.cust-table .fi-ta-header-cell {
    padding-block: 10px;
}

/* Tags: badges wrap inside a narrow cell, and a long tag name ends in an ellipsis instead of widening the column. */
.cust-tags {
    width: max-content;
    max-width: 11rem;
}

.cust-tags .fi-badge {
    max-width: 100%;
}

.cust-tags .fi-badge > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footer totals: the column header names each total (its label is screen-reader only), so the rows can be half as tall. */
.cust-table .fi-ta-text-summary,
.cust-table .fi-ta-summary-row-heading-cell,
.cust-table .fi-ta-summary-header-cell {
    padding-block: 8px;
}
