/* Stylesheet for the gematik web contact form.
   Base values follow Spec/form-style.md (copied from another gematik page).
   No Bootstrap dependency — the original --bs-* variables are translated
   into local custom properties below. */

:root {
    --form-body-color: #1d1d1b;
    --form-body-bg: #ffffff;
    --form-muted-color: #5a5a5a;
    --form-border-color: #c4c4c4;
    --form-border-width: 1px;
    --form-border-radius: 4px;
    --form-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    --form-focus-border-color: #004e72;        /* gematik blue */
    --form-focus-shadow: 0 0 0 3px rgba(0, 78, 114, 0.2);
    --form-error-color: #c0322b;
    --form-button-bg: #004e72;                 /* gematik blue */
    --form-button-bg-hover: #003a55;
    --form-link-color: #0000ee;                /* classic browser link blue */
    --form-max-width: 720px;
}

html, body {
    font-family: apercu-bold, sans-serif;
    font-style: normal;
    color: var(--form-body-color);
    background-color: var(--form-body-bg);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

body {
    padding: 1.5rem 1.5rem 0.5rem;
    /* Include the padding within the viewport width so full-width fields
       (e.g. <select>) don't get pushed off-screen on narrow/mobile viewports. */
    box-sizing: border-box;
}

.privacy-notice {
    margin-top: 1rem;
}

/* Visually hide content while keeping it available to screen readers and
   the accessible name computation. Used for <label>s that are now rendered
   inside their fields as placeholders (in-field labels). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Honeypot: visually + accessibly hidden, but still present in the DOM so
   form-filling bots will populate it. BotGuard discards any submission whose
   honeypot field is non-blank. Uses the classic "visually hidden" pattern
   (off-screen + clipped + zero size) to be robust against stacking contexts. */
.honeypot {
    position: absolute !important;
    left: -10000px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    pointer-events: none !important;
}

form {
    max-width: var(--form-max-width);
    margin: 0 auto;
}

form > div,
form > fieldset {
    margin-bottom: 1.25rem;
}

label,
legend {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: #004e72;
}

p {
    margin: 0.25rem 0;
    color: #004e72;
}

/* Per Spec/form-style.md "Input" block, translated from --bs-* to local vars. */
input[type="text"],
input[type="tel"],
input[type="email"],
select,
textarea {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--form-body-color);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--form-body-bg);
    background-clip: padding-box;
    border: var(--form-border-width) solid var(--form-border-color);
    border-radius: var(--form-border-radius);
    box-shadow: var(--form-box-shadow-inset);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    box-sizing: border-box;
}

textarea {
    min-height: 8rem;
    /* Cap the height at ~25 lines (line-height 1.5 + padding); users can resize
       below this and scroll for longer text, but the box won't grow past 25 lines. */
    max-height: calc(25 * 1.5em + 1rem);
    resize: vertical;
}

/* Custom dropdown arrow: the native one is removed by `appearance: none` above, so
   draw a downloaded arrow icon at the right end of every <select>. The extra
   right padding keeps long option labels from running underneath it. */
select {
    background-image: url("/static/arrow-down.png");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.85rem;
    padding-right: 2.25rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--form-focus-border-color);
    box-shadow: var(--form-focus-shadow);
}

/* File upload drop-zone styling */
.file-upload-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.file-drop-zone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.875rem 1.25rem;
    border: var(--form-border-width) solid var(--form-border-color);
    border-radius: var(--form-border-radius);
    /* Match the other form fields: same white background and body text colour. */
    background-color: var(--form-body-bg);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    font-weight: normal;
    margin-bottom: 0;
    color: var(--form-body-color);
    /* Upload icon at the right end, mirroring the <select> dropdown arrow but
       pointing up (arrow-up.png). The right padding keeps the label text from
       running underneath it. */
    background-image: url("/static/arrow-up.png");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 0.85rem;
    padding-right: 2.25rem;
}

.file-drop-zone:hover {
    border-color: var(--form-focus-border-color);
    background-color: rgba(0, 78, 114, 0.04);
}

.file-drop-zone:focus-within {
    border-color: var(--form-focus-border-color);
    background-color: rgba(0, 78, 114, 0.04);
    box-shadow: var(--form-focus-shadow);
}

/* Hide the native file input entirely — browsers render its button and
   "No file chosen" text in the user-agent locale (English / French / …),
   which conflicts with the German-only requirement. Clicking the wrapping
   <label class="file-drop-zone"> still opens the picker, and the input
   stays in the tab order (clip + 1×1) so keyboard users can reach it. */
.file-drop-zone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
    opacity: 0;
}

.file-drop-text {
    font-size: 0.9375rem;
}

p.error {
    color: var(--form-error-color);
    font-size: 0.875rem;
    margin-top: 0.375rem;
}

/* Sub-topic dropdown is hidden by default; form-iframe.js reveals it when the
   selected main topic has children (data-haschilds) and filters the options to
   that parent (data-parent). Many top-level topics now have children, which a
   single CSS :has() rule can't express, so the toggle moved to JS. Only affects
   the default form variant: the ERP variant omits the .sub-topic-row class on its
   sub-topic <div>, so it stays visible there (topic is hard-fixed to "erp"). */
.sub-topic-row {
    display: none;
}

.sub-topic-row.is-visible {
    display: block;
}

/* Disabled selects (e.g. fixed topic in ERP variant) */
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button[type="submit"] {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--form-button-bg);
    border: none;
    border-radius: var(--form-border-radius);
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

button[type="submit"]:hover,
button[type="submit"]:focus {
    background-color: var(--form-button-bg-hover);
    outline: none;
}

a {
    color: var(--form-link-color);
}

h1 {
    font-size: 1.5rem;
    margin: 0 0 1rem 0;
}
