/* =============================================================
 * auth.css – Permutis Web-Authentifizierung
 * Eigenständige Styles für /login und /register.
 * Nutzt die globalen CSS-Variablen aus :root in styles.css
 * (--violet, --bg, --surface, --surface-2, --border, --text, --muted).
 * ============================================================= */

/* Vollbild-Hintergrund: gleicher Verlauf wie der Hero der Hauptseite. */
.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 18% 10%, rgba(108, 92, 231, 0.22), transparent 60%),
        radial-gradient(900px 500px at 90% 0%, rgba(34, 197, 94, 0.10), transparent 55%),
        linear-gradient(180deg, #0A0E1A 0%, #0E1322 50%, #0A0E1A 100%);
    display: flex;
    flex-direction: column;
}

.auth-page main {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 1rem 2rem;
}

/* Auth-Card (zentriert). */
.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.03) inset;
    padding: 2rem 1.75rem 1.5rem;
    color: var(--text);
}

.auth-card__head {
    text-align: center;
    margin-bottom: 1.25rem;
}

.auth-card__heading {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 0.35rem;
    letter-spacing: -0.01em;
}

.auth-card__sub {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 0;
}

/* Tab-Switcher. */
.auth-tabs {
    display: flex;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
    background: var(--surface-2);
    padding: 0.35rem;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 0.6rem 0.75rem;
    background: transparent;
    border: 0;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.92rem;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.auth-tab:hover {
    color: var(--text);
}

.auth-tab.is-active {
    background: var(--violet);
    color: var(--text-on-dark);
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.35);
}

/* Form-Felder. */
.auth-field {
    margin-bottom: 0.85rem;
}

.auth-field label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.22);
    background: var(--surface);
}

.auth-field input::placeholder {
    color: var(--muted);
}

.auth-password-wrap {
    position: relative;
}

.auth-password-wrap input[type="password"],
.auth-password-wrap input[type="text"] {
    padding-right: 6.5rem;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    min-width: 5.25rem;
    min-height: 2.05rem;
    border: 1px solid rgba(108, 92, 231, 0.32);
    border-radius: 8px;
    background: rgba(108, 92, 231, 0.14);
    color: var(--text);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
    background: rgba(108, 92, 231, 0.24);
    border-color: rgba(108, 92, 231, 0.58);
    color: var(--text);
    outline: none;
}

.auth-field input[aria-invalid="true"] {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.auth-username-status {
    min-height: 1.15rem;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.auth-username-status.is-ok {
    color: var(--positive-text);
}

.auth-username-status.is-err {
    color: var(--text);
}

.auth-username-status.is-info {
    color: var(--text);
}

.auth-username-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.auth-username-chip {
    appearance: none;
    border: 1px solid rgba(108, 92, 231, 0.34);
    background: rgba(108, 92, 231, 0.12);
    color: var(--text);
    border-radius: 999px;
    padding: 0.42rem 0.72rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.auth-username-chip:hover {
    background: rgba(108, 92, 231, 0.22);
    border-color: rgba(108, 92, 231, 0.52);
    color: var(--text);
}

/* Help-Zeile unter dem Passwort-Feld (z. B. "Passwort vergessen?"). */
.auth-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -0.45rem 0 0.85rem;
    font-size: 0.82rem;
}

.auth-link-quiet {
    color: var(--text);
    text-decoration: underline;
    font-weight: 600;
}

.auth-link-quiet:hover {
    text-decoration: underline;
}

.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.auth-remember input {
    accent-color: var(--violet);
}

/* Checkbox-AGB-Zeile (Register). */
.auth-agree {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0.25rem 0 1rem;
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.4;
}

.auth-agree input {
    margin: 0.18rem 0 0;
    accent-color: var(--violet);
    flex-shrink: 0;
}

.auth-agree a {
    color: var(--text);
    font-weight: 700;
    text-decoration: underline;
}

.auth-agree a:hover {
    text-decoration: underline;
}

/* Primärbutton (violett). */
.auth-submit {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 0;
    border-radius: 12px;
    background: var(--violet);
    color: var(--text-on-dark);
    font-weight: 800;
    font-size: 0.98rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.32);
    margin-top: 0.4rem;
}

.auth-submit:hover {
    background: var(--violet-600, #5a4bd4);
}

.auth-submit:active {
    transform: translateY(1px);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

/* Status- / Fehlermeldung. */
.auth-msg {
    font-size: 0.85rem;
    margin-top: 0.85rem;
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    display: none;
}

.auth-msg--err {
    display: block;
    background: rgba(239, 68, 68, 0.12);
    color: var(--text);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.auth-msg--ok {
    display: block;
    background: rgba(34, 197, 94, 0.12);
    color: var(--positive-text);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Divider "oder". */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.1rem 0 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Kompakte OAuth-Reihe wie in der Flutter-App. */
.auth-social {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
}

.auth-social-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 3.25rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 1;
    transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.auth-social-btn:hover {
    background: var(--surface);
    border-color: rgba(108, 92, 231, 0.4);
    box-shadow: 0 8px 24px rgba(8, 10, 22, 0.22);
    transform: translateY(-1px);
}

.auth-social-btn:focus-visible {
    outline: 2px solid #a99cff;
    outline-offset: 2px;
}

.auth-social-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.55;
}

.auth-social-btn[disabled]:hover {
    opacity: 0.55;
    background: var(--surface-2);
    border-color: var(--border);
    box-shadow: none;
    transform: none;
}

.auth-social-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

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

.auth-social-hint {
    text-align: center;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0.55rem 0 0;
}

/* Hinweis unter dem Formular (z. B. "Schon ein Konto?"). */
.auth-foot-link {
    text-align: center;
    margin: 1rem 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.auth-foot-link a {
    color: var(--text);
    font-weight: 700;
    text-decoration: underline;
    margin-left: 0.25rem;
}

.auth-foot-link a:hover {
    text-decoration: underline;
}

.auth-store-download {
    margin-top: 1.35rem;
    text-align: center;
}

.auth-store-download__label {
    margin: 0 0 0.65rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.auth-store-download .store-badges--duo {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 auto;
}

.auth-store-download .store-badges--duo .store-badge {
    flex: 1 1 calc(50% - 0.5rem);
    max-width: 11.5rem;
    min-width: 9rem;
}

/* ── Reset-Modus (?mode=reset) – schlanker, ein einzelnes Feld. ───── */
.auth-card--reset .auth-submit {
    margin-top: 0.5rem;
}

.auth-back-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.auth-back-link:hover {
    color: var(--text);
}

/* ── Footer: auf Auth-Seiten schmaler & mittig. ─────────────────── */
.auth-page .footer {
    margin-top: auto;
}

/* ── Mobile (< 560px): Card wird Vollbild. ──────────────────────── */
@media (max-width: 560px) {
    .auth-page main {
        padding: 0;
        align-items: stretch;
    }

    .auth-card {
        max-width: none;
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        padding: 5rem 1.25rem 5.75rem;
        box-shadow: none;
    }

    .auth-store-download .store-badges--duo .store-badge {
        max-width: none;
    }

    .auth-divider {
        margin: 1rem 0 0.8rem;
    }

    .auth-social { gap: 0.4rem; }

    .auth-social-btn {
        min-height: 2.9rem;
        border-radius: 12px;
    }
}

/* ── Tab-Switcher im Reset-Modus ausblenden. ─────────────────── */
.auth-card--reset .auth-tabs,
.auth-card--reset .auth-foot-link {
    display: none;
}

/* ── Sub-Tabs (Privat / Firma) auf der Register-Seite. ────────── */
.auth-tabs--sub {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    background: transparent;
    border: 0;
    padding: 0;
    border-radius: 0;
}
.auth-tabs--sub .auth-tab {
    background: transparent;
    border: 1px solid rgba(108, 92, 231, 0.2);
    color: var(--muted, #94a3b8);
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    font-weight: 700;
    text-align: center;
    flex: none;
}
.auth-tabs--sub .auth-tab.is-active {
    background: var(--violet);
    color: var(--text-on-dark);
    border-color: var(--violet);
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.35);
}
.auth-tabs--sub .auth-tab:hover:not(.is-active) {
    border-color: rgba(108, 92, 231, 0.5);
    color: var(--text);
}

/* Tab-Panel: standardmäßig sichtbar, mit [hidden] ausgeblendet. */
.auth-tab-panel { display: block; }
.auth-tab-panel[hidden] { display: none; }

/* Zwei-Spalten-Row (z. B. Vorname / Nachname). */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.auth-row > .auth-field { margin-bottom: 0.85rem; }
@media (max-width: 560px) {
    .auth-row { grid-template-columns: 1fr; gap: 0; }
}

/* Hint-Zeile unter einem Feld (z. B. Username-Hinweis, Referral-Beispiel). */
.auth-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--muted, #94a3b8);
    line-height: 1.35;
}

/* Vorteilsliste („Warum Permutis?"). */
.auth-benefits {
    margin: 1.25rem 0 1rem;
    padding: 1rem 1.25rem;
    background: rgba(108, 92, 231, 0.06);
    border: 1px solid rgba(108, 92, 231, 0.18);
    border-radius: 12px;
}
.auth-benefits__title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}
.auth-benefits__list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--muted, #cbd5e1);
    font-size: 0.9rem;
    line-height: 1.5;
}
.auth-benefits__list li { margin: 0.2rem 0; }

/* ── Sub-Tabs (Privat / Firma) auf der Register-Seite. ─────────── */
.auth-tabs--sub {
    margin-bottom: 1.5rem;
}

.auth-tabs--sub .auth-tab {
    background: transparent;
    border: 1px solid rgba(108, 92, 231, 0.2);
    color: var(--muted, #94a3b8);
    padding: 0.65rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.auth-tabs--sub .auth-tab.is-active {
    background: var(--violet);
    color: var(--text-on-dark);
    border-color: var(--violet);
}

.auth-tabs--sub .auth-tab:hover:not(.is-active) {
    border-color: rgba(108, 92, 231, 0.5);
    color: var(--text);
}

.auth-tab-panel {
    display: block;
}

.auth-tab-panel[hidden] {
    display: none;
}

/* Zwei-Spalten-Row für Vor-/Nachname (Register). */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.auth-row .auth-field {
    margin-bottom: 0.85rem;
}

.auth-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--muted, #94a3b8);
}

/* Vorteilsliste „Warum Permutis?". */
.auth-benefits {
    margin: 1.5rem 0 1rem;
    padding: 1rem 1.25rem;
    background: rgba(108, 92, 231, 0.06);
    border: 1px solid rgba(108, 92, 231, 0.18);
    border-radius: 12px;
}

.auth-benefits__title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.auth-benefits__list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--muted, #cbd5e1);
    font-size: 0.9rem;
}

.auth-benefits__list li {
    margin: 0.2rem 0;
}

/* ── Mobile (< 560px): auth-row wird zur Einspalte. ─────────── */
@media (max-width: 560px) {
    .auth-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-tabs--sub .auth-tab {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
    }
}
