/* Flower show colour palette: greens with warm yellow/orange accents. */
[data-bs-theme="dark"] {
    --fs-bg: #16241a;
    --fs-surface: #1f3326;
    --fs-surface-hover: #28402f;
    --fs-border: #33512f;
    --fs-text: #f3f0e6;
    --fs-text-muted: #b9c9b7;
    --fs-accent: #e2b93b;
    --fs-accent-rgb: 226, 185, 59;
    --fs-accent-strong: #d97d33;
    --fs-focus-ring: #f0c14b;
    --fs-focus-ring-rgb: 240, 193, 75;

    /* Depth & glass: translucent gradient surfaces over a lit backdrop, with
       a light top edge and layered (contact + ambient) shadows. */
    --fs-glass-bg: linear-gradient(145deg, rgba(52, 84, 61, 0.72), rgba(27, 45, 33, 0.62));
    --fs-glass-bg-hover: linear-gradient(145deg, rgba(64, 100, 73, 0.78), rgba(34, 55, 40, 0.68));
    --fs-glass-border: rgba(255, 255, 255, 0.08);
    --fs-glass-highlight: rgba(255, 255, 255, 0.12);
    --fs-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
    --fs-shadow-2: 0 2px 4px rgba(0, 0, 0, 0.4), 0 14px 32px rgba(0, 0, 0, 0.4);
    --fs-glow: 0 0 0 1px rgba(var(--fs-accent-rgb), 0.45), 0 0 18px rgba(var(--fs-accent-rgb), 0.25);

    --bs-body-bg: var(--fs-bg);
    --bs-body-color: var(--fs-text);
    --bs-border-color: var(--fs-border);
    --bs-primary: var(--fs-accent-strong);
    --bs-primary-rgb: 217, 125, 51;
    --bs-link-color: var(--fs-accent);
    --bs-link-color-rgb: 226, 185, 59;
    --bs-link-hover-color: var(--fs-focus-ring);
    --bs-link-hover-color-rgb: 240, 193, 75;
    /* Only Bootstrap's .focus-ring utility classes read this variable — the
       .form-control/.form-check-input/.form-select :focus rules below don't
       use it at all (confirmed against the compiled CSS, see comment below),
       so it's kept here for consistency/any future use of that utility, not
       because it fixes the focus glow on its own. */
    --bs-focus-ring-color: rgba(var(--fs-focus-ring-rgb), 0.25);
}

/* Bootstrap 5.3's compiled CSS bakes each component's colours in as literal
   values, not var(--bs-primary)/var(--bs-focus-ring-color) references —
   confirmed by inspecting the actual shipped CSS, e.g.:
     .btn-primary{--bs-btn-bg:#0d6efd; ...}
     .form-check-input:checked{background-color:#0d6efd; ...}
     .form-control:focus{border-color:#86b7fe;box-shadow:0 0 0 .25rem rgba(13,110,253,.25)}
   So overriding --bs-primary/--bs-focus-ring-color above doesn't reach any
   of these — each needs its own explicit override instead. */
.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--fs-focus-ring);
    --bs-btn-hover-border-color: var(--fs-focus-ring);
    --bs-btn-active-bg: var(--fs-focus-ring);
    --bs-btn-active-border-color: var(--fs-focus-ring);
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
    --bs-btn-focus-shadow-rgb: var(--fs-focus-ring-rgb);
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* Secondary buttons (e.g. "add class") keep a distinct colour from primary
   ("add section") so the two stay visually distinguishable, but use the
   palette's other accent (gold) instead of Bootstrap's default grey. */
.btn-secondary {
    /* White text (Bootstrap's default --bs-btn-color) fails contrast against
       this lighter gold (~1.9:1) — use the dark background colour for text
       instead (~8.6:1). */
    --bs-btn-color: var(--fs-bg);
    --bs-btn-bg: var(--fs-accent);
    --bs-btn-border-color: var(--fs-accent);
    --bs-btn-hover-color: var(--fs-bg);
    --bs-btn-hover-bg: var(--fs-focus-ring);
    --bs-btn-hover-border-color: var(--fs-focus-ring);
    --bs-btn-active-color: var(--fs-bg);
    --bs-btn-active-bg: var(--fs-focus-ring);
    --bs-btn-active-border-color: var(--fs-focus-ring);
    --bs-btn-disabled-color: var(--fs-bg);
    --bs-btn-disabled-bg: var(--fs-accent);
    --bs-btn-disabled-border-color: var(--fs-accent);
    --bs-btn-focus-shadow-rgb: var(--fs-focus-ring-rgb);
}

.form-control:focus,
.form-check-input:focus,
.form-select:focus {
    border-color: var(--fs-focus-ring);
    box-shadow: 0 0 0 0.25rem rgba(var(--fs-focus-ring-rgb), 0.25);
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    /* Top padding leaves room for a hovered item's lift and outline, so it
       doesn't overlap a heading directly above the list. */
    padding: 0.75rem 0 0;
    margin: 0;
    list-style: none;
}

.card-list-item {
    --item-pad-y: 0.85rem;
    --item-pad-x: 1rem;

    display: flex;
    align-items: center;
    color: var(--fs-text);
    border-radius: 0.75rem;
    padding: var(--item-pad-y) var(--item-pad-x);
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: background 0.15s ease, outline-color 0.15s ease,
        box-shadow 0.2s ease, transform 0.2s ease;
}

.card-list-item:hover,
.card-list-item:focus-within,
.card-list-item.sortable-chosen,
.card-list-item.sortable-drag {
    background: var(--fs-glass-bg-hover);
    outline-color: var(--fs-focus-ring);
    box-shadow: inset 0 1px 0 var(--fs-glass-highlight), var(--fs-shadow-2), var(--fs-glow);
    transform: translateY(-2px);
}

.card-list-item.sortable-chosen,
.card-list-item.sortable-drag {
    transform: translateY(-4px) scale(1.01);
}

.card-list-item a {
    color: var(--fs-text);
    text-decoration: none;
}

.card-list-handle {
    color: var(--fs-text-muted);
    cursor: grab;
}


.card-list-item-disabled {
    opacity: 0.55;
}

.card-list-item.selected {
    outline-color: var(--fs-accent);
    outline-width: 3px;
    background: var(--fs-glass-bg-hover);
    box-shadow: inset 0 1px 0 var(--fs-glass-highlight), var(--fs-shadow-2), var(--fs-glow);
}

.card-list-select {
    text-decoration: none;
}

/* An item's link or select button fills the whole card (bar the drag handle),
   so anywhere on it is clickable: negative margins take it out over the
   item's padding, and matching padding keeps the text where it was. */
.card-list-item > a,
.card-list-item > .card-list-select,
.card-list-item > .person-select {
    display: flex;
    align-items: center;
    align-self: stretch;
    margin: calc(-1 * var(--item-pad-y)) calc(-1 * var(--item-pad-x));
    padding: var(--item-pad-y) var(--item-pad-x);
    border: 0;
    border-radius: inherit;
    text-align: left;
}

/* After a drag handle, only reach back over the gap beside it. */
.card-list-handle + a,
.card-list-handle + .card-list-select {
    margin-left: -0.5rem;
    padding-left: 0.5rem;
}

.detail-panel {
    color: var(--fs-text);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
}

/* Prize money boxes: a "£" prefix and no number spinner, kept compact so
   amounts like 0.50 fit in the narrow class panel's three columns. */
.money-input .input-group-text,
.money-input .form-control {
    padding-inline: 0.5rem;
}

.money-input input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.money-input input[type="number"]::-webkit-inner-spin-button,
.money-input input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Entries tab: the Auction box beside an entered class, in a column after a
   fixed-width class name (long names wrap). */
.entries-class-row {
    display: flex;
    align-items: center;
}

.entries-class-row > .form-check-label {
    flex: 0 0 min(22rem, 60%);
}

/* In a flex row the checkbox no longer floats, so restore the gap before its label. */
.entries-class-row > .entry-check {
    margin-right: 0.5em;
}

.entries-auction {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.75rem;
    font-size: 0.85em;
    color: var(--fs-text-muted);
    cursor: pointer;
}

.entries-auction .form-check-input {
    float: none;
    margin: 0;
}

.gavel-icon {
    width: 1.1em;
    height: 1.1em;
}

.list-add-btn {
    width: 2rem;
    height: 2rem;
    padding: 0;
    line-height: 1;
    font-size: 1.1rem;
}

/* Home page People tab: a scrolling list beside the person edit pane. The
   inline padding leaves room for an item's hover/selected outline. */
.people-list {
    max-height: 65vh;
    overflow-y: auto;
    padding: 0.75rem 0.4rem 0.4rem;
    gap: 0.35rem;
}

/* Side by side (md and up), the list scrolls within a pane that ends level
   with the bottom of the edit pane: the column stretches to the edit pane's
   height, and the absolutely positioned list adds no height of its own. */
@media (min-width: 768px) {
    .people-column {
        display: flex;
        flex-direction: column;
    }

    .people-list-wrap {
        position: relative;
        flex: 1 1 auto;
        min-height: 16rem;
    }

    .people-list {
        position: absolute;
        inset: 0;
        max-height: none;
    }
}

.people-list .card-list-item {
    --item-pad-y: 0.45rem;
    --item-pad-x: 0.85rem;
}

.people-list .card-list-item:hover,
.people-list .card-list-item:focus-within {
    transform: none;
}

.entrant-search-results {
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0.25rem 0 0;
    padding: 0;
    list-style: none;
    max-height: 16rem;
    overflow-y: auto;
    border-radius: 0.5rem;
}

.entrant-search-result {
    padding: 0.5rem 0.85rem;
    cursor: pointer;
}

.entrant-search-result:hover,
.entrant-search-result:focus {
    background: var(--fs-surface-hover);
}

/* ---------------------------------------------------------------------------
   Depth & glass
   ------------------------------------------------------------------------ */

/* Soft coloured light behind the content, so the translucent surfaces
   below pick up some colour variation (and the blur has something to blur). */
body {
    min-height: 100vh;
    background-color: var(--fs-bg);
    background-image:
        radial-gradient(ellipse 60% 50% at 0% 0%, rgba(var(--fs-accent-rgb), 0.16), transparent 70%),
        radial-gradient(ellipse 50% 60% at 100% 35%, rgba(58, 150, 120, 0.18), transparent 70%),
        radial-gradient(ellipse 60% 45% at 30% 100%, rgba(217, 125, 51, 0.12), transparent 70%);
    background-attachment: fixed;
}

.card-list-item,
.detail-panel,
.entrant-search-results,
.alert,
.modal-content,
.dropdown-menu {
    background: var(--fs-glass-bg);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid var(--fs-glass-border);
    box-shadow: inset 0 1px 0 var(--fs-glass-highlight), var(--fs-shadow-1);
}

.entrant-search-results {
    box-shadow: inset 0 1px 0 var(--fs-glass-highlight), var(--fs-shadow-2);
}

@supports not (backdrop-filter: blur(1px)) {
    .card-list-item,
    .detail-panel,
    .entrant-search-results,
    .alert,
    .modal-content,
    .dropdown-menu {
        background: linear-gradient(145deg, var(--fs-surface-hover), var(--fs-surface));
    }
}

/* Buttons: a translucent sheen over whatever background colour the button
   variant sets, so hover/active colour changes still show through, plus an
   inset top highlight and bottom shade to give a raised, pill-like edge. */
.btn-primary,
.btn-secondary,
.fab-btn {
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, 0.1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.15),
        0 2px 6px rgba(0, 0, 0, 0.35);
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.15),
        0 2px 6px rgba(0, 0, 0, 0.35), 0 0 16px rgba(var(--fs-focus-ring-rgb), 0.45);
}

/* The FAB gets an off-centre highlight so it reads as a sphere. */
.fab-btn {
    background-image:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 45%),
        linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(0, 0, 0, 0.18));
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(0, 0, 0, 0.45),
        0 12px 28px rgba(0, 0, 0, 0.35);
}

.fab-btn:hover,
.fab-btn:focus-visible {
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(0, 0, 0, 0.45),
        0 12px 28px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(var(--fs-focus-ring-rgb), 0.35),
        0 0 24px rgba(var(--fs-focus-ring-rgb), 0.5);
}

/* Tabs: the active tab becomes a glass tab with a gold→orange underline. */
.nav-tabs {
    --bs-nav-tabs-border-color: var(--fs-glass-border);
    --bs-nav-tabs-link-hover-border-color: transparent;
    --bs-nav-tabs-link-active-color: var(--fs-text);
    --bs-nav-tabs-link-active-bg: transparent;
    --bs-nav-tabs-link-active-border-color: var(--fs-glass-border) var(--fs-glass-border) transparent;
}

.nav-tabs .nav-link {
    position: relative;
    transition: color 0.15s ease, background 0.15s ease, text-shadow 0.15s ease;
}

.nav-tabs .nav-link:hover {
    text-shadow: 0 0 10px rgba(var(--fs-accent-rgb), 0.5);
}

.nav-tabs .nav-link.active {
    background: var(--fs-glass-bg);
    box-shadow: inset 0 1px 0 var(--fs-glass-highlight);
}

.nav-tabs .nav-link.active::after {
    content: "";
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--fs-accent), var(--fs-accent-strong));
    box-shadow: 0 0 8px rgba(var(--fs-accent-rgb), 0.6);
}

/* Form fields look recessed into the glass surface they sit on. */
.form-control,
.form-select,
.form-check-input:not(:checked) {
    background-color: rgba(0, 0, 0, 0.22);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* A select's open option list is drawn by the browser/OS. With the select's
   translucent background it falls back to a light-grey dark-mode list with
   white text, which is hard to read — give options a solid dark background. */
.form-select option {
    background-color: var(--fs-bg);
    color: var(--fs-text);
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(0, 0, 0, 0.28);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 0.25rem rgba(var(--fs-focus-ring-rgb), 0.25),
        0 0 16px rgba(var(--fs-focus-ring-rgb), 0.3);
}

h1 {
    background: linear-gradient(90deg, var(--fs-text) 0%, #f5dc92 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .card-list-item,
    .card-list-item:hover,
    .card-list-item:focus-within,
    .card-list-item.sortable-chosen,
    .card-list-item.sortable-drag {
        transform: none;
        transition: none;
    }
}

/* Reports tab: sub-tab pills and report rows. */
.nav-pills {
    --bs-nav-pills-link-active-color: var(--fs-bg);
    --bs-nav-pills-link-active-bg: var(--fs-accent);
    gap: 0.25rem;
}

.nav-pills .nav-link.active {
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 55%, rgba(0, 0, 0, 0.1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 12px rgba(var(--fs-accent-rgb), 0.35);
}

.report-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.report-description {
    color: var(--fs-text-muted);
}

/* Prize Labels picker: a light dropdown so each option can show in its
   printed label colour (red/blue/green/black all read well on white). These
   option rules out-rank the general dark `.form-select option` rule above. */
.form-select.prize-label-select {
    background-color: #fff;
    font-weight: bold;
    color-scheme: light;
}

.form-select.prize-label-select option {
    background-color: #fff;
    font-weight: bold;
}

.prize-label-select.prize-first,
.prize-label-select option.prize-first {
    color: #c00000;
}

.prize-label-select.prize-second,
.prize-label-select option.prize-second {
    color: #0033a0;
}

.prize-label-select.prize-third,
.prize-label-select option.prize-third {
    color: #00703c;
}

.prize-label-select.prize-hc,
.prize-label-select option.prize-hc {
    color: #000;
}

/* Entries tab: "Save these changes for..." dialog, wide enough for its three
   buttons on one line. */
.entrant-scope-dialog {
    max-width: 36rem;
}

/* Help menu, at the top right of every page, level with the page's <h1>. */
.help-menu,
.user-menu {
    margin-top: 0.4rem;
}

/* Messages go below the Help and user menus: their backdrop-filter would otherwise paint
   them over the floated menus, hiding them. */
.container > .alert {
    clear: both;
}

/* User guides (shows/guide.html): a readable line length, with screenshots
   scaled down to fit. */
.guide {
    max-width: 52rem;
    line-height: 1.6;
}

.guide h2 {
    margin-top: 2.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--fs-border);
}

.guide h3 {
    margin-top: 1.75rem;
}

.guide img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1rem 0 1.5rem;
    border: 1px solid var(--fs-border);
    border-radius: 0.375rem;
    box-shadow: var(--fs-shadow-1);
}

.guide blockquote {
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--fs-accent);
    background: var(--fs-surface);
    color: var(--fs-text-muted);
}

.guide blockquote p:last-child {
    margin-bottom: 0;
}

.guide pre {
    padding: 1rem;
    background: var(--fs-surface);
    border: 1px solid var(--fs-border);
    border-radius: 0.375rem;
}

.guide code {
    color: var(--fs-accent);
}
