/*
 * Admin sessions tables: the Sessions page
 * (/admin/conference/{tenant}/sessions) and Edit Conference > Sessions. Both
 * are configured by SessionSchemas::configureListTable(), which puts
 * asca-sessions-table on the table root: the Session cell (number gutter,
 * wrapping title, Featured / Virtual badges), the two-line Schedule cell, the
 * dotted Status pill and the footer text ("1–10 of 88 sessions"). Registered
 * in AppServiceProvider; the tracked copy in public/css/app/admin-sessions.css
 * is kept byte-identical with `cp` (`php artisan filament:assets` republishes
 * it on every Vapor build). The Conferences tables borrow the Schedule cell
 * with the asca-conference-schedule modifier.
 * In Schedule order each time block gets a heading row (Filament's group
 * header) with its time, its date and, at the right end, the Reorder button.
 *
 * Unlayered, so these rules win over Filament's layered component CSS. Every
 * rule is scoped to asca-sessions-table or an asca-session-* class, so no
 * other table changes.
 */

.asca-sessions-table {
    /* width of the number gutter in front of a title ("12.") */
    --asca-session-gutter: 1.625rem;
    /* rows sit closer together than Filament's default 1rem */
    --asca-session-cell-padding-block: 0.625rem;
}

/*
 * Column proportions: the title takes what is left after Schedule and Status,
 * which get room to breathe instead of shrinking to their text.
 */
.asca-sessions-table .fi-ta-header-cell-schedule {
    width: 19%;
}

.asca-sessions-table .fi-ta-header-cell-is-active {
    width: 14%;
}

/*
 * Only the column the table is sorted by shows its sort chevron; the other
 * sortable headings show theirs on hover or keyboard focus.
 */
.asca-sessions-table .fi-ta-header-cell:not(.fi-ta-header-cell-sorted) .fi-ta-header-cell-sort-btn .fi-icon {
    opacity: 0;
    transition: opacity 150ms;
}

.asca-sessions-table .fi-ta-header-cell:not(.fi-ta-header-cell-sorted) .fi-ta-header-cell-sort-btn:is(:hover, :focus-visible) .fi-icon {
    opacity: 1;
}

/*
 * Session cell. A ViewColumn gets no padding of its own, so this carries the
 * inline padding of Filament's text column; table cells do not wrap unless
 * told to, and a session title has to. The minimum width keeps the title
 * readable on a narrow screen, where the table scrolls sideways instead.
 */
.asca-session-cell {
    display: flex;
    align-items: baseline;
    width: 100%;
    min-width: 16rem;
    padding: var(--asca-session-cell-padding-block) calc(var(--spacing) * 3);
    white-space: normal;
    text-align: start;
}

/*
 * "12." sits in a fixed gutter, on the baseline of the title's first line. A
 * three-digit number is wider than the gutter and pushes its own title over
 * rather than running into it.
 */
.asca-session-number {
    flex: none;
    box-sizing: border-box;
    min-width: var(--asca-session-gutter);
    padding-inline-end: 0.25rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--gray-500);
}

.dark .asca-session-number {
    color: var(--gray-400);
}

.asca-session-body {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

/*
 * When any row of the table has a number, a title without one starts where
 * the numbered titles start. A table with no numbered name has no gutter.
 */
.asca-sessions-table:has(.asca-session-number) .asca-session-cell:not(.asca-session-cell--numbered) .asca-session-body {
    margin-inline-start: var(--asca-session-gutter);
}

.asca-session-title {
    display: block;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 500;
    overflow-wrap: anywhere;
    color: var(--gray-950);
}

.dark .asca-session-title {
    color: white;
}

/*
 * Featured tag: in front of the title, on its first line, at Filament's
 * default badge size with a larger label and a star before it. The title
 * follows inline and wraps under the tag. The negative block margin keeps the
 * tag from making a featured row taller than the others.
 */
.asca-session-featured {
    vertical-align: middle;
    margin-block: -0.125rem;
    margin-inline-end: 0.5rem;
    font-size: 0.8125rem;
}

.asca-session-featured + .asca-session-title {
    display: inline;
    vertical-align: middle;
}

/* Virtual, under the title. */
.asca-session-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

/* Schedule cell: the date over the time range, never wrapped. */
.asca-session-schedule {
    display: flex;
    flex-direction: column;
    padding: var(--asca-session-cell-padding-block) calc(var(--spacing) * 3);
    white-space: nowrap;
    text-align: start;
    font-variant-numeric: tabular-nums;
}

/*
 * The Conferences list and its Advertisement and Organization tabs reuse the
 * Schedule cell outside asca-sessions-table, where the padding variable is
 * otherwise undefined and the cell's padding would drop to 0.
 */
.asca-conference-schedule {
    --asca-session-cell-padding-block: 0.625rem;
}

.asca-session-schedule-date {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--gray-500);
}

.asca-session-schedule-time {
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--gray-950);
}

/* "Not scheduled" */
.asca-session-schedule--none {
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--gray-500);
}

.dark .asca-session-schedule-date,
.dark .asca-session-schedule--none {
    color: var(--gray-400);
}

.dark .asca-session-schedule-time {
    color: white;
}

/*
 * On the Conferences tables the dates lead: the date line takes the time
 * line's size and colour, and the hours drop to the smaller gray.
 */
.asca-conference-schedule .asca-session-schedule-date {
    font-size: 0.875rem;
    color: var(--gray-950);
}

.asca-conference-schedule .asca-session-schedule-time {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.dark .asca-conference-schedule .asca-session-schedule-date {
    color: white;
}

.dark .asca-conference-schedule .asca-session-schedule-time {
    color: var(--gray-400);
}

/*
 * Status pill: Filament's default badge geometry rather than the smaller
 * fi-size-sm a TextColumn badge gets, fully rounded, with a leading dot in the
 * text colour, as the sponsor Type pill has. Filament's ring stays.
 */
.asca-session-status-cell .fi-badge {
    padding: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
    column-gap: 0.375rem;
    letter-spacing: normal;
    border-radius: 9999px;
}

.asca-session-status-cell .fi-badge::before {
    content: '';
    flex: none;
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    background-color: currentColor;
}

/*
 * Footer: "1–10 of 88 sessions" instead of Filament's "Showing 1 to 10 of 88
 * results". The text is computed in PHP and arrives as a CSS string in
 * --asca-pagination-overview on the table root; Filament's own sentence is
 * shrunk to nothing and the new text drawn after it. Keyed on the inline
 * property being present, so a table without it keeps Filament's sentence.
 * `display` is left alone on purpose: Filament hides and shows this span per
 * breakpoint.
 */
.asca-sessions-table[style*='--asca-pagination-overview'] .fi-pagination-overview {
    font-size: 0;
}

.asca-sessions-table[style*='--asca-pagination-overview'] .fi-pagination-overview::after {
    content: var(--asca-pagination-overview);
    font-size: var(--text-sm);
    line-height: var(--text-sm--line-height);
}

/*
 * Time heading: in Schedule order Filament draws a group header row above the
 * sessions of each time block. It reads the block's time and then, smaller and
 * gray, its date and, when two or more sessions share the block, ends in the
 * Reorder button. The row is lower than a session row, with the text at the
 * left and the button at the right end, where the row menus end.
 */
.asca-sessions-table .fi-ta-group-header {
    padding-block: 0.375rem;
}

/*
 * Filament wraps the heading and its description (the button) in one div.
 * On a narrow screen the button drops under the text instead of squeezing it.
 */
.asca-sessions-table .fi-ta-group-header > div {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    column-gap: 0.75rem;
    row-gap: 0.125rem;
    min-width: 0;
    /* the height of the button, so a heading without one is as tall */
    min-height: 1.375rem;
}

/* The time leads: larger and in the colour of a session title. */
.asca-sessions-table .fi-ta-group-heading {
    font-size: 0.9375rem;
    line-height: 1.4;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--gray-950);
}

.dark .asca-sessions-table .fi-ta-group-heading {
    color: white;
}

/* The date follows it (TimeBlockHeading), smaller and gray. */
.asca-session-heading-date {
    margin-inline-start: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--gray-500);
}

.dark .asca-session-heading-date {
    color: var(--gray-400);
}

.asca-sessions-table .fi-ta-group-description {
    display: flex;
    flex: none;
    margin-inline-start: auto;
}

.asca-sessions-table .fi-ta-group-description .fi-link {
    white-space: nowrap;
    color: var(--gray-500);
}

.asca-sessions-table .fi-ta-group-description .fi-link:is(:hover, :focus-visible) {
    color: var(--gray-700);
}

.dark .asca-sessions-table .fi-ta-group-description .fi-link {
    color: var(--gray-400);
}

.dark .asca-sessions-table .fi-ta-group-description .fi-link:is(:hover, :focus-visible) {
    color: var(--gray-200);
}

/*
 * On a narrow screen the table scrolls sideways and the right end of a heading
 * is off screen. The heading is held to the width of the screen there and the
 * button follows the text, dropping under it when the two do not fit.
 */
@media (max-width: 42rem) {
    .asca-sessions-table .fi-ta-group-header > div {
        flex: none;
        justify-content: flex-start;
        max-width: calc(100vw - 6.5rem);
    }

    .asca-sessions-table .fi-ta-group-description {
        margin-inline-start: 0;
    }
}
