/* Inloggen, wachtwoord vergeten, wachtwoord instellen (www/layout/auth.inc.php).
 * --accent en --accent-text zet de pagina op body: de e-mailknopkleur van de klant. */

.auth {
    --accent: #138496;
    --accent-text: #fff;
    --accent-hover: color-mix(in srgb, var(--accent) 86%, #000);
    --accent-soft: color-mix(in srgb, var(--accent) 12%, #fff);
    --accent-ring: color-mix(in srgb, var(--accent) 28%, transparent);
    --ink: #1c2230;
    --ink-muted: #5f6878;
    --line: #e2e6ec;
    --field: #f7f8fa;
    --radius: 12px;

    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}

.auth__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(440px, 520px);
    min-height: 100vh;
    min-height: 100dvh;
}

/* ---------- Beeldkant ---------- */

.auth__visual {
    position: relative;
    overflow: hidden;
    background-color: var(--accent);
    background-image:
        linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--accent) 55%, #0b0f17) 100%),
        var(--auth-photo);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 56px;
}

/* Een vleugje accentkleur over de foto, zodat elke foto bij de huisstijl hoort */
.auth__visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--accent);
    mix-blend-mode: multiply;
    opacity: .18;
    pointer-events: none;
}

/* Geen loginachtergrond ingesteld: een zacht verloop in de accentkleur */
.auth__visual--plain {
    background-image:
        radial-gradient(60% 50% at 20% 15%, color-mix(in srgb, var(--accent) 55%, #fff) 0%, transparent 70%),
        radial-gradient(55% 60% at 85% 80%, color-mix(in srgb, var(--accent) 70%, #0b0f17) 0%, transparent 70%),
        linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #0b0f17));
}
/* Fijn puntraster, vervaagt naar onderen */
.auth__visual--plain::before {
    background: radial-gradient(rgba(255, 255, 255, .22) 1px, transparent 1.4px) 0 0 / 22px 22px;
    mix-blend-mode: normal;
    opacity: 1;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
    mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
}

.auth__visual-caption {
    position: relative;
    color: #fff;
    max-width: 520px;
}

.auth__company {
    display: block;
    font-size: clamp(32px, 3.4vw, 52px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -.02em;
    text-shadow: 0 2px 24px rgba(0, 0, 0, .25);
}

/* "Klantportaal" onder de bedrijfsnaam: dun en ruim gespatieerd */
.auth__tagline {
    display: block;
    margin-top: 14px;
    font-size: clamp(13px, 1vw, 16px);
    font-weight: 500;
    letter-spacing: .32em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .88);
    text-shadow: 0 1px 12px rgba(0, 0, 0, .25);
}

/* ---------- Formulierkant ---------- */

.auth__panel {
    display: flex;
    flex-direction: column;
    padding: 40px 56px 28px;
    background: #fff;
    box-shadow: -24px 0 60px rgba(16, 24, 40, .08);
    position: relative;
    z-index: 1;
}

/* Logo over de volle breedte van het formulierblok. Staande/vierkante logo's
 * worden door de maximale hoogte begrensd en blijven links uitgelijnd. */
.auth__logo {
    display: block;
    width: 100%;
    height: auto;
    max-height: 140px;
    object-fit: contain;
    object-position: left center;
    margin-bottom: 44px;
}

.auth__lang {
    position: relative;
    flex-shrink: 0;
}

.auth__lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    margin-left: -8px;
    padding: 0 8px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background-color .15s, color .15s;
}
.auth__lang-trigger::-webkit-details-marker { display: none; }
.auth__lang-trigger:hover,
.auth__lang[open] .auth__lang-trigger { background: var(--field); color: var(--ink); }
.auth__lang-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.auth__lang-trigger svg { width: 14px; height: 14px; }
.auth__lang-caret { transition: transform .15s; }
.auth__lang-caret { transform: rotate(180deg); }
.auth__lang[open] .auth__lang-caret { transform: none; }

/* Het menu zit in de voet en klapt naar boven open */
.auth__lang-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    z-index: 10;
    min-width: 200px;
    max-height: min(360px, 60vh);
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .06);
}

.auth__lang-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--ink) !important;
    text-decoration: none !important;
}
.auth__lang-item:hover, .auth__lang-item:focus-visible { background: var(--field); outline: none; }
.auth__lang-item.is-active { background: var(--accent-soft); font-weight: 600; }
.auth__lang-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(16, 24, 40, .1);
    flex-shrink: 0;
}

.auth__body {
    flex: 1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    padding: 48px 0;
}

.auth--wide .auth__body { max-width: 420px; }

.auth__title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    margin: 0 0 8px;
    color: var(--ink);
}

.auth__lead {
    color: var(--ink-muted);
    margin: 0 0 28px;
}
.auth__lead b { color: var(--ink); font-weight: 600; }

/* ---------- Velden ---------- */

.auth-field { margin-bottom: 18px; }

.auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}
@media (max-width: 420px) { .auth-grid { grid-template-columns: 1fr; } }

.auth-field__label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

.auth-field__control { position: relative; }

.auth-input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
    -webkit-appearance: none;
    appearance: none;
}
.auth-input::placeholder { color: #9aa2b1; }
.auth-input:hover { border-color: #cfd5de; }
.auth-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-ring);
}
.auth-input:disabled { color: var(--ink-muted); background: #f1f3f6; }
.auth-input--toggle { padding-right: 48px; }

.auth-input--code {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: .5em;
    padding-left: calc(14px + .5em);
    font-variant-numeric: tabular-nums;
    height: 60px;
}

/* parsley (wachtwoord instellen) */
.auth-input.is-invalid { border-color: #d64545; }
.auth-input.is-invalid:focus { box-shadow: 0 0 0 4px rgba(214, 69, 69, .2); }
.auth .invalid-feedback { display: block; font-size: 13px; margin-top: 6px; }

.auth-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
}
.auth-toggle:hover { color: var(--ink); background: rgba(16, 24, 40, .05); }
.auth-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-toggle svg { width: 20px; height: 20px; }
.auth-toggle .icon-hide { display: none; }
.auth-toggle[aria-pressed="true"] .icon-show { display: none; }
.auth-toggle[aria-pressed="true"] .icon-hide { display: block; }

.auth-hint {
    font-size: 13px;
    color: #a15c07;
    margin-top: 6px;
}

.auth-note {
    font-size: 13px;
    color: var(--ink-muted);
    margin: -6px 0 22px;
}

.auth-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin: 4px 0 24px;
    font-size: 14px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--ink);
    margin: 0;
    font-weight: 400;
    user-select: none;
    white-space: nowrap;
}
.auth-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.auth-link {
    color: var(--accent) !important;
    font-weight: 600;
    text-decoration: none !important;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0 1.5px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size .2s;
}
.auth-row .auth-link { white-space: nowrap; }
.auth-link:hover, .auth-link:focus-visible { background-size: 100% 1.5px; }

/* Lichte accentkleuren (bv. pastelblauw) zijn als tekst onleesbaar op wit */
@supports (color: color-mix(in srgb, red, blue)) {
    .auth-link { color: color-mix(in srgb, var(--accent) 78%, #000) !important; }
}

/* ---------- Knop ---------- */

.auth-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent);
    transition: background-color .15s, transform .15s, box-shadow .15s;
}
.auth-btn:hover { background: var(--accent-hover); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }
.auth-btn svg { width: 18px; height: 18px; transition: transform .2s; }
.auth-btn:hover svg { transform: translateX(3px); }

.auth-btn.is-busy { pointer-events: none; opacity: .85; }
.auth-btn.is-busy svg { display: none; }
.auth-btn.is-busy::after {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: auth-spin .7s linear infinite;
}

.auth-secondary {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--ink-muted);
}

/* ---------- Meldingen ---------- */

.auth-alert {
    display: block;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}
.auth-alert--error { background: #fdf0f0; border-color: #f6d4d4; color: #a12a2a; }
.auth-alert--info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, #fff); color: var(--ink); }

/* ---------- Wachtwoordsterkte (pwstrength, bootstrap 4) ---------- */

.auth .progress { height: 8px; border-radius: 999px; background: #edf0f4; margin-top: 4px; }
.auth .progress-bar { border-radius: 999px; font-size: 0; }
.auth .password-verdict { font-size: 13px; color: var(--ink-muted); }

/* ---------- Voet ---------- */

.auth__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    font-size: 12px;
    color: #8a93a3;
}

.auth__copyright {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}

/* ---------- Beweging ---------- */

@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .auth *, .auth *::before, .auth *::after { animation: none !important; transition: none !important; }
}

/* ---------- Kleinere schermen ---------- */

@media (max-width: 991.98px) {
    .auth__layout { grid-template-columns: 1fr; }

    /* De foto wordt de achtergrond, het formulier een kaart erop */
    .auth__visual {
        position: fixed;
        inset: 0;
        padding: 0;
    }
    .auth__visual-caption { display: none; }

    .auth__panel {
        margin: 24px auto;
        width: calc(100% - 32px);
        max-width: 480px;
        min-height: auto;
        padding: 28px 28px 20px;
        border-radius: 20px;
        box-shadow: 0 30px 80px -20px rgba(16, 24, 40, .45);
        align-self: center;
    }
    .auth__body { padding: 32px 0 28px; }
}

@media (max-width: 420px) {
    .auth__panel { margin: 16px auto; width: calc(100% - 24px); padding: 22px 20px 16px; }
    .auth__title { font-size: 24px; }
    .auth__logo { max-height: 100px; margin-bottom: 32px; }
}
