html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.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;
}

html {
  position: relative;
  min-height: 100%;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ── Status badge utilities ──────────────────────────────────────────────────
   Used by _ChallengeCard.cshtml and Challenge.cshtml for live/upcoming/past.
   ---------------------------------------------------------------------------- */
.badge-live     { background: var(--tblr-success); color: #fff; font-weight: 700; letter-spacing: .04em; }
.badge-upcoming { background: var(--tblr-primary);  color: #fff; }
.badge-past     { background: rgba(0,0,0,.45);       color: #fff; }

/* ── Thin progress bar ────────────────────────────────────────────────────────
   Use alongside Bootstrap .progress: <div class="progress progress-thin">
   ---------------------------------------------------------------------------- */
.progress-thin { height: 5px; border-radius: 3px; }

/* ── Feature icon ─────────────────────────────────────────────────────────────
   48×48 pill icon container. Used on Index.cshtml feature grid.
   ---------------------------------------------------------------------------- */
.feature-icon {
    width: 48px; height: 48px;
    background: rgba(var(--tblr-primary-rgb), .1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Zoomable image ───────────────────────────────────────────────────────────
   Add class "zoomable" to any img for zoom cursor + subtle hover fade.
   Used on Running-br.cshtml setup screenshots.
   ---------------------------------------------------------------------------- */
img.zoomable { cursor: zoom-in; transition: opacity .15s; }
img.zoomable:hover { opacity: .88; }

/* ── Compact DataTables header bar ───────────────────────────────────────────
   Shared by Ride, admin_reports, and any page using the DataTables dom:
   '<"dt-admin-header"l<"dt-grid-title">f>' pattern.
   ---------------------------------------------------------------------------- */
.dt-admin-header {
    display: flex;
    align-items: center;
    padding: .5rem 1rem;
    border-bottom: 1px solid var(--tblr-border-color);
    flex-wrap: wrap;
    gap: .4rem;
}
.dt-grid-title {
    flex: 1;
    text-align: center;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--tblr-secondary-color, #6c757d);
}
@media (max-width: 575px) {
    .dt-admin-header .dataTables_length,
    .dt-admin-header .dataTables_filter { width: 100%; }
    .dt-admin-header .dataTables_filter input { width: 100%; box-sizing: border-box; }
    .dt-grid-title { display: none; }
}

/* ── Card hover lift — utility used by Challenges, TrainingCalendar ──────────
   Add class "card-hover-lift" to any card that should rise on hover.
   ---------------------------------------------------------------------------- */
.card-hover-lift {
    transition: transform .18s ease, box-shadow .18s ease;
}
.card-hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.13);
}

/* ── DataTables — Tabler integration ─────────────────────────────────────── */

/* Wrapper layout */
.dataTables_wrapper {
    padding: 0;
    font-size: .875rem;
}

/* Top controls — length left, filter right, on one line */
.dataTables_wrapper .dataTables_length { float: left;  padding: .75rem 1rem; }
.dataTables_wrapper .dataTables_filter  { float: right; padding: .75rem 1rem; }
table.dataTable { clear: both; }

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    font-size: .8rem;
    font-weight: 500;
    color: #6c757d;
    white-space: nowrap;
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    height: 32px;
    padding: .25rem .6rem;
    font-size: .8rem;
    border: 1px solid #d0d7de;
    border-radius: .4rem;
    background: #fff;
    color: #1d273b;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--tblr-primary);
    box-shadow: 0 0 0 3px rgba(var(--tblr-primary-rgb),.12);
}

/* Divider between controls and table */
.dataTables_wrapper .dataTables_filter + .dataTables_scroll,
.dataTables_wrapper > .row:first-child {
    border-bottom: 1px solid #e6e7e9;
}

/* Table itself */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}
table.dataTable thead th,
table.dataTable thead td {
    padding: .6rem 1rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 2px solid #e6e7e9;
    border-top: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
table.dataTable thead th:hover { color: var(--tblr-primary); }
table.dataTable tbody a { color: var(--tblr-primary); }
table.dataTable tbody a:hover { color: var(--tblr-primary-darken, #1a5ba8); }

/* Sort indicators — pure CSS, no images */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    background-image: none !important;
    padding-right: 1.5rem;
    position: relative;
    cursor: pointer;
    user-select: none;
}
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    content: '';
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    opacity: .35;
}
table.dataTable thead .sorting::after {
    border-top-color: #6c757d;
    margin-top: 2px;
}
table.dataTable thead .sorting_asc::after {
    border-bottom-color: var(--tblr-primary);
    opacity: 1;
    margin-top: 4px;
}
table.dataTable thead .sorting_desc::after {
    border-top-color: var(--tblr-primary);
    opacity: 1;
    margin-top: -2px;
}

/* Body rows */
table.dataTable tbody tr {
    border-bottom: 1px solid #f0f2f5;
    transition: background .1s;
}
table.dataTable tbody tr:last-child { border-bottom: none; }
table.dataTable tbody tr:hover > td { background: #f4f7fb !important; }
table.dataTable tbody td {
    padding: .6rem 1rem;
    vertical-align: middle;
    color: #1d273b;
    border-top: none;
}

/* Info text */
.dataTables_wrapper .dataTables_info {
    padding: .6rem 1rem;
    font-size: .78rem;
    color: #9aa0ac;
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate {
    padding: .5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .2rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 .5rem;
    border-radius: .4rem;
    font-size: .8rem;
    font-weight: 500;
    color: #1d273b !important;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f0f4fb;
    border-color: #d0d7de;
    color: var(--tblr-primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--tblr-primary);
    border-color: var(--tblr-primary);
    color: #fff !important;
    font-weight: 600;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #c8ced6 !important;
    cursor: default;
    pointer-events: none;
}

/* Bottom controls row border */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    border-top: 1px solid #f0f2f5;
}

/* DataTables wraps numbered page buttons in a <span> — make it flex so they
   don't wrap as inline elements on narrow screens */
.dataTables_wrapper .dataTables_paginate > span {
    display: flex;
    flex-wrap: nowrap;
    gap: .2rem;
}
/* Allow paginate row itself to scroll horizontally if screen is very narrow */
.dataTables_wrapper .dataTables_paginate {
    overflow-x: auto;
    flex-wrap: nowrap;
}

/* No-paging mode — hide controls cleanly */
.dataTables_wrapper.no-paging .dataTables_paginate,
.dataTables_wrapper.no-paging .dataTables_info { display: none; }

/* ── DataTables dark mode overrides ──────────────────────────────────────────
   Scoped to [data-bs-theme="dark"] so light mode is completely unaffected.
   Covers: table cells, headers, borders, hover, sort arrows, search/length
   controls, pagination buttons, info text, and child rows.
   ---------------------------------------------------------------------------- */
[data-bs-theme="dark"] table.dataTable thead th,
[data-bs-theme="dark"] table.dataTable thead td {
    color: var(--tblr-body-color);
    border-bottom-color: var(--tblr-border-color);
    background-color: var(--tblr-bg-surface);
}
[data-bs-theme="dark"] table.dataTable thead th:hover {
    color: #7eb3f5;
}
[data-bs-theme="dark"] table.dataTable tbody td {
    color: var(--tblr-body-color);
    background-color: #2a2f3d;
}
[data-bs-theme="dark"] table.dataTable tbody a {
    color: #7eb3f5;
}
[data-bs-theme="dark"] table.dataTable tbody a:hover {
    color: #aecffa;
}
[data-bs-theme="dark"] table.dataTable tbody tr {
    border-bottom-color: var(--tblr-border-color);
}
[data-bs-theme="dark"] table.dataTable tbody tr:hover > td {
    background-color: #323848 !important;
}
/* Child/detail rows */
[data-bs-theme="dark"] table.dataTable tbody tr.child td,
[data-bs-theme="dark"] table.dataTable tbody tr.dt-hasChild + tr td {
    background: rgba(255,255,255,0.03);
    color: var(--tblr-body-color);
}
/* Sort arrows */
[data-bs-theme="dark"] table.dataTable thead .sorting::after {
    border-top-color: #6c7a8d;
}
[data-bs-theme="dark"] table.dataTable thead .sorting_asc::after {
    border-bottom-color: #7eb3f5;
}
[data-bs-theme="dark"] table.dataTable thead .sorting_desc::after {
    border-top-color: #7eb3f5;
}
/* Top-controls border */
[data-bs-theme="dark"] .dataTables_wrapper > .row:first-child,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter + .dataTables_scroll {
    border-bottom-color: var(--tblr-border-color);
}
/* Search input + length select */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: var(--tblr-bg-surface);
    color: var(--tblr-body-color);
    border-color: var(--tblr-border-color);
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input:focus,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select:focus {
    border-color: #7eb3f5;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter label,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length label,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: var(--tblr-secondary-color, #8899aa);
}
/* Bottom border */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate {
    border-top-color: var(--tblr-border-color);
}
/* Pagination buttons */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--tblr-body-color) !important;
    background: transparent;
    border-color: var(--tblr-border-color);
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--tblr-border-color);
    color: #7eb3f5 !important;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #206bc4;
    border-color: #206bc4;
    color: #fff !important;
}
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #4a5568 !important;
}

/* ── Global dark mode text lightening ───────────────────────────────────────
   Tabler's default dark body-color (~#c8cfe0) is too muted for body copy.
   Override to a near-white so paragraphs, labels, and card text are crisp.
   .text-secondary stays intentionally dimmer — only raw body copy is lifted.
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"] {
    --tblr-body-color: #dde4ef;
}
[data-bs-theme="dark"] p,
[data-bs-theme="dark"] li,
[data-bs-theme="dark"] .card-text,
[data-bs-theme="dark"] .page-body,
[data-bs-theme="dark"] label:not(.form-check-label) {
    color: #dde4ef;
}

/* ── Gradient card utility ────────────────────────────────────────────────────
   Add class="card-gradient" to any .card to apply a top-coloured ambient wash
   fading to transparent. Colour adapts per theme via overrides in each
   theme-*.css file. Dark themes use their primary colour at low opacity.
   -------------------------------------------------------------------------- */
.card-gradient {
    background: linear-gradient(to bottom, rgba(147,197,253,.30) 0%, transparent 100%) !important;
    border-color: rgba(147,197,253,.45) !important;
}

/* Generic dark-mode fallback (plain dark, no colour theme) */
[data-bs-theme="dark"] .card-gradient {
    background: linear-gradient(to bottom, rgba(var(--tblr-primary-rgb),.18) 0%, transparent 100%) !important;
    border-color: rgba(var(--tblr-primary-rgb),.28) !important;
}

