@import url("portalbasictheme.css");

:root {
    /* Theme tokens */
    /*--background: #F8F8F8;*/
    --background: var(--portalThemeColor7);
    --field-background: var(--portalThemeColor7);
    --text: #111827;
    --accent: #e00909;
    --outline: #707070;
    /* brand / focus color */
    --accent-contrast: #ffffff;
    /* text on accent */
    --error: #707070;
    --radius: 0;
    --gap: 1rem;
    --field-h: 32px;
    /* input height */
    --border-color: rgb(112, 112, 112);
    --padding-top: .7rem;
    --font: Helvetica;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    line-height: 1;
    margin: 0;
}

/* ---------- Page layout (flex) ---------- */
.header {
    text-align: center;
}

.header p {
    text-align: center;
}

.divBlockLayout {
    display: flex !important;
    flex-wrap: wrap !important;
    margin: 0 !important;
    min-height: auto !important;
    padding: 8px !important;
    justify-content: center !important;
}

.divBlockContainer {
  padding: 32px !important;
  display: flex !important;
  flex-wrap: wrap !important;
}

.mainForm {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /*max-width: 768px;*/
    max-width: 600px;
    align-items: flex-start;
    background-color: var(--background);
}

.mainForm .section {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    justify-content: center;
}

.mainForm .section h4 {
    margin-bottom: 0px;
    margin-top: 0px;
    width: 100%;
}

/* Controls (shared look) */
.mainForm input[type="text"],
.mainForm input[type="email"],
.mainForm input[type="date"],
.mainForm input[type="file"],
.mainForm select,
.mainForm textarea {
    background: var(--field-background);
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    min-height: var(--field-h);
    padding: 0 .5rem;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    width: 100%;
}

.mainForm textarea {
    /*min-height: var(--field-h);*/
    padding-top: .5rem;
    resize: vertical;
}

.mainForm input[type="checkbox"] {
    margin: 0px;
    zoom: 1.4;
}

/* Focus ring */
.mainForm :is(input, select, textarea):focus {
    border-bottom: 1px solid red;
    outline: 1px dotted var(--outline);
}

/* show a required asterisk for any field block marked with data-required */
.mainForm [data-required] label::after {
    content: " *";
    color: red;
    margin-left: .18rem;
    font-weight: 400 !important;
    font-size: .75rem;
    line-height: 1;
    pointer-events: none;
}

/* Each row uses standard flex with wrapping */
.mainForm .divrow {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0;
    flex: 1 1 auto;
    width: 100%;
}

/* Field blocks */
.checkFormFieldBlock,
.textFormFieldBlock,
.dateFormFieldBlock,
.optionSetFormFieldBlock,
.fileFormFieldBlock {
    position: relative;
    /*flex: 1 1 256px;*/
    flex: 1 1 192px;
}

.checkFormFieldBlock {
    align-items: center;
    display: inline-flex;
    min-width: 100%;
}

.dateFormFieldBlock input[type="date"]:not(:focus):invalid {
    color: transparent;
}

.dateFormFieldBlock input[type="date"]:valid {
    color: #000000;
}

/* ---------- Floating labels using :has() ---------- */

/* Default label sits inside the field */
label {
    font-family: var(--font);
    font-weight: 400 !important;
    position: absolute;
    left: 0;
    top: .5rem;
    /* sits over the control text line */
    background: transparent;
    /* becomes solid when floated */
    color: #707070;
    pointer-events: none;
    line-height: 1;
    transition: top .18s ease, font-size .18s ease, color .18s ease, background-color .18s ease, padding .18s ease;
}

/* Float when the field is focused or has content/selection */
.textFormFieldBlock:has(> :is(input, textarea):focus) label,
.textFormFieldBlock:has(> :is(input, textarea):not(:placeholder-shown)) label,
.dateFormFieldBlock:has(> input:focus) label,
.dateFormFieldBlock:has(> input:valid) label,
/* date becomes valid once a value is picked */
.optionSetFormFieldBlock:has(> select:focus) label,
.optionSetFormFieldBlock:has(> select:valid) label,
/* required select + empty option = invalid until chosen */
.fileFormFieldBlock:has(> input[type="file"]) label {
    /* keep label floated for file inputs */
    top: -.75rem;
    font-size: .75rem;
    background: transparent;
}

/* File inputs need a touch more room for the floated label */
.fileFormFieldBlock input[type="file"] {
    padding-top: .5rem;
}

.checkbox {
    margin-left: 10px;
    text-align: left;
    position: initial;
    line-height: 1;
    transition: none;
    color: #000000;
    pointer-events: auto;
}

.is-hidden {
    display: none !important;
}

/* ---------- Button ---------- */
.submitButton {
    color: var(--accent-contrast);
    background-color: #da291c;
    text-decoration: none;
    border: none;
    font-weight: 400 !important;
    padding: 12px 24px;
    cursor: pointer;
}

.submitButton:hover {
    filter: brightness(1.2);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .mainForm {
        flex-direction: column;
    }
}

@media (max-width: 520px) {

    .textFormFieldBlock,
    .dateFormFieldBlock,
    .optionSetFormFieldBlock,
    .fileFormFieldBlock {
        min-width: 100%;
    }
}

/* ---------- Fallback (no :has support) ----------
   If a browser lacks :has(), labels become standard block labels */
@supports not selector(:has(*)) {
    label {
        position: static;
        display: block;
        margin: .35rem 0 .25rem;
        font-size: .75rem;
        background: transparent;
        font-weight: 400 !important;
    }

    .mainForm :is(input, select, textarea) {
        padding-top: .6rem;
    }
}

/* Change the white to any color */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
}

::-webkit-file-upload-button,
::file-selector-button {
    display: none;
}