/* Legacy questionnaire look (no Bootstrap/jQuery). Deliberate deviation: the checked toggle
   uses the brand blue, not the Bootstrap #007bff the old app inherited by accident. */

* { box-sizing: border-box; }

:root {
    --brand-blue: #2c4694;
    --brand-blue-hover: #3b5998;
    --brand-red: #d10019;
    --myGray: rgb(212, 212, 212);
    --label-gray: #999999;
}

html { font-size: 16px; }

body {
    margin: 0;
    font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #212529;
    background: #fff;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    color: var(--brand-blue);
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}

a:hover { color: var(--brand-red); text-decoration: none; }

/* Header / footer (legacy: centered logo + red title + language buttons) */
header.page-header {
    margin-top: 2rem;
    margin-bottom: 2rem;
    position: relative;
}

/* The asset is a @2x bitmap (867x292) — render at half its natural size. */
header.page-header img.logo {
    display: block;
    margin: 0 auto 1rem;
    width: 433px;
    max-width: 90%;
    height: auto;
}

header.page-header h3.title {
    text-align: center;
    color: var(--brand-red);
    font-size: 1.75rem;
    font-weight: 500;
    margin: 0 0 0.5rem;
}

/* Legacy header: buttons flow left-aligned under the centered logo/title. */
header.page-header nav { text-align: left; }

.flag {
    display: inline-block;
    position: relative;
    width: 16px;
    height: 11px;
    background: url('../img/flags.png') no-repeat;
}

.flag.flag-cz { background-position: -16px -33px; }
.flag.flag-gb { background-position: -112px -44px; }

footer.page-footer {
    color: #6c757d;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Buttons (legacy common.css) */
button, input[type=submit], input[type=button] {
    text-transform: uppercase;
    background-color: var(--brand-blue);
    border-radius: 5px;
    border: 3px solid var(--brand-blue);
    border-style: none none solid;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 8px 6px 0px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    padding: 0.45rem 1rem;
    font-family: inherit;
}

button:hover, input[type=submit]:hover, input[type=button]:hover {
    border-color: var(--brand-blue-hover);
    background-color: var(--brand-blue-hover);
}

button.clear { background-color: var(--brand-red) !important; }

.buttonSend { padding: 0.6rem 2.5rem; }
.submit-row { margin: 1.5rem 0 0.5rem; text-align: left; }

/* Section boxes (legacy .border-red / .border-white) */
.border-red, .border-white {
    padding: 30px;
    padding-bottom: 10px;
    width: 100%;
    margin-bottom: 10px;
}

.border-red { border: 1px solid var(--brand-red); }
.border-white { border: 1px solid #fff; }

h2.section-title {
    font-size: 1.1rem;
    color: var(--brand-blue);
    margin: 0 0 1.25rem;
}

/* Form controls + floating labels (legacy .custom-placeholder) */
.form-group { margin-bottom: 2rem; width: 100%; }

.form-control {
    display: block;
    width: 100%;
    /* Explicit height: text inputs, date inputs and native selects each compute their own
       box from padding alone, which left selects visibly flatter (bug 5429 retest). */
    height: calc(1.5em + 1rem + 2px);
    padding: 0.5rem 0.75rem;
    font-size: 17px;
    font-family: inherit;
    line-height: 1.5;
    color: #495057;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 0.15rem rgba(44, 70, 148, 0.2);
}

.form-control:disabled, .form-control[readonly] { background-color: #e9ecef; }

/* The floated label sits fully above the input's top edge — reserve that space so
   it never collides with whatever sits above the field. */
.custom-placeholder { position: relative; margin-top: 1rem; }

.label-div {
    display: inline-flex;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    padding: 0 0.8rem;
    margin-bottom: 0;
    transition: all 0.2s;
    max-width: 100%;
    height: 100%;
    font-size: 17px;
    line-height: 1.2;
    pointer-events: none;
    color: var(--label-gray);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.label-div > label { margin: 0; }

/* Floated label state — on focus, when filled, and always for selects/dates. Deviation from the
   legacy -65% transform (bug 5429): lift the label fully above the field with a small gap so it
   never sticks to the input's border/value. */
.form-control:focus + .label-div,
.form-control:not(:placeholder-shown) + .label-div,
.custom-placeholder.always-float .label-div,
.custom-placeholder > input:disabled + .label-div {
    height: auto;
    padding: 0.25rem 0.5rem 0.4rem;
    background-color: rgba(0, 0, 0, 0);
    transform: translate3d(0.75rem, -100%, 0);
    margin-left: -1.1rem;
    font-size: 17px;
    max-width: 90%;
    color: var(--brand-blue);
}

.required { color: var(--brand-red); }

/* Toggle switches (legacy toggleSwitch.css, unified to brand blue) */
.text-for-check {
    width: calc(100% - 95px);
    float: left;
    display: block;
    margin: 0 0 0.5rem;
}

.toggle {
    --width: 80px;
    --height: calc(var(--width) / 3);
    position: relative;
    display: inline-block;
    width: var(--width);
    height: var(--height);
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3);
    border-radius: var(--height);
    cursor: pointer;
    float: right;
    background: none;
    border: none;
    padding: 0;
    text-transform: none;
}

.toggle input { display: none; }

.toggle .slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--height);
    background-color: #ccc;
    transition: all 0.4s ease-in-out;
}

.toggle .slider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: var(--height);
    height: var(--height);
    border-radius: calc(var(--height) / 2);
    background-color: #fff;
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease-in-out;
}

.toggle input:checked + .slider { background-color: var(--brand-blue); }

.toggle input:checked + .slider::before {
    transform: translateX(calc(var(--width) - var(--height)));
}

.toggle .labels {
    position: absolute;
    top: 2px;
    left: 8px;
    width: 100%;
    height: 100%;
    font-size: 14px;
    transition: all 0.4s ease-in-out;
}

.toggle .labels::after {
    content: attr(data-off);
    position: absolute;
    right: 22px;
    color: #4d4d4d;
    opacity: 1;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    transition: all 0.4s ease-in-out;
}

.toggle .labels::before {
    content: attr(data-on);
    position: absolute;
    left: 5px;
    color: #ffffff;
    opacity: 0;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.4);
    transition: all 0.4s ease-in-out;
}

.toggle input:checked ~ .labels::after { opacity: 0; }
.toggle input:checked ~ .labels::before { opacity: 1; }

.toggle-group { width: 100%; overflow: hidden; margin-bottom: 1.25rem; }
.toggle-target { margin: 0.5rem 0 1.5rem; clear: both; }

/* Notification contacts: the toggle row doubles as the field label, so the revealed input
   hugs it the way floated labels hug their inputs elsewhere */
.toggle-group.contact-label { margin-bottom: 0.25rem; }
.toggle-group.contact-label .text-for-check { margin-bottom: 0; }
.toggle-target.contact-field { margin-top: 0; }

/* Plain checkbox rows (self-payer, designated-person options in legacy style stay toggles) */
.selfPayerLabel { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; font-size: 0.9rem; font-weight: 400; }
#selfPayerCheck { width: 15px; height: 15px; }

/* Field layout: legacy stacks every field full-width, one per row; ---------------
   only the address blocks sit four-in-a-row (legacy table.adress). */
.address-row { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.address-row .form-group { flex: 1 1 200px; }

.address-title { color: var(--brand-blue); font-size: 1rem; margin: 0 0 1rem; }

/* "Copy from notification" button gets its own reserved strip above the input so it never
   overlaps the toggle switch above it. */
.copy-row { position: relative; padding-top: 2rem; }
.copy-row .copy-btn { position: absolute; top: 0; right: 0; font-size: 11px; padding: 0.25rem 0.5rem; }

/* Validation */
.validation-summary { color: var(--brand-red); margin-bottom: 1rem; }
.validation-summary ul { margin: 0; padding-left: 1.2rem; }
.text-danger, .field-validation-error { display: block; color: var(--brand-red); font-size: 0.85rem; margin-top: 0.2rem; }
.input-validation-error { border-color: var(--brand-red); }

/* GDPR text */
.gdpr p { font-size: 0.9rem; }
.gdpr-small { font-size: 0.78rem; color: #555; }

/* Signature (legacy #largeSigpad look) */
#signaturePrev {
    margin-top: 10px;
    background-color: var(--myGray);
    display: block;
}

.signature-modal {
    position: fixed;
    inset: 0;
    background: rgba(212, 212, 212, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.signature-modal[hidden] { display: none; }

.signature-modal-content {
    background: #fff;
    border: 1px solid var(--myGray);
    border-radius: 5px;
    padding: 0.5rem;
    width: min(90vw, 700px);
    max-width: 95vw;
}

.signature-modal-title {
    display: block;
    width: 80%;
    margin: 0 auto 5px;
    padding-left: 10px;
    text-align: center;
    border-bottom: 1px solid black;
    font-size: 0.95rem;
}

#signatureCanvas {
    display: block;
    width: 100%;
    border-top: 1px solid var(--myGray);
    border-bottom: 1px solid var(--myGray);
    background: #fff;
    touch-action: none;
}

.signature-buttons {
    margin-top: 5px;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.signature-buttons .spacer { flex: 1; }

body.modal-open { overflow: hidden; }

/* Pages */
.thanks { text-align: center; padding: 3rem 1rem; }

/* Mobile (legacy breakpoints) */
@media only screen and (max-width: 1000px) {
    header.page-header nav button { display: block; margin: 0 auto 4px; }
    .address-row { display: block; }
}

@media only screen and (max-width: 576px) {
    .border-red, .border-white { padding: 18px; padding-bottom: 8px; }
    .text-for-check { width: 100%; float: none; }
    .toggle { float: left; margin-bottom: 0.5rem; }
}
