/* App-specific layout */
.content {
    padding-top: 1.1rem;
}

/* EventExecutionStatusBadge + meet run rollup/category chips: compact below md */
.event-exec-status-badge,
.meet-rollup-count-badge {
    min-width: 0;
}

@media (max-width: 767.98px) {
    .event-exec-status-badge,
    .meet-rollup-count-badge {
        padding: 0.35em 0.5em;
    }

    .event-exec-status-badge .bi,
    .meet-rollup-count-badge .bi {
        font-size: 1.05em;
        line-height: 1;
    }
}

/* Tighter spacing between form section blocks (between mt-0 and Bootstrap mt-1). */
.mt-form-section {
    margin-top: 0.125rem;
}

/* Disable Blazor.Bootstrap modal fade/transition so content (borders, dividers, inputs)
   is visible immediately when the modal opens. Bootstrap's .fade and .modal-dialog
   transition cause a delay where the content appears only after the animation. */
.modal.fade {
    transition: none !important;
}
.modal.fade.show {
    opacity: 1 !important;
}
.modal.fade .modal-dialog {
    transition: none !important;
    transform: none !important;
}
.modal.fade.show .modal-dialog {
    transform: none !important;
}

/* Disable modal backdrop fade animation as well (so separators don't appear to "animate"). */
.modal-backdrop.fade {
    transition: none !important;
}
/* Modal header/body/footer dividers use theme border color. */
.modal .modal-header,
.modal .modal-body,
.modal .modal-footer {
    border-color: var(--bs-border-color);
}

/* Left-align all modal body content (confirm dialogs, forms, etc.). */
.modal .modal-body {
    text-align: left;
    min-width: 0;
}

/* Long confirmation copy must wrap inside the dialog (flex children default to min-width: auto). */
.modal .modal-content {
    min-width: 0;
}

/*
 * EntityActionButtons delete modal is often a descendant of:
 * - <td class="text-nowrap"> (inherits white-space: nowrap → body text won't wrap)
 * - <h2 class="accordion-header"> (inherits heading font-size → body + close icon look oversized)
 * Reset to body typography and normal wrapping; same Modal component as club/athlete removes.
 */
.entity-action-delete-modal {
    white-space: normal;
    font-size: var(--bs-body-font-size);
    font-weight: var(--bs-body-font-weight);
    line-height: var(--bs-body-line-height);
    color: var(--bs-body-color);
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
}

.entity-action-delete-modal .modal-dialog {
    max-width: min(32rem, calc(100vw - 2rem));
}

.entity-action-delete-modal .modal-header .modal-title {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.2;
}

.entity-delete-confirm-body {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

/* Even though Bootstrap doesn’t put outlines on h1, I see it when debugging without this. */
h1:focus {
    outline: none;
}

/* Match standalone admin headings to club/team entity pages (EntityPageShell h1). */
h1.page-title-entity-shell {
    font-size: 1.75rem;
    line-height: 1.2;
}

/* Activity hub empty hints: match Bootstrap .small + muted helper copy (avoids serif/size drift from tables). */
.activity-empty-state {
    font-family: var(--bs-body-font-family);
    font-size: 0.875em;
    font-weight: 400;
    line-height: var(--bs-body-line-height);
    color: var(--bs-secondary-color);
}

/*
 * Wide event/entry tables: horizontal scroll only. Vertical scroll comes from the page
 * (e.g. club-events-dashboard-scroll) so accordions do not each get their own scrollbar.
 */
.meet-events-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.meet-events-table-scroll .table,
.club-event-heats-scroll .table,
.club-meet-events-scroll .table,
.club-meet-run-event-scroll .table {
    margin-bottom: 0;
}

.meet-events-table-scroll th,
.meet-events-table-scroll td,
.club-event-heats-scroll th,
.club-event-heats-scroll td,
.club-meet-events-scroll th,
.club-meet-events-scroll td,
.club-meet-run-event-scroll th,
.club-meet-run-event-scroll td {
    white-space: nowrap;
}

.meet-events-table-scroll table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bs-body-bg);
    box-shadow: inset 0 -1px 0 var(--bs-border-color);
}

.finish-order-captures-scroll {
    max-height: 25rem;
    overflow-y: auto;
}

/* Club meet accordion: one horizontal scrollbar shared by all event groups. */
.meet-event-groups-scroll {
    min-width: 0;
    width: 100%;
    overflow-x: auto;
}

.meet-event-groups-scroll .accordion {
    min-width: 100%;
    width: max-content;
}

.meet-event-groups-scroll .accordion-item {
    min-width: 100%;
}

.meet-event-group-table {
    min-width: 100%;
    width: max-content;
}

.meet-event-groups-scroll table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bs-body-bg);
    box-shadow: inset 0 -1px 0 var(--bs-border-color);
}

.table-club-meet-spectator {
    width: 100%;
    min-width: 100%;
}

.table-club-meet-official {
    width: 100%;
    min-width: 100%;
}

/* Consistent column widths for multi-section heat tables (single scroll region). */
.table-heats-fixed {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}

.table-heats-fixed col.col-heat {
    width: 6%;
}

.table-heats-fixed col.col-lane {
    width: 7%;
}

.table-heats-fixed col.col-seed {
    width: 7%;
}

.table-heats-fixed col.col-athlete {
    width: 30%;
}

.table-heats-fixed col.col-team {
    width: 24%;
}

.table-heats-fixed col.col-category {
    width: 20%;
}

.table-heats-fixed col.col-BirthSex {
    width: 10%;
}

/* Category-scoped time results modal: cap height ~10 athlete rows. */
.category-time-results-modal-scroll {
    max-height: min(26rem, 70vh);
    overflow-y: auto;
    overflow-x: auto;
}

/* Enough for header "Result" and values like m:ss.ff; frees space for athlete/team. */
.table-heats-fixed col.col-heat-result,
.table-heats-card col.col-heat-result {
    width: 5.75rem;
}

/* Per-heat card heat sheets: same column model (no Heat column — link is in card header). */
.heat-sheets-stack {
    max-width: 960px;
}

.table-heats-card {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}

.table-heats-card col.col-lane {
    width: 8%;
}

.table-heats-card col.col-seed {
    width: 8%;
}

.table-heats-card col.col-athlete {
    width: 26%;
}

.table-heats-card col.col-team {
    width: 22%;
}

.table-heats-card col.col-category {
    width: 22%;
}

.table-heats-card col.col-BirthSex {
    width: 10%;
}

/* Meet-wide results: keep column widths consistent across all event/category expanders. */
.table-meet-results-fixed {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}

.table-heats-fixed col,
.table-heats-card col,
.table-meet-results-fixed col,
.table-entries-fixed col,
.table-club-events-fixed col {
    width: auto !important;
}

.table-meet-results-fixed col.col-place {
    width: 4.5rem;
}

.table-meet-results-fixed col.col-unit,
.table-meet-results-fixed col.col-lane,
.table-meet-results-fixed col.col-seed {
    width: 5rem;
}

.table-meet-results-fixed col.col-athlete-result {
    width: 21rem;
}

.table-meet-results-fixed col.col-team-result {
    width: 10rem;
}

.table-meet-results-fixed col.col-category-result {
    width: 11rem;
}

.table-meet-results-fixed col.col-birthsex-result {
    width: 7rem;
}

.table-meet-results-fixed col.col-result-value {
    width: 9rem;
}

.athlete-result-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.athlete-result-name {
    white-space: nowrap;
}

/* Club events listing: keep narrow metric columns so Actions can stay on one row. */
.table-club-events-fixed {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}

.table-club-events-fixed col.col-event {
    width: 12rem;
}

.table-club-events-fixed col.col-measure {
    width: 6rem;
}

.table-club-events-fixed col.col-cat {
    width: 10.5rem;
}

.table-club-events-fixed col.col-assignment {
    width: 8rem;
}

.table-club-events-fixed col.col-status {
    width: 6.5rem;
}

.table-club-events-fixed col.col-entries {
    width: 3.5rem;
}

.table-club-events-fixed col.col-heats {
    width: 3.5rem;
}

.table-club-events-fixed col.col-results {
    width: 7.5rem;
}

.table-club-events-fixed col.col-actions {
    width: auto;
}

/* Combined up/down reorder controls: consistent compact size everywhere. */
.btn-order-compact {
    --bs-btn-padding-x: 0.24rem;
    --bs-btn-padding-y: 0.17rem;
    min-width: 1.58rem;
}

/* Run Event page: stronger completed-row treatment while keeping actions available. */
.run-event-row-completed > td {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
}

.run-event-row-completed .badge {
    opacity: 0.8;
}

.run-event-row-completed a:not(.btn) {
    color: var(--bs-secondary-color);
    text-decoration-color: var(--bs-secondary-color);
}

.run-event-row-completed .btn {
    opacity: 0.8;
}

/* Entry / roster tables: avoid header/body column drift */
.table-entries-fixed {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}

.table-record-results-time-capture {
    table-layout: auto;
    width: max-content;
    min-width: 100%;
}

@media (max-width: 640.98px) {
    .btn-icon-label {
        min-width: 2.35rem;
        min-height: 2.1rem;
        justify-content: center;
    }

    .btn-icon-label .bi {
        margin-right: 0 !important;
    }

    .btn-icon-label .btn-icon-text {
        display: none;
    }
}

/* Uncomment to use WebKit/Chromium default focus ring. Don't forget to comment out in blzr-bootstrap-select(.min).css too. 
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}*/

/* Blazor.Bootstrap toasts: avoid visible text selection when the toast appears / receives focus. */
.toast,
.toast .toast-body {
    user-select: none;
}

/* Club event heats pages: one scroll region (heat cards / table), not nested with entity shell body. */
.entity-page-shell-body:has(.club-event-heats-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.club-event-heats-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.entity-page-shell-body:has(.club-meet-run-event-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.club-meet-run-event-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.club-meet-run-event-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0.25rem;
}

.entity-page-shell-body:has(.club-meet-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.club-meet-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.club-meet-events-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.club-event-heats-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}

.club-event-heats-scroll .heat-sheets-stack,
.club-event-heats-scroll .heat-print-card,
.club-event-heats-scroll .heat-print-block {
    max-width: none;
    min-width: 100%;
    width: max-content;
}

.club-event-heats-scroll table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bs-body-bg);
    box-shadow: inset 0 -1px 0 var(--bs-border-color);
}

/* Shared event page layout: top card fixed, only body section scrolls. */
.entity-page-shell-body:has(.event-page-layout) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.event-page-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.event-page-layout-header {
    flex: 0 0 auto;
}

.event-page-layout-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0.25rem;
}

/* Meet-wide results should use full available width before showing horizontal scroll. */
.meet-results-content .heat-sheets-stack {
    max-width: none;
    min-width: 100%;
    width: max-content;
}

.meet-results-content .card:has(.table) {
    min-width: 100%;
    width: max-content;
}

.meet-results-content .event-group-results-body {
    min-width: 100%;
    width: max-content;
}

.meet-results-content .event-group-results-body > .card:last-child {
    margin-bottom: 0 !important;
}

.meet-results-expander-header-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    background: transparent;
    text-align: left;
}

.meet-results-expander-header-btn-split {
    width: auto;
    flex: 1 1 auto;
}

.meet-results-expander-header-btn:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

/* Primary actions below entity tabs (Athletes, Teams, Events, Categories): same vertical rhythm as Athletes. */
.entity-tab-primary-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

/* Club Events / Categories / Athletes / Teams: one inner scroll; toolbars stay put. */
.entity-page-shell-body:has(.club-events-dashboard),
.entity-page-shell-body:has(.competition-categories-dashboard),
.entity-page-shell-body:has(.club-athletes-dashboard),
.entity-page-shell-body:has(.club-teams-dashboard) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.club-events-dashboard,
.competition-categories-dashboard,
.club-athletes-dashboard,
.club-teams-dashboard {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.club-events-dashboard-scroll,
.competition-categories-dashboard-scroll,
.club-athletes-dashboard-scroll,
.club-teams-dashboard-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}

/* Keep table column headers visible while scrolling long team/athlete lists. */
.club-teams-dashboard-scroll .table thead th,
.club-athletes-dashboard-scroll .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bs-body-bg);
    box-shadow: inset 0 -1px 0 var(--bs-border-color);
}

/* Form label help: Bootstrap Icons circle-question, ~75% of label size; primary on hover/focus. */
.field-help-icon {
    font-size: 0.75em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    text-decoration: none !important;
    box-shadow: none !important;
}

.field-help-icon .bi {
    display: block;
    line-height: 1;
}

.field-help-icon:hover,
.field-help-icon:focus-visible {
    color: var(--bs-primary) !important;
}

.athlete-lookup-dropdown {
    max-height: 28rem;
    overflow-y: auto;
    z-index: 1080;
}

.scanner-captured-results-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bs-body-bg);
    box-shadow: inset 0 -1px 0 var(--bs-border-color);
}

/* --- Print: global layout (all pages) + heat sheet refinements --- */
@media print {
    .sidebar,
    .top-row {
        display: none !important;
    }

    .page {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    main {
        display: block !important;
        overflow: visible !important;
        min-height: 0 !important;
    }

    article.content {
        overflow: visible !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    #blazor-error-ui {
        display: none !important;
    }

    body:has(.club-event-heats-page) .entity-page-shell-header {
        display: none !important;
    }

    body:has(.club-event-heats-page) .entity-page-shell-body {
        overflow: visible !important;
        display: block !important;
    }

    body:has(.club-event-heats-page) .club-event-heats-page {
        overflow: visible !important;
        display: block !important;
        min-height: 0 !important;
    }

    body:has(.club-event-heats-page) .club-event-heats-scroll {
        overflow: visible !important;
        flex: none !important;
    }

    .club-event-heats-scroll table thead th {
        position: static !important;
        box-shadow: none !important;
    }

    .heat-sheet-no-print {
        display: none !important;
    }

    .heat-sheet-result-placeholder {
        display: none !important;
    }

    .club-event-heats-page--laned .heat-print-card,
    .club-event-heats-page--laned .heat-print-block {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Heat sheets: use full paper width; narrow Result so names/categories stay on one line when they fit. */
    body:has(.club-event-heats-page) .heat-sheets-stack {
        max-width: none;
        width: 100%;
    }

    .club-event-heats-scroll .table-heats-card,
    .club-event-heats-scroll .table-heats-fixed {
        width: 100%;
        min-width: 0;
    }

    .club-event-heats-scroll .table-heats-card col.col-heat-result,
    .club-event-heats-scroll .table-heats-fixed col.col-heat-result {
        width: 4.5rem !important;
    }

    .club-event-heats-scroll .table-heats-card col.col-athlete,
    .club-event-heats-scroll .table-heats-fixed col.col-athlete {
        width: 32% !important;
    }

    .club-event-heats-scroll .table-heats-card col.col-team,
    .club-event-heats-scroll .table-heats-fixed col.col-team {
        width: 30% !important;
    }

    .club-event-heats-scroll .table-heats-card col.col-category,
    .club-event-heats-scroll .table-heats-fixed col.col-category {
        width: 18% !important;
    }

    .club-event-heats-scroll .table-heats-card col.col-BirthSex,
    .club-event-heats-scroll .table-heats-fixed col.col-BirthSex {
        width: 10% !important;
    }

    .club-event-heats-scroll .table-heats-card col.col-lane,
    .club-event-heats-scroll .table-heats-fixed col.col-lane {
        width: 6% !important;
    }

    .club-event-heats-scroll .table-heats-card col.col-seed,
    .club-event-heats-scroll .table-heats-fixed col.col-seed {
        width: 5% !important;
    }

    .club-event-heats-scroll .table-heats-card thead th,
    .club-event-heats-scroll .table-heats-fixed thead th,
    .club-event-heats-scroll .table-heats-card tbody td,
    .club-event-heats-scroll .table-heats-fixed tbody td {
        white-space: nowrap !important;
    }

    @page {
        margin: 0.5in;
    }
}
