/* =====================================================
   PORTAL THEME (opt-in)
   A page opts in by wrapping its content in <div class="gs-theme"> and adding
   <partial name="_ThemeStyles" /> to its Styles section. Every rule here is scoped
   under .gs-theme, so pages that haven't moved over are untouched.

   Same palette as Admin Reports (admin.reports.css): slate neutrals, white cards,
   and the Portal theme blue #1A80C8 for accents.
   ===================================================== */

.gs-theme {
    --gs-bg: #f1f5f9;
    --gs-card: #ffffff;
    --gs-border: #e2e8f0;
    --gs-row-border: #f1f5f9;
    --gs-head-bg: #f8fafc;
    --gs-control-border: #cbd5e1;
    --gs-text: #0f172a;
    --gs-muted: #475569;
    --gs-faint: #94a3b8;
    --gs-blue: #1A80C8;
    --gs-blue-tint: rgba(26, 128, 200, 0.08);
    --gs-blue-ring: rgba(26, 128, 200, 0.15);
    --gs-good: #087f5b;
    --gs-good-bg: #e6f6ef;
    --gs-radius: 10px;
    --gs-radius-sm: 8px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    color: var(--gs-text);
}

/* Page background behind the cards, only on themed pages */
body:has(.gs-theme) {
    background-color: #f1f5f9;
}


/* =====================================================
   PAGE HEADER + TOOLBAR
   ===================================================== */

.gs-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-bottom: 10px;
}

    /* Title and its meta line (item count, filter, key) side by side on one baseline, so the
       header is one row with the toolbar */
    .gs-page-header > div:has(> .gs-page-title) {
        display: flex;
        align-items: baseline;
        flex-wrap: wrap;
        gap: 2px 12px;
        min-width: 0;
    }

.gs-page-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--gs-text);
    margin: 0;
}

.gs-page-meta {
    font-size: 13px;
    color: var(--gs-muted);
}

/* Breadcrumb before the title ("Course Servers › Courses"): title-sized so the two read as one
   line on one baseline, with the parent page in theme blue */
.gs-crumbs {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

    .gs-crumbs a {
        color: var(--gs-blue);
    }

    .gs-crumb-sep {
        color: var(--gs-faint);
        margin-left: 10px;
        margin-right: -4px;
    }

.gs-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.gs-theme .gs-search {
    width: 280px;
    max-width: 100%;
}


/* =====================================================
   BUTTONS
   36px tall, 8px radius. Outline buttons are white with a slate border; the primary
   action keeps site.css .btn-primary colors (theme blue).
   ===================================================== */

.gs-theme .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--gs-radius-sm);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

    .gs-theme .btn.btn-sm {
        height: 32px;
        padding: 0 12px;
        font-size: 13px;
    }

    .gs-theme .btn i {
        padding: 0 !important;
    }

.gs-theme .btn-primary {
    font-weight: 600;
}

.gs-theme .btn-outline-gspro {
    background-color: var(--gs-card);
    border: 1px solid var(--gs-control-border);
    color: var(--gs-text);
}

    .gs-theme .btn-outline-gspro:hover {
        background-color: var(--gs-head-bg);
        border-color: var(--gs-blue);
        color: var(--gs-text);
    }

    .gs-theme .btn-outline-gspro.disabled {
        opacity: .45;
    }


/* =====================================================
   FORM CONTROLS
   ===================================================== */

.gs-theme .form-control,
.gs-theme .form-select {
    min-height: 36px;
    border: 1px solid var(--gs-control-border);
    border-radius: var(--gs-radius-sm);
    font-size: 14px;
    color: var(--gs-text);
}

    .gs-theme .form-control:focus,
    .gs-theme .form-select:focus {
        border-color: var(--gs-blue);
        box-shadow: 0 0 0 3px var(--gs-blue-ring);
    }

    /* File inputs keep their natural height: with the 36px min-height the "Choose File"
       button didn't stretch, leaving a white strip under it */
    .gs-theme .form-control[type="file"] {
        min-height: 0;
        overflow: hidden;
    }

        .gs-theme .form-control[type="file"]::file-selector-button {
            background-color: var(--gs-head-bg);
            color: var(--gs-text);
            border-inline-end: 1px solid var(--gs-control-border);
        }

        .gs-theme .form-control[type="file"]::-webkit-file-upload-button {
            background-color: var(--gs-head-bg);
            color: var(--gs-text);
            border-inline-end: 1px solid var(--gs-control-border);
        }

    .gs-theme .form-control[readonly] {
        background-color: var(--gs-head-bg);
        color: var(--gs-muted);
    }

.gs-theme .form-check-input:checked {
    background-color: var(--gs-blue);
    border-color: var(--gs-blue);
}

.gs-theme .form-check-input:focus {
    border-color: var(--gs-blue);
    box-shadow: 0 0 0 3px var(--gs-blue-ring);
}

.gs-theme .form-label,
.gs-theme .form-check-label {
    font-size: 13px;
    color: var(--gs-muted);
}

.gs-theme .form-label {
    font-weight: 600;
    margin-bottom: 4px;
}

/* A status pill beside a label (e.g. "Verified") gets the same gap above the input */
.gs-theme .form-label + .gs-pill {
    margin: 0 0 6px 6px;
    vertical-align: middle;
}

.gs-theme .text-danger {
    color: #b91c1c !important;
}

/* Validation messages are small; other red text keeps its own size */
.gs-theme .field-validation-error,
.gs-theme .validation-summary-errors {
    font-size: 13px;
}


/* =====================================================
   CARDS
   ===================================================== */

.gs-card {
    background: var(--gs-card);
    border: 1px solid var(--gs-border);
    border-radius: var(--gs-radius);
}

.gs-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 8px 16px;
    border-top: 1px solid var(--gs-border);
    font-size: 13px;
    color: var(--gs-muted);
    font-variant-numeric: tabular-nums;
}

.gs-pager {
    display: flex;
    gap: 8px;
}


/* =====================================================
   DATA TABLES
   The table scrolls inside its card (both ways) so the header row can stay sticky.
   ===================================================== */

.gs-table-scroll {
    /* relative: contains absolutely positioned bits in cells (screen-reader "Yes"/"No" text), which
       otherwise escape the scroll box and widen the page on phones */
    position: relative;
    overflow: auto;
    border-radius: var(--gs-radius) var(--gs-radius) 0 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

    .gs-table-scroll:last-child {
        border-radius: var(--gs-radius);
    }

.gs-theme table.gs-table {
    width: 100%;
    margin: 0;
    font-size: 13px;
    color: var(--gs-text);
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
}

    .gs-theme table.gs-table > :not(:first-child) {
        border-top: 0;
    }

    .gs-theme table.gs-table th,
    .gs-theme table.gs-table td {
        padding: 8px 12px;
        vertical-align: middle;
        border-bottom: 1px solid var(--gs-row-border);
    }

    /* List tables: body rows a little tighter than the header, so more of a 20-row page fits on
       screen. (Not the dashboard's rounds table, which lines up with the Player Card beside it.) */
    .gs-theme .gs-table-scroll > table.gs-table > tbody > tr > td {
        padding-top: 6px;
        padding-bottom: 6px;
        line-height: 18px;
    }

    .gs-theme .gs-table-scroll > table.gs-table > thead > tr > th {
        padding-top: 7px;
        padding-bottom: 7px;
    }

    /* Status pills are the tallest thing in most rows: slimmed to the action icons' 20px and
       top-aligned in the line box (on the text baseline they add a few px), so they don't set the row
       height. The cell still centers them in the row. */
    .gs-theme .gs-table-scroll .gs-pill {
        line-height: 16px;
        vertical-align: top;
    }

    .gs-theme .gs-table-scroll td > .btn-group {
        vertical-align: top;
    }

    .gs-theme table.gs-table thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background-color: var(--gs-head-bg);
        border-bottom: 1px solid var(--gs-border);
        color: var(--gs-muted);
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
    }

        .gs-theme table.gs-table thead th a {
            color: var(--gs-muted);
            text-decoration: none;
        }

            .gs-theme table.gs-table thead th a:hover {
                color: var(--gs-text);
            }

        /* Sort icons: quiet until hovered (site.css paints a i.far blue !important) */
        .gs-theme table.gs-table thead th a i.far {
            color: var(--gs-faint) !important;
            font-size: 10px;
            padding: 0 0 0 2px;
        }

        .gs-theme table.gs-table thead th a:hover i.far {
            color: var(--gs-blue) !important;
        }

    .gs-theme table.gs-table tbody tr:last-child td {
        border-bottom: 0;
    }

    /* site.css paints hovered rows a strong blue; a quiet wash reads better */
    .gs-theme table.gs-table tbody tr:hover {
        background-color: var(--gs-head-bg);
    }

    .gs-theme table.gs-table tbody tr[onclick] {
        cursor: pointer;
    }

    .gs-theme table.gs-table .num,
    .gs-theme table.gs-table .gs-date {
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .gs-theme table.gs-table .num {
        text-align: right;
    }

    /* Row action icons */
    .gs-theme table.gs-table td:has(div.btn-group) {
        padding: 8px 12px;
    }

.gs-mono {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 13px;
}

/* A key or id as the page's subtitle (Edit pages) */
.gs-page-meta.gs-mono {
    font-size: 14px;
}

/* A long value in a list (a download link): one line, cut with "...", the full text in its title */
.gs-theme .gs-truncate {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Free text in a list (notes, descriptions, terms): two lines at most, the full text in its title
   (.is-wide: the row's main column, as wide as the table allows) */
.gs-theme .gs-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    min-width: 180px;
    max-width: 320px;
}

    .gs-theme .gs-clamp.is-wide {
        max-width: none;
    }

/* List columns for wide screens only (Created and Modified on the busier lists). Below 1600px they
   hide and long links cut shorter, so a 1280-1440 laptop shows the list without sideways scrolling
   and the names keep room to read. */
@media (max-width: 1599.98px) {
    .gs-theme table.gs-table .gs-col-wide {
        display: none;
    }

    .gs-theme .gs-truncate {
        max-width: 200px;
    }
}

.gs-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--gs-muted);
}


/* =====================================================
   STATE MARKS
   ===================================================== */

/* Yes/no cells: a check for yes, a faint dash for no */
.gs-bool {
    display: inline-block;
    min-width: 14px;
    text-align: center;
}

    .gs-bool.is-yes {
        color: var(--gs-blue);
    }

    .gs-bool.is-no {
        color: #cbd5e1;
    }

/* Status pill: a dot plus a word, so state never rides on color alone */
.gs-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--gs-row-border);
    color: var(--gs-muted);
}

    .gs-pill::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

    .gs-pill.is-active {
        background: var(--gs-good-bg);
        color: var(--gs-good);
    }


/* =====================================================
   FORMS (Create / Edit)
   ===================================================== */

.gs-form-page {
    max-width: 760px;
    margin: 0 auto;
}

.gs-form-card {
    padding: 8px 24px 20px;
}

.gs-form-section {
    padding: 16px 0 6px;
    border-bottom: 1px solid var(--gs-row-border);
}

    .gs-form-section:last-of-type,
    .gs-form-section:has(+ .gs-form-actions) {
        border-bottom: 0;
    }

.gs-section-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--gs-muted);
    margin: 0 0 12px;
}

/* Checkbox groups (features, devices): a grid of checkboxes instead of one per row */
.gs-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px 16px;
}

    .gs-check-grid .form-check {
        margin: 0;
    }

    .gs-check-grid label {
        font-size: 13px;
        color: var(--gs-text);
    }

    .gs-check-grid input[type="checkbox"] {
        margin-right: 6px;
        accent-color: var(--gs-blue);
    }

/* Courses Keywords and Classification: wider columns, the same in both so they line up, and each
   checkbox's name and its M (manifest) badge stay on one line, so the badge never drops below the
   name. "Has Course Driving Range Only" plus its badge is the longest. */
.gs-check-grid.is-wide {
    grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
}

    .gs-check-grid.is-wide .form-check {
        white-space: nowrap;
    }

/* Keywords (.is-short: short names) keep two columns on phones, where the wide columns would leave
   one per row */
@media (max-width: 575.98px) {
    .gs-check-grid.is-wide.is-short {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

.gs-machine-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 36px;
    justify-content: center;
    font-size: 13px;
    word-break: break-all;
}

.gs-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid var(--gs-border);
}

/* =====================================================
   EXTRA LAYOUT PIECES
   ===================================================== */

/* Long forms (e.g. Courses) */
.gs-form-page.is-wide {
    max-width: 1040px;
}

/* Vertical stack of cards with an even gap */
.gs-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Title row inside a card, above a table or list: title left, actions right */
.gs-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gs-border);
}

.gs-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gs-text);
    margin: 0;
}

/* Padded content area inside a card (when it isn't a table or a form) */
.gs-card-body {
    padding: 16px;
}

/* Read-only label/value pairs (details, summaries) */
.gs-details {
    display: grid;
    grid-template-columns: minmax(120px, max-content) 1fr;
    gap: 8px 16px;
    margin: 0;
    font-size: 14px;
}

    .gs-details dt {
        font-size: 13px;
        font-weight: 600;
        color: var(--gs-muted);
    }

    .gs-details dd {
        margin: 0;
        color: var(--gs-text);
        min-width: 0;
        overflow-wrap: anywhere;
    }

/* Warning/attention pill, for states that need a look (expired, unverified) */
.gs-pill.is-warn {
    background: #fff4e6;
    color: #b45309;
}

/* Link-style buttons (row icons, "Impersonate"): natural height, no padding, so they
   don't stretch a table row to the 36px button height */
.gs-theme .btn.btn-link {
    height: auto;
    padding: 0;
}

/* Highlighted rows (e.g. hidden players on Manage Players): the theme's soft amber
   instead of Bootstrap's yellow */
.gs-theme table.gs-table .table-warning {
    --bs-table-bg: #fff8ec;
    --bs-table-accent-bg: transparent;
    color: var(--gs-text);
}

/* Alerts and help text inside themed pages */
.gs-theme .alert {
    border-radius: var(--gs-radius-sm);
    font-size: 13px;
    padding: 10px 14px;
}

.gs-theme .alert-info {
    background: #eef6fc;
    border-color: #cfe4f4;
    color: #0f4c75;
}

.gs-theme .alert-success {
    background: #e6f6ef;
    border-color: #b7e4cf;
    color: #0b5d43;
}

.gs-theme .alert-warning {
    background: #fff4e6;
    border-color: #fbd9a5;
    color: #8a4a06;
}

.gs-theme .alert-danger {
    background: #fdecec;
    border-color: #f5c2c2;
    color: #9b1c1c;
}

/* Keep room for the close button (the padding above would otherwise put the X over the text) */
.gs-theme .alert-dismissible {
    padding-right: 44px;
}

    .gs-theme .alert-dismissible .btn-close {
        padding: 12px 14px;
    }

/* An empty validation summary takes no space */
.gs-theme .validation-summary-valid {
    display: none;
}

.gs-theme .form-text {
    font-size: 12px;
    color: var(--gs-muted);
}

/* "Manifest can override" tag (Courses forms): a small "M" badge right after a field's name, on the
   same line; its title explains it on hover, and screen readers hear "Manifest".
   .is-inline is the same badge inside a sentence. */
.gs-manifest-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: #eef6fc;
    color: #0f4c75;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 16px;
    vertical-align: 1px;
    white-space: nowrap;
    cursor: help;
}

    .gs-manifest-tag.is-inline {
        margin: 0 1px;
        cursor: default;
    }

/* One-line explanation under a form section title */
.gs-section-note {
    font-size: 13px;
    color: var(--gs-muted);
    margin: -4px 0 12px;
}


/* =====================================================
   PHONE AND TABLET
   ===================================================== */

/* Phones: the toolbar's search box takes its own row and the buttons share the next one(s)
   evenly; forms get tighter side padding; checkbox grids fit two per row. */
@media (max-width: 575.98px) {
    .gs-theme .gs-search {
        flex: 1 1 100%;
        width: auto;
    }

    .gs-toolbar > .btn,
    .gs-toolbar > a.btn {
        flex: 1 1 auto;
        padding: 0 10px;
    }

    .gs-form-card {
        padding: 4px 16px 16px;
    }

    .gs-check-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .gs-form-actions {
        flex-wrap: wrap;
    }

    .gs-details {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }

        .gs-details dd {
            margin-bottom: 8px;
        }
}

/* List pages fit the window on laptops and desktops: the page header, the table card with its pager,
   the buttons under it and the site footer all stay on screen, and only the table scrolls (its header
   row stays put). Each box from <body> down to the table's card becomes a flex column that may
   shrink, so the scroll box gets whatever height is left. A short table keeps its natural height.
   Applies to any .gs-theme page with a .gs-card > .gs-table-scroll: the admin list pages
   (.gs-theme > .gs-card), Verify upload (inside a .gs-stack, under its summary card) and the license
   Manage players page (inside .gs-form-page > form, with its Save/Archive buttons below). Other
   pages with tables just scroll with the page, as do phones and tablets (below 992px), where a
   second scroll box inside a scrolling page is awkward, and very short windows (under 600px), where
   the table would get too little room. */
@media (min-width: 992px) and (min-height: 600px) {
    body:has(.gs-theme .gs-card > .gs-table-scroll) {
        height: 100vh;
        height: 100dvh;
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
    }

        /* the column: everything from the page container down to the wrapper around the table card */
        body:has(.gs-theme .gs-card > .gs-table-scroll) > .container-fluid,
        body:has(.gs-theme .gs-card > .gs-table-scroll) main,
        .gs-theme:has(.gs-card > .gs-table-scroll),
        .gs-theme :has(.gs-card > .gs-table-scroll) {
            flex: 1 1 auto;
            min-height: 0;
            display: flex;
            flex-direction: column;
        }

        /* everything beside that chain (page header, notes, summary card, buttons) keeps its height */
        body:has(.gs-theme .gs-card > .gs-table-scroll) > :not(.container-fluid),
        .gs-theme:has(.gs-card > .gs-table-scroll) > :not(:has(.gs-card > .gs-table-scroll)):not(.gs-card:has(> .gs-table-scroll)),
        .gs-theme :has(.gs-card > .gs-table-scroll) > :not(:has(.gs-card > .gs-table-scroll)):not(.gs-card:has(> .gs-table-scroll)) {
            flex: none;
        }

        /* .gs-form-page centers itself with auto side margins, which in a flex column would shrink it to
           its content's width; keep it full width (up to its max-width) */
        .gs-theme .gs-form-page:has(.gs-card > .gs-table-scroll) {
            width: 100%;
        }

        /* The footer is normally pinned to the page bottom (position: absolute in _Layout.cshtml.css)
           over body's padding-bottom. With that padding gone it would cover the pager, so here it
           takes its own row at the bottom of the column instead. */
        body:has(.gs-theme .gs-card > .gs-table-scroll) > .footer {
            position: static;
        }

        /* a little room between the card and the footer bar */
        body:has(.gs-theme .gs-card > .gs-table-scroll) > .container-fluid {
            padding-bottom: 8px;
        }

    .gs-theme .gs-card:has(> .gs-table-scroll) {
        flex: 0 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

        .gs-theme .gs-card > .gs-table-scroll {
            flex: 0 1 auto;
            min-height: 160px;
        }

        .gs-theme .gs-card:has(> .gs-table-scroll) > :not(.gs-table-scroll) {
            flex: none;
        }
}
