/* Login-only styling; the dashboard keeps its existing stylesheets. */
@font-face {
    font-family: "DM Sans";
    src: url("../fonts/dm-sans-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
}

@font-face {
    font-family: "Manrope";
    src: url("../fonts/manrope-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
}

/* Reuse the website's brand colors and typography. */
:root {
    --green: var(--theme-green);
    --ink: var(--theme-ink);
    --paper: var(--theme-paper);
    --line: var(--theme-line);
    --muted: var(--theme-muted);
    font-family: "DM Sans", Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
}

* { box-sizing: border-box; }
h1, p { margin: 0; }
a { color: inherit; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
    margin: 0;
}

.site-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    padding: 0 32px;
    border-bottom: 1px solid var(--line);
    background: var(--theme-chrome);
}

/* Align with the dashboard logo, reserving its menu button and gap. */
.site-header > a { flex-shrink: 0; margin-left: 60px; }

.brand-logo {
    display: block;
    height: auto;
    transform: translateY(-4px);
}

/* Match the website’s language picker and keep all languages reachable. */
.language-picker {
    position: relative;
    z-index: 1;
}

.language-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 2px;
    font-size: 14px;
    list-style: none;
    cursor: pointer;
}

.language-trigger::-webkit-details-marker { display: none; }

.language-globe {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.language-chevron {
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}

.language-picker[open] .language-chevron {
    transform: translateY(2px) rotate(225deg);
}

.language-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    display: none;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 3px;
    width: min(570px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: min(520px, 70svh);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    touch-action: pan-y;
    padding: 10px;
    border: 1px solid var(--line);
    background: var(--paper);
    box-shadow: 0 10px 25px #18271a24;
}

.language-picker[open] .language-menu { display: grid; }

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    font-size: 14px;
    text-align: start;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.language-flag {
    display: block;
    width: 30px;
    height: 20px;
    flex-shrink: 0;
    object-fit: cover;
    border: 1px solid var(--line);
    box-shadow: 0 1px 2px #202b2414;
}

/* The website represents Deutsch with diagonal halves of Austria and Germany. */
.language-flag-combined {
    position: relative;
    overflow: hidden;
}

.language-flag-combined img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flag-at { clip-path: polygon(0 0, 100% 0, 0 100%); }
.flag-de { clip-path: polygon(100% 0, 100% 100%, 0 100%); }

.language-option[aria-current="page"] { background: var(--theme-hover); font-weight: 600; }
.language-option:hover, .language-option:focus-visible { color: var(--theme-accent-ink); background: var(--theme-accent); }

.sign-in-layout {
    display: grid;
    flex: 1;
    align-content: center;
    justify-items: center;
    padding: 32px 24px;
}

.sign-in-panel {
    width: 100%;
    max-width: 448px;
    padding: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--theme-surface);
}

.sign-in-heading {
    margin-bottom: 28px;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
}

h1 {
    font-family: "Manrope", Arial, sans-serif;
    font-size: 30px;
    font-weight: 500;
    letter-spacing: -1px;
}

.sign-in-form {
    display: grid;
    gap: 20px;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field label {
    font-size: 13px;
    font-weight: 500;
}

.form-field input {
    width: 100%;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
    background: var(--theme-surface);
    font: inherit;
    font-size: 16px;
}

.form-field input::placeholder {
    color: var(--muted);
    opacity: 1;
}

.button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 50px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    margin-top: 4px;
    color: var(--theme-accent-ink);
    background: var(--theme-accent);
}

.button-primary:hover { background: var(--theme-accent-hover); }

.button span {
    font-size: 20px;
    line-height: 1;
}

:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 4px;
}

.form-field input:focus-visible { outline-offset: 0; }

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 24px;
    background: var(--theme-chrome);
    padding: 12px 24px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.42857143;
    text-align: center;
}

/* Preserve room for the form on narrow screens. */
@media (max-width: 760px) {
    .site-header { height: 64px; padding: 0 16px; }
    .site-header > a { margin-left: 48px; }
    .brand-logo { width: 130px; }
}

@media (max-width: 420px) {
    .sign-in-layout { padding: 24px 16px; }
    .sign-in-panel { padding: 24px; }
}

.site-header-actions { display: flex; align-items: center; gap: 24px; }

@media (max-width: 600px) {
    .site-header-actions { gap: 12px; }
    .language-name { display: none; }
}

@media (max-width: 400px) {
    .brand-logo { width: 80px; }
    .site-header { gap: 8px; padding: 0 12px; }
    .site-header > a { margin-left: 40px; }
}

/* Mirror interface alignment for Arabic while keeping email addresses readable. */
html[dir="rtl"] .language-menu { right: auto; left: 0; }
html[dir="rtl"] .sign-in-form input[type="email"] { direction: ltr; text-align: right; }
html[dir="rtl"] .sign-in-form button > span { transform: scaleX(-1); }

@media (max-width: 760px) {
    .language-menu, html[dir="rtl"] .language-menu {
        position: fixed;
        inset: 72px 6% 12px;
        width: auto;
        max-width: none;
        max-height: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 8px;
    }
    .language-option { gap: 8px; padding: 9px 8px; font-size: 13px; }
    .language-flag { width: 27px; height: 18px; flex-basis: 27px; }
}

.site-footer .legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
.site-footer .legal-links a { color: inherit; }

.site-footer { direction: ltr; }
.site-footer .legal-links { justify-content: flex-start; }
