/*
 * Ported from suma-payments' resources/views/layouts/checkout.blade.php
 * rather than re-picked: this page is the FIRST leg of the same
 * journey that continues on suma-payments' hosted checkout (a payer
 * fills this in, is handed off there, and — for most methods — never
 * comes back here again) — same reasoning as that layout's own
 * docblock, "a payer should not be able to tell they left".
 */
:root {
    --orange: #ff8000;
    --page-bg: #fafafa;
    --card-bg: #ffffff;
    --well-bg: #ececec;
    --text: #000000;
    --text-muted: #595959;
    --border: #cccccc;
    --link: #0066cc;
    --link-hover: #004b99;
    --error: #a94442;
    --error-bg: #fdf0f0;
    --focus-ring: #0066cc;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --orange: #cc6600;
        --page-bg: #1a1a1a;
        --card-bg: #404040;
        --well-bg: #333333;
        --text: #e6e6e6;
        --text-muted: #b3b3b3;
        --border: #727272;
        --link: #cc6600;
        --link-hover: #ff8000;
        --error: #ff9f9a;
        --error-bg: #3a2422;
        --focus-ring: #ff8000;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --orange: #cc6600;
    --page-bg: #1a1a1a;
    --card-bg: #404040;
    --well-bg: #333333;
    --text: #e6e6e6;
    --text-muted: #b3b3b3;
    --border: #727272;
    --link: #cc6600;
    --link-hover: #ff8000;
    --error: #ff9f9a;
    --error-bg: #3a2422;
    --focus-ring: #ff8000;
    color-scheme: dark;
}

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

body {
    margin: 0;
    padding: 0 1rem 3rem;
    background: var(--page-bg);
    color: var(--text);
    font-family: "Liberation Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
}

.masthead { max-width: 40rem; margin: 0 auto; padding: 1.75rem 0 1.25rem; }
.masthead img { display: block; height: 1.75rem; width: auto; }

main {
    max-width: 40rem;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: 3px solid var(--orange);
    border-radius: 0.75rem;
    padding: 1.75rem 1.5rem 2rem;
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 0.75rem; }
h2 { font-size: 1.05rem; margin: 2rem 0 0.5rem; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
.lede { color: var(--text-muted); }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ── Fieldsets and the person/company toggle ────────────────────── */
fieldset { border: 0; margin: 0; padding: 0; }
legend { padding: 0; font-weight: bold; }

.type-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.75rem 0 1.5rem; list-style: none; padding: 0; }
.type-tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
}
/* Grid rows stretch every tile to the tallest one in the row (e.g.
   "Organisation / Unternehmen" wrapping to two lines) — without the
   flex centering above, a shorter tile's text sits at the top of
   that extra height instead of in the middle of it. The inner
   <label> also needs its own reset: the global `label` rule below
   gives every label a 1.25rem top margin (meant for stacked form
   labels), which — left in place — is itself the box getting
   centered, pushing the tile's actual text down off-center. */
.type-tile label {
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    cursor: pointer;
}
.type-tile input { position: absolute; opacity: 0; pointer-events: none; }
.type-tile:has(input:checked) { border-color: var(--orange); background: var(--well-bg); }
.type-tile:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* Without JS, both field groups always render (server-side
   required_if decides what's actually needed) — .js-toggle-group
   is only ever hidden once app.js confirms JS is present. */
html.js .js-toggle-group[hidden] { display: none; }
html:not(.js) .js-toggle-group { display: block !important; }

/* ── Amount tiles ─────────────────────────────────────────────────── */
.amount-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: 0.6rem; margin: 0.75rem 0; list-style: none; padding: 0; }
.amount-tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.6rem;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
}
/* Same label reset as .type-tile above, same reason. */
.amount-tile label {
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    cursor: pointer;
}
.amount-tile input { position: absolute; opacity: 0; pointer-events: none; }
.amount-tile:has(input:checked) { border-color: var(--orange); background: var(--well-bg); }
.tiles-heading { display: block; margin-top: 1.25rem; font-weight: bold; }

/* ── Progressive disclosure (optional address) ───────────────────── */
details.disclosure { margin-top: 2rem; }
details.disclosure summary {
    font-size: 1.05rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0.25rem 0;
    list-style: none;
}
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure summary::before { content: '+ '; }
details.disclosure[open] summary::before { content: '\2013\0020'; }
details.disclosure summary .hint { margin-left: 0.3rem; }
details.disclosure .disclosure-body > label:first-child { margin-top: 1rem; }

/* ── Forms ─────────────────────────────────────────────────────────── */
label { display: block; margin-top: 1.25rem; font-weight: bold; }
.hint { font-weight: normal; color: var(--text-muted); font-size: 0.85rem; }
label > span.hint { display: block; margin-top: 0.15rem; }
input[type=text], input[type=email], input[type=date], input[type=number], select, textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    margin-top: 0.35rem;
    font: inherit;
    color: var(--text);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); }
input[type=file] { width: 100%; margin-top: 0.35rem; font: inherit; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 30rem) { .field-row { grid-template-columns: 1fr; } }

.consent { display: flex; align-items: start; gap: 0.6rem; margin-top: 1.5rem; }
.consent input { margin-top: 0.35rem; flex: none; cursor: pointer; }
.consent label { margin-top: 0; font-weight: normal; cursor: pointer; }

.field-error {
    display: block;
    color: var(--error);
    font-size: 0.85rem;
    font-weight: normal;
    margin-top: 0.35rem;
}
.field-error[hidden] { display: none; }
.error, .flash--error {
    color: var(--error);
    background: var(--error-bg);
    border-radius: 0.4rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.9rem;
    margin: 0 0 1.25rem;
}
.flash--info {
    background: var(--well-bg);
    border-radius: 0.4rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.9rem;
    margin: 0 0 1.25rem;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
button, .button {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.75rem 1.4rem;
    background: var(--orange);
    color: #000;
    border: 1px solid transparent;
    border-radius: 0.4rem;
    font: inherit;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}
button:hover, .button:hover { filter: brightness(1.08); color: #000; }
.button--quiet { background: transparent; color: var(--link); border-color: var(--border); font-weight: normal; }
.button--quiet:hover { color: var(--link-hover); border-color: var(--text-muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; margin-top: 1.5rem; }
.form-actions button, .form-actions .button { margin-top: 0; }

.summary { background: var(--well-bg); border-radius: 0.5rem; padding: 0.9rem 1.1rem; margin: 1.5rem 0; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0; align-items: baseline; }
.summary dt { color: var(--text-muted); font-size: 0.9rem; }
.summary dd { margin: 0; text-align: right; font-weight: bold; }

.reference {
    display: block;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 1.15rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
    background: var(--well-bg);
    border: 1px dashed var(--border);
    border-radius: 0.4rem;
    padding: 0.7rem 0.9rem;
}

.note { margin-top: 1.5rem; padding: 0.85rem 1.1rem; background: var(--well-bg); border-radius: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.note strong { color: var(--text); }

/* ── Membership-application key section (thanks.blade.php) ───────── */
.key-panel { margin-top: 1.5rem; padding: 1rem 1.1rem; border-radius: 0.5rem; background: var(--well-bg); }
.key-panel h2 { margin-top: 0; }
.key-panel p:last-child { margin-bottom: 0; }
/* The one state where losing this page loses the key for good
   (see thanks.blade.php's own comment on $keyBranch) — given a
   visibly different, harder-to-miss treatment than the plain
   .key-panel used for "nothing to act on" states. */
.key-panel--attention { border: 2px solid var(--orange); }
.key-field label { margin-top: 0.75rem; }
.key-field__row { display: flex; gap: 0.5rem; align-items: stretch; margin-top: 0.35rem; }
/* Overrides .reference's own well-bg background: nested inside
   .key-panel (itself well-bg), the dashed border alone wouldn't
   read clearly against a matching background. */
.key-field__row .reference { flex: 1 1 auto; width: 100%; margin: 0; background: var(--card-bg); }
.key-field__row button { margin-top: 0; flex: none; }
.key-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.key-actions .button { margin-top: 0; }

/* ── Mitgliederportal (public/member_portal/*) ────────────────────── */
.portal-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.portal-head button { margin-top: 0; flex: none; }
.portal-section { margin-top: 2.25rem; }
.portal-section > h2 { margin-top: 0; }
.portal-section .summary { margin-top: 0.75rem; }
.key-panel h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.key-panel + .key-panel { margin-top: 0.75rem; }
.receipt-list { list-style: none; margin: 0; padding: 0; }
.receipt-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.receipt-list li:last-child { border-bottom: 0; }

footer { max-width: 40rem; margin: 1.25rem auto 0; font-size: 0.85rem; color: var(--text-muted); text-align: center; }

.mt-lg { margin-top: 1.5rem; }

@media (max-width: 30rem) {
    main { padding: 1.5rem 1.1rem; border-radius: 0.5rem; }
    h1 { font-size: 1.3rem; }
    .type-tiles { grid-template-columns: 1fr; }
}
