/**
 * BornData Forening — self-contained frontend styling.
 *
 * The component's site views use a Bootstrap 5 class vocabulary. On templates
 * that ship Bootstrap (e.g. Cassiopeia) they render fine; on templates that do
 * NOT (e.g. Nicepage, which uses its own framework) they would be unstyled.
 * This stylesheet reimplements the exact subset of Bootstrap the views use,
 * scoped under .bd-forening so it never touches the surrounding template. The
 * component wraps its whole output in <div class="bd-forening"> (see
 * DisplayController), and loads this file when config frontend_style = "self".
 *
 * Typography is inherited from the page (font: inherit) so it blends with the
 * active template; only the component's own controls get an opinionated look.
 */

.bd-forening {
    --bd-primary: #0d6efd;
    --bd-primary-hover: #0b5ed7;
    --bd-body: #212529;
    --bd-muted: #6c757d;
    --bd-border: #dee2e6;
    --bd-radius: 0.5rem;
    --bd-radius-sm: 0.375rem;
    --bd-success: #198754;
    --bd-danger: #dc3545;
    --bd-warning: #ffc107;
    --bd-info: #0dcaf0;
    --bd-light: #f8f9fa;
    --bd-gutter: 1.5rem;

    color: var(--bd-body);
    line-height: 1.5;
}

.bd-forening *,
.bd-forening *::before,
.bd-forening *::after {
    box-sizing: border-box;
}

/* --- Grid -------------------------------------------------------------- */
.bd-forening .row {
    display: flex;
    flex-wrap: wrap;
    margin-right: calc(-0.5 * var(--bd-gutter));
    margin-left: calc(-0.5 * var(--bd-gutter));
}

.bd-forening .row > * {
    padding-right: calc(0.5 * var(--bd-gutter));
    padding-left: calc(0.5 * var(--bd-gutter));
    width: 100%;
}

.bd-forening .g-2 { --bd-gutter: 0.5rem; }
.bd-forening .g-3 { --bd-gutter: 1rem; }

.bd-forening .col-6  { flex: 0 0 auto; width: 50%; }
/* Declared before the breakpoints below, so a col-sm-* on the same element
   wins from that width up. Source order decides here: the selectors weigh
   the same. */
.bd-forening .col-12 { flex: 0 0 auto; width: 100%; }

/* Content-width column. Without this the shared `.row > * { width: 100% }`
   rule wins and every field in a filter bar takes a line of its own. */
.bd-forening .col-auto { flex: 0 0 auto; width: auto; }

@media (min-width: 576px) {
    .bd-forening .col-sm-auto { flex: 0 0 auto; width: auto; }
    .bd-forening .col-sm-3 { flex: 0 0 auto; width: 25%; }
    .bd-forening .col-sm-4 { flex: 0 0 auto; width: 33.3333%; }
    .bd-forening .col-sm-5 { flex: 0 0 auto; width: 41.6667%; }
    .bd-forening .col-sm-6 { flex: 0 0 auto; width: 50%; }
    .bd-forening .col-sm-8 { flex: 0 0 auto; width: 66.6667%; }
}

@media (min-width: 768px) {
    .bd-forening .col-md-4 { flex: 0 0 auto; width: 33.3333%; }
    .bd-forening .col-md-6 { flex: 0 0 auto; width: 50%; }
}

@media (min-width: 992px) {
    .bd-forening .col-lg-3 { flex: 0 0 auto; width: 25%; }
    .bd-forening .col-lg-4 { flex: 0 0 auto; width: 33.3333%; }
}

/* --- Flex + sizing utilities ------------------------------------------ */
.bd-forening .d-flex { display: flex; }
.bd-forening .d-inline-flex { display: inline-flex; }
.bd-forening .d-block { display: block; }
.bd-forening .d-inline { display: inline; }
.bd-forening .d-inline-block { display: inline-block; }
.bd-forening .flex-column { flex-direction: column; }
.bd-forening .flex-wrap { flex-wrap: wrap; }
.bd-forening .flex-grow-1 { flex-grow: 1; }
.bd-forening .align-items-center { align-items: center; }
.bd-forening .align-items-end { align-items: flex-end; }
.bd-forening .justify-content-between { justify-content: space-between; }
.bd-forening .justify-content-center { justify-content: center; }
.bd-forening .gap-2 { gap: 0.5rem; }
.bd-forening .h-100 { height: 100%; }
.bd-forening .w-100 { width: 100%; }
.bd-forening .w-50 { width: 50%; }
.bd-forening .w-auto { width: auto; }
.bd-forening .mx-auto { margin-left: auto; margin-right: auto; }

/* --- Spacing (0=0, 1=.25, 2=.5, 3=1, 4=1.5rem) ------------------------ */
.bd-forening .mb-0 { margin-bottom: 0; }
.bd-forening .mb-1 { margin-bottom: 0.25rem; }
.bd-forening .mb-2 { margin-bottom: 0.5rem; }
.bd-forening .mb-3 { margin-bottom: 1rem; }
.bd-forening .mb-4 { margin-bottom: 1.5rem; }
.bd-forening .mt-1 { margin-top: 0.25rem; }
.bd-forening .mt-2 { margin-top: 0.5rem; }
.bd-forening .mt-3 { margin-top: 1rem; }
.bd-forening .mt-4 { margin-top: 1.5rem; }
.bd-forening .my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.bd-forening .me-1 { margin-right: 0.25rem; }
.bd-forening .me-2 { margin-right: 0.5rem; }
.bd-forening .mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.bd-forening .align-middle { vertical-align: middle; }
.bd-forening .me-3 { margin-right: 1rem; }
.bd-forening .ms-1 { margin-left: 0.25rem; }
.bd-forening .ms-2 { margin-left: 0.5rem; }
.bd-forening .p-2 { padding: 0.5rem; }
.bd-forening .p-3 { padding: 1rem; }
.bd-forening .pt-3 { padding-top: 1rem; }
.bd-forening .pb-1 { padding-bottom: 0.25rem; }

/* --- Typography ------------------------------------------------------- */
.bd-forening .text-center { text-align: center; }
.bd-forening .text-end { text-align: right; }
/* Colour utilities are !important (as in Bootstrap) so they win over component
   rules such as .badge's default white — otherwise e.g. a "badge bg-light
   text-dark" year pill would render white-on-light and look empty. */
.bd-forening .text-muted { color: var(--bd-muted) !important; }
.bd-forening .text-dark { color: #212529 !important; }
.bd-forening .text-white { color: #fff !important; }
.bd-forening .text-success { color: var(--bd-success) !important; }
.bd-forening .text-uppercase { text-transform: uppercase; }
.bd-forening .fw-bold { font-weight: 700; }
.bd-forening .lead { font-size: 1.25rem; font-weight: 300; }
.bd-forening .small { font-size: 0.875em; }
.bd-forening .h3, .bd-forening .h4, .bd-forening .h5, .bd-forening .h6 {
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}
.bd-forening .h3 { font-size: 1.75rem; }
.bd-forening .h4 { font-size: 1.5rem; }
.bd-forening .h5 { font-size: 1.25rem; }
.bd-forening .h6 { font-size: 1rem; }

/* --- Backgrounds + borders + effects ---------------------------------- */
.bd-forening .bg-white { background-color: #fff !important; }
.bd-forening .bg-light { background-color: var(--bd-light) !important; }
.bd-forening .bg-secondary { background-color: var(--bd-muted) !important; }
.bd-forening .bg-success { background-color: var(--bd-success) !important; }
.bd-forening .bg-danger { background-color: var(--bd-danger) !important; }
.bd-forening .bg-warning { background-color: var(--bd-warning) !important; }
.bd-forening .border { border: 1px solid var(--bd-border); }
.bd-forening .border-top { border-top: 1px solid var(--bd-border); }
.bd-forening .rounded { border-radius: var(--bd-radius-sm); }
.bd-forening .rounded-circle { border-radius: 50%; }
.bd-forening .rounded-pill { border-radius: 50rem; }
.bd-forening .shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); }
.bd-forening .img-fluid { max-width: 100%; height: auto; }
.bd-forening .opacity-75 { opacity: 0.75; }

/* --- Card ------------------------------------------------------------- */
.bd-forening .card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #fff;
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius);
    margin-bottom: 1rem;
}
.bd-forening .card-body { flex: 1 1 auto; padding: 1.25rem; }
.bd-forening .card-header {
    padding: 0.75rem 1.25rem;
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--bd-border);
    border-radius: calc(var(--bd-radius) - 1px) calc(var(--bd-radius) - 1px) 0 0;
    font-weight: 500;
}

/* --- Buttons ---------------------------------------------------------- */
.bd-forening .btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: var(--bd-radius-sm);
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.bd-forening .btn:hover { text-decoration: none; }
.bd-forening .btn-sm { padding: 0.25rem 0.5rem; font-size: 0.875rem; }
.bd-forening .btn-lg { padding: 0.5rem 1rem; font-size: 1.25rem; }

.bd-forening .btn-primary {
    color: #fff;
    background-color: var(--bd-primary);
    border-color: var(--bd-primary);
}
.bd-forening .btn-primary:hover {
    color: #fff;
    background-color: var(--bd-primary-hover);
    border-color: var(--bd-primary-hover);
}
.bd-forening .btn-outline-primary {
    color: var(--bd-primary);
    border-color: var(--bd-primary);
    background-color: transparent;
}
.bd-forening .btn-outline-primary:hover {
    color: #fff;
    background-color: var(--bd-primary);
}
/* The board panel's primary action ("Bekræft modtaget") — without this it
   rendered as the browser's default grey button. */
.bd-forening .btn-success {
    color: #fff;
    background-color: var(--bd-success);
    border-color: var(--bd-success);
}
.bd-forening .btn-success:hover,
.bd-forening .btn-success:focus {
    color: #fff;
    background-color: #157347;
    border-color: #146c43;
}

.bd-forening .btn-outline-secondary {
    color: var(--bd-muted);
    border-color: var(--bd-muted);
    background-color: transparent;
}
.bd-forening .btn-outline-secondary:hover {
    color: #fff;
    background-color: var(--bd-muted);
}
.bd-forening .btn-outline-danger {
    color: var(--bd-danger);
    border-color: var(--bd-danger);
    background-color: transparent;
}
.bd-forening .btn-outline-danger:hover {
    color: #fff;
    background-color: var(--bd-danger);
}

/* --- Badges ----------------------------------------------------------- */
.bd-forening .badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--bd-radius-sm);
}
.bd-forening .badge.bg-warning { color: #000; }

/* --- Alerts ----------------------------------------------------------- */
.bd-forening .alert {
    position: relative;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--bd-radius-sm);
}
.bd-forening .alert-link { font-weight: 700; }
.bd-forening .alert-success { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; }
.bd-forening .alert-info    { color: #055160; background-color: #cff4fc; border-color: #b6effb; }
.bd-forening .alert-warning { color: #664d03; background-color: #fff3cd; border-color: #ffecb5; }
.bd-forening .alert-danger  { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
.bd-forening .alert-secondary { color: #41464b; background-color: #e2e3e5; border-color: #d3d6d8; }

/* --- List group ------------------------------------------------------- */
.bd-forening .list-group {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
    border-radius: var(--bd-radius-sm);
}
.bd-forening .list-group-item {
    position: relative;
    display: block;
    padding: 0.75rem 1.25rem;
    background-color: #fff;
    border: 1px solid var(--bd-border);
}
.bd-forening .list-group-item + .list-group-item { border-top-width: 0; }
/* Flush variant: the list fills its card, so only the dividers show. */
.bd-forening .list-group-flush { border-radius: 0; }
.bd-forening .list-group-flush > .list-group-item {
    border-width: 0 0 1px;
    border-radius: 0;
}
.bd-forening .list-group-flush > .list-group-item:last-child { border-bottom-width: 0; }
.bd-forening .list-group-item:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.bd-forening .list-group-item:last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }

/* --- Inline / unstyled lists ------------------------------------------ */
.bd-forening .list-unstyled { padding-left: 0; list-style: none; }
.bd-forening .list-inline { padding-left: 0; list-style: none; }
.bd-forening .list-inline-item { display: inline-block; }
.bd-forening .list-inline-item:not(:last-child) { margin-right: 0.5rem; }

/* --- Tables ----------------------------------------------------------- */
.bd-forening .table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
    vertical-align: top;
}
.bd-forening .table > :not(caption) > * > * {
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid var(--bd-border);
}
.bd-forening .table-sm > :not(caption) > * > * { padding: 0.45rem 0.6rem; }
.bd-forening .table-light th, .bd-forening .table-light td { background-color: var(--bd-light); }

/* A quieter, more current table: the header reads as a label row rather than
   bold body text, rows separate with hairlines instead of a full grid, and the
   row under the cursor lifts slightly so the eye can track across wide rows. */
.bd-forening .table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    color: var(--bd-muted);
    /* Headings must wrap. Uppercase words like "MEDLEMSNUMMER" are wider than
       the data beneath them, so a heading that cannot break sets the column
       width and pushes a table with many columns into needless sideways
       scrolling. Letting them break over two lines costs a little height and
       saves a lot of width. */
    /* Wrap at spaces, so "Sidst logget ind" takes two lines instead of setting
       the column width. Deliberately not "anywhere": that also breaks inside
       words, and a heading reading "MEDLE MSNUM MER" is a worse outcome than a
       scrollbar. A single long word may still push a narrow screen into
       scrolling, which is what the scroll box is there for. */
    white-space: normal;
    overflow-wrap: break-word;
}
.bd-forening .table > thead > tr > th {
    border-bottom: 2px solid var(--bd-border);
    background: transparent;
}
.bd-forening .table > tbody > tr:last-child > * { border-bottom: 0; }
.bd-forening .table > tbody > tr {
    transition: background-color 0.12s ease-in-out;
}
.bd-forening .table > tbody > tr:hover { background-color: var(--bd-light); }
.bd-forening .table td { vertical-align: middle; }

/* Wide tables scroll inside their own box; the page itself never does. The
   templates already ask for this class — it simply did not exist here. */
.bd-forening .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* The table sits on its own surface, so a long list reads as one object even
   on a template with a busy background. */
.bd-forening .borndata-table-card {
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius);
    background: #fff;
    overflow: hidden;
}
.bd-forening .borndata-table-card > .table-responsive > .table { margin-bottom: 0; }

/* --- Filter bar -------------------------------------------------------- */
/* Fields size to their content and wrap as the width allows, so narrowing a
   list looks like a toolbar instead of a stack of full-width form rows. */
.bd-forening .borndata-filters {
    align-items: end;
    padding: 0.85rem;
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius);
    background: var(--bd-light);
}
.bd-forening .borndata-filters .form-label {
    margin-bottom: 0.2rem;
    font-size: 0.8125rem;
    color: var(--bd-muted);
}
.bd-forening .borndata-filters .form-control,
.bd-forening .borndata-filters .form-select {
    min-width: 11rem;
}
.bd-forening .borndata-filters input[type="search"] { min-width: 15rem; }
.bd-forening .borndata-filters input[type="number"] { min-width: 5.5rem; }

@media (max-width: 575.98px) {
    /* One field per line is right on a phone — but then let each fill it. */
    .bd-forening .borndata-filters .form-control,
    .bd-forening .borndata-filters .form-select,
    .bd-forening .borndata-filters input[type="search"] {
        min-width: 0;
        width: 100%;
    }
}

/* --- Member detail row ------------------------------------------------- */
/* Opening a member drops a panel under their row, so the answer to "is this
   the right person" sits directly beneath the name being questioned. */
.bd-forening .bd-member-toggle {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--bd-border);
    /* Keeps the chevron on the name's line instead of dropping below it. */
    white-space: nowrap;
}
.bd-forening .bd-member-toggle:hover { color: var(--bd-primary); }
.bd-forening .bd-member-toggle::after {
    content: "\203A";
    display: inline-block;
    margin-left: 0.4rem;
    color: var(--bd-muted);
    transform: rotate(90deg);
    transition: transform 0.15s ease-in-out;
}
.bd-forening .bd-member-toggle[aria-expanded="true"]::after { transform: rotate(-90deg); }

.bd-forening .bd-member-detail > td {
    background: var(--bd-light);
    box-shadow: inset 0 3px 0 -1px var(--bd-primary);
}
.bd-forening .bd-member-detail-box { padding: 0.35rem 0.25rem; }
.bd-forening .bd-member-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    margin: 0;
}
.bd-forening .bd-member-facts dt {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--bd-muted);
}
.bd-forening .bd-member-facts dd { margin: 0; }

@media (max-width: 575.98px) {
    .bd-forening .bd-member-facts { grid-template-columns: 1fr; gap: 0 0; }
    .bd-forening .bd-member-facts dd { margin-bottom: 0.5rem; }
}

/* --- Card scanner ------------------------------------------------------ */
/* The answer has to be readable at arm's length, by someone holding a phone
   in one hand and a queue in front of them. Colour carries it, but never
   alone: the words say the same thing for anyone who cannot use the colour. */
.bd-forening .bd-scan-result {
    padding: 1rem;
    border-radius: var(--bd-radius);
    margin-bottom: 1rem;
    color: #fff;
}
.bd-forening .bd-scan-result.is-ok { background: var(--bd-success); }
.bd-forening .bd-scan-result.is-repeat { background: var(--bd-warning); color: #212529; }
.bd-forening .bd-scan-result.is-expired { background: var(--bd-danger); }
.bd-forening .bd-scan-result.is-unknown { background: var(--bd-muted); }
.bd-forening .bd-scan-message { font-size: 1.25rem; font-weight: 600; }
.bd-forening .bd-scan-name { font-size: 1.5rem; margin-top: 0.25rem; }
.bd-forening .bd-scan-meta { opacity: 0.85; }

.bd-forening .bd-scan-stage video {
    width: 100%;
    max-width: 22rem;
    border-radius: var(--bd-radius);
    background: #000;
}

/* The who-pays tally: quiet links that read as one sentence. */
.bd-forening .borndata-tally a {
    color: var(--bd-muted);
    text-decoration: none;
    border-bottom: 1px dotted var(--bd-border);
}
.bd-forening .borndata-tally a:hover {
    color: var(--bd-primary);
    border-bottom-color: currentColor;
}

/* --- Forms ------------------------------------------------------------ */
.bd-forening .form-label { margin-bottom: 0.5rem; display: inline-block; }
.bd-forening .form-text {
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--bd-muted);
}
.bd-forening .form-control,
.bd-forening .form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--bd-body);
    background-color: #fff;
    border: 1px solid var(--bd-border);
    border-radius: var(--bd-radius-sm);
    appearance: none;
}
.bd-forening .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.25rem;
}
.bd-forening .form-control-sm { padding: 0.25rem 0.5rem; font-size: 0.875rem; }
.bd-forening .form-control:focus,
.bd-forening .form-select:focus {
    border-color: var(--bd-primary);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.bd-forening .form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5em;
    margin-bottom: 0.125rem;
}
.bd-forening .form-check-input {
    float: left;
    margin-left: -1.5em;
    width: 1em;
    height: 1em;
    margin-top: 0.25em;
    vertical-align: top;
}
.bd-forening .form-check-label { display: inline-block; }
.bd-forening .input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}
.bd-forening .input-group > .form-control,
.bd-forening .input-group > .form-select { flex: 1 1 auto; width: 1%; }

/* --- Required marker + validation ------------------------------------- */
.bd-forening .required label::after,
.bd-forening label.required::after {
    content: " *";
    color: var(--bd-danger);
}

/* --- Accessibility (WCAG) --------------------------------------------- */
/* Keyboard users must always see where they are. Inputs already had a focus
   ring; buttons, links, summaries and checkboxes had none — the biggest gap
   for members who navigate without a mouse or with a screen reader. Uses
   :focus-visible so mouse clicks stay clean. */
.bd-forening a:focus-visible,
.bd-forening .btn:focus-visible,
.bd-forening button:focus-visible,
.bd-forening summary:focus-visible,
.bd-forening .form-check-input:focus-visible,
.bd-forening .form-control:focus-visible,
.bd-forening .form-select:focus-visible,
.bd-forening [tabindex]:focus-visible {
    outline: 3px solid var(--bd-primary);
    outline-offset: 2px;
    box-shadow: none;
}

/* Comfortable tap targets on touch (WCAG 2.5.8): buttons and inputs reach
   44px without changing their look on desktop. */
@media (pointer: coarse) {
    .bd-forening .btn,
    .bd-forening .form-control,
    .bd-forening .form-select {
        min-height: 2.75rem;
    }
    .bd-forening .btn-sm { min-height: 2.5rem; }
    .bd-forening .form-check-input { width: 1.25em; height: 1.25em; }
}

/* Respect the OS "reduce motion" setting: no transitions at all. */
@media (prefers-reduced-motion: reduce) {
    .bd-forening *,
    .bd-forening *::before,
    .bd-forening *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Never rely on colour alone: status badges keep their text (they do), and
   the required-marker is a character, not just red. */
.bd-forening .badge { line-height: 1.2; }

/* --- Print ------------------------------------------------------------ */
@media print {
    .bd-forening .no-print { display: none !important; }
}
