/* ==========================================================================
   Shared stylesheet for both public forms (Widerruf + Kündigung).
   Loaded by resources/views/master.blade.php for whichever form APP_NAME
   selects. Replaces the former widerruf.css, cancel-subscription.css and
   footer.css.
   ========================================================================== */

/* nunito-regular - latin */
@font-face {
    font-family: 'Nunito';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/nunito-v24-latin-regular.woff2') format('woff2'),
         url('../fonts/nunito-v24-latin-regular.woff') format('woff'),
         url('../fonts/nunito-v24-latin-regular.ttf') format('truetype');
}

/* --------------------------------------------------------------------------
   Design tokens - adjust these rather than the rules below
   -------------------------------------------------------------------------- */
:root {
    --brand: #009be1;
    --brand-dark: #007cb4;
    --brand-line: #009CDD; /* header accent, matches ebnermedia.de */

    --header-border-width: 1px;
    --page-width: 1280px;   /* header + footer content cap */
    --header-height: 80px;

    --text: #1a1a1a;
    --text-muted: #555;

    --field-border: #ccc;
    --field-border-hover: #999;
    --field-bg: #fff;
    --field-radius: 4px;
    --field-height: 46px;
    --field-padding-x: 0.875rem;
    --field-font-size: 1rem;

    --error: #c62828;
    --error-bg: #fdecea;

    --success: #2e7d32;
    --success-bg: #e8f5e9;

    --gap: 1.25rem;
    --content-width: 720px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
}

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

body {
    background-color: #fff;
    color: var(--text);
    font-size: 1rem;
    font-family: 'Nunito', sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    line-height: inherit;
    text-decoration: none;
}

h1 {
    margin-bottom: 0.5rem;
}

h2 {
    margin-bottom: 1rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.red-color {
    color: var(--error);
}

.text-center {
    text-align: center;
    margin: 0.2rem 0;
}

/* --------------------------------------------------------------------------
   Header + language switcher
   -------------------------------------------------------------------------- */
.header {
    border-bottom: var(--header-border-width) solid var(--brand-line);
    width: 100%;
}

/* Border spans the full viewport; the contents inside stay centred and capped. */
.header__inner {
    max-width: var(--page-width);
    min-height: var(--header-height);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header .img {
    /* content-box so the inline height/width in header.blade.php describe the
       image itself, not the box including this padding. */
    box-sizing: content-box;
    padding: 0 1rem;
}

.lang-switcher {
    display: flex;
    gap: 0.25rem;
    padding: 0 1rem;
}

.lang-switcher__link {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--field-radius);
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lang-switcher__link:hover {
    color: var(--brand-line);
    background-color: rgb(0 156 221 / 8%);
    border-color: rgb(0 156 221 / 30%);
}

/* Current language: solid brand pill. Uses the darker brand blue so white
   text clears the AA contrast threshold (4.62:1 vs 3.09:1 on --brand-line). */
.lang-switcher__link--active,
.lang-switcher__link--active:hover {
    color: #fff;
    background-color: var(--brand-dark);
    border-color: var(--brand-dark);
}

.lang-switcher__link:focus-visible {
    outline: 2px solid var(--brand-line);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Page layout
   -------------------------------------------------------------------------- */
main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0 auto;
    max-width: var(--content-width);
    padding: 1.25rem 0 0;
    width: 85%;
}

.content {
    padding: 1rem 0;
    text-align: center;
}

/* Compact contact panel - deliberately left-aligned and tighter than the
   centred intro above it, so it reads as a small aside rather than body copy. */
.contact {
    margin: 1.5rem 0 2rem;
    padding: 0.85rem 1.1rem;
    text-align: left;
    background: #f7f7f7;
    border: 1px solid #e6e6e6;
    border-radius: var(--field-radius);
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.contact__title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.contact p {
    margin: 0;
}

.contact__team {
    color: var(--text);
}

.contact a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.contact a:hover {
    color: var(--brand);
}

.contact a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 2px;
}

.font-margin {
    font-size: 1.2rem;
    margin-top: 1rem;
}

.msg {
    text-align: center;
    margin: 0 auto;
}

.form {
    padding-bottom: 2rem;
    width: 100%;
}

.form > form {
    width: 100%;
}

.required-legend {
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Fields

   Label sits above its control so the boxed inputs get their full width and
   validation messages can sit directly beneath the field they belong to.
   -------------------------------------------------------------------------- */
.input-div {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: var(--gap);
}

.label-text {
    display: block;
    font-size: 1rem;
    line-height: 1.35;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.input-customer,
.input-customer-strasse,
.input-customer-hausnummer,
.input-form,
.input-form-bottom,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
    width: 100%;
    min-height: var(--field-height);
    padding: 0.6rem var(--field-padding-x);
    font-family: 'Nunito', sans-serif;
    font-size: var(--field-font-size);
    color: var(--text);
    background-color: var(--field-bg);
    border: 1px solid var(--field-border);
    border-radius: var(--field-radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    min-height: calc(var(--field-height) * 2);
    padding-top: 0.7rem;
    line-height: 1.45;
    resize: vertical;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23555' d='M4.5 6.5L8 10l3.5-3.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.15rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

.input-customer:hover,
.input-customer-strasse:hover,
.input-customer-hausnummer:hover,
select:hover,
textarea:hover {
    border-color: var(--field-border-hover);
}

/* Obvious focus state - visible for both keyboard and pointer users. */
.input-customer:focus,
.input-customer-strasse:focus,
.input-customer-hausnummer:focus,
.input-form:focus,
.input-form-bottom:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgb(0 155 225 / 25%);
}

/* Street + house number sit on one row on wider screens. */
.input-div.two-col {
    flex-direction: row;
    gap: 1rem;
    align-items: flex-start;
}

.input-col {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
}

.input-col:last-child {
    flex: 0 0 32%;
}

.strasse-label,
.hausnummer-label {
    padding: 0;
    margin-left: 0;
}

/* --------------------------------------------------------------------------
   Validation messages - directly beneath the field they describe
   -------------------------------------------------------------------------- */
.alert {
    display: block;
    position: static;
    margin-top: 0.4rem;
    color: var(--error);
    font-size: 0.875rem;
    line-height: 1.3;
}

/* Turn the offending control red without needing a class on the input. */
.input-div:has(> .alert-danger) > .input-customer,
.input-div:has(> .alert-danger) > select,
.input-div:has(> .alert-danger) > textarea,
.input-col:has(> .alert-danger) > .input-customer-strasse,
.input-col:has(> .alert-danger) > .input-customer-hausnummer {
    border-color: var(--error);
}

.input-div:has(> .alert-danger) > .input-customer:focus,
.input-div:has(> .alert-danger) > select:focus,
.input-div:has(> .alert-danger) > textarea:focus,
.input-col:has(> .alert-danger) > .input-customer-strasse:focus,
.input-col:has(> .alert-danger) > .input-customer-hausnummer:focus {
    box-shadow: 0 0 0 3px rgb(198 40 40 / 20%);
}

/* Flash messages */
.alert-success {
    padding: 1rem;
    color: var(--success);
    background-color: var(--success-bg);
    border: 1px solid currentColor;
    border-radius: var(--field-radius);
    margin: 1rem 0;
}

.alert-fail {
    padding: 1rem;
    color: var(--error);
    background-color: var(--error-bg);
    border: 1px solid currentColor;
    border-radius: var(--field-radius);
    margin: 1rem 0;
}

/* --------------------------------------------------------------------------
   Captcha + submit
   -------------------------------------------------------------------------- */
.captcha {
    margin-top: 1rem;
}

.submit-div {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

button {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    min-height: var(--field-height);
    padding: 0.5rem 1.5rem;
    border-radius: var(--field-radius);
    border: 2px solid var(--brand);
    background: transparent;
    color: var(--brand);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

button:hover {
    background-color: var(--brand);
    color: #fff;
}

button:focus-visible {
    outline: 2px solid var(--brand-dark);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Loader
   -------------------------------------------------------------------------- */
.loader {
    display: none;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--brand);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer {
    padding: 1rem;
    margin-top: 1.875rem;
    background: #e3e3e3;
    color: #666;
}

footer ul {
    list-style-type: none;
    max-width: var(--page-width);
    margin: 0 auto;
}

footer ul li a {
    padding: 0.5rem 0;
    display: block;
    color: var(--text-muted);
    border-bottom: 1px solid #c4c4c4;
    text-decoration: none;
}

footer ul li:last-child {
    border-right: none;
}

@media only screen and (min-width: 760px) {
    /* Flex moved from <footer> to the list so the grey band still spans the
       viewport while the links stay inside the same column as the header. */
    footer ul {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding: 0 1rem;
    }

    footer ul li:first-child {
        padding-left: 0;
    }

    footer ul li {
        padding: 0 0.625rem;
        border-right: 1px solid #c3c3c3;
    }

    footer ul li:last-child {
        padding-right: 0;
        border-right: none;
    }

    footer ul li a {
        border: none;
        padding: 0;
        display: inline-block;
        text-decoration: none;
    }
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */
@media only screen and (max-width: 760px) {
    main {
        width: 100%;
    }

    .content,
    .msg,
    .form {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    h1 {
        margin-top: 1rem;
    }

    .input-div.two-col {
        flex-direction: column;
        gap: 0;
    }

    .input-div.two-col .input-col {
        margin-bottom: var(--gap);
    }

    .input-div.two-col .input-col:last-child {
        flex: 1 1 auto;
        margin-bottom: 0;
    }

    .submit-div {
        justify-content: space-between;
    }
}

/* Rechnungsformular: the fixed "39" shown ahead of the customer number field. */
.input-with-prefix {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-prefix .input-prefix {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f2f2f2;
    color: #555;
}

.input-with-prefix .input-customer {
    flex: 1 1 auto;
}

/* Rechnungsformular: the "use this address in future" checkbox and its label sit
   on one line. .label-text is display:block globally, which would otherwise drop
   the label under the box. */
.input-check .label-text {
    display: inline-block;
    margin-bottom: 0;
}

/* Rechnungsformular: the legend sits under the form heading and hint rather than
   above the form, so it needs breathing room on both sides. The base rule is a
   margin shorthand, so top has to be restated here. */
.required-legend--spaced {
    margin-bottom: 1rem;
    margin-top: 1rem;
}
