/* =============================================================
   Profile Shell — gemeinsame Layout-Tokens für Anbieter- und Kundenprofil.
   Wird global geladen (App.razor / index.html), greift dadurch über
   Razor-CSS-Isolation hinweg auf beide Profil-Seiten.
   ============================================================= */

.profile-workspace {
    max-width: 860px;
    margin: 0 auto;
    padding: 0.375rem 1.25rem 0;
    position: relative;
}

/* Schmalerer Workspace für fokussierte Single-Task-Seiten (Login, Register, Reset). */
.profile-workspace.profile-workspace-narrow {
    max-width: 560px;
}

/* Hero ohne Avatar/Status-Spalten — nur Eyebrow + Title + Subtitle linksbündig.
   Bewusst ohne Border-Bottom: die nachfolgende Section-Card hat ihren eigenen Rand,
   ein zusätzlicher Trennstrich würde nur Lärm erzeugen. */
.profile-hero.profile-hero-simple {
    grid-template-columns: 1fr;
    padding: 0.5rem 0 1.25rem;
    margin-bottom: 1rem;
    border-bottom: none;
}

/* Dezenter Trenner zwischen Form und OAuth-Buttons innerhalb derselben Section. */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

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

/* ===== Auth-Banner (Erfolgs-/Fehler-/Info-Hinweise auf Login & Co.) ===== */
.auth-banner {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
    animation: fadeSlideIn 220ms ease-out;
}

.auth-banner-success {
    background: var(--color-success-bg);
    border-color: rgba(16, 185, 129, 0.25);
    color: #065f46;
}

.auth-banner-error {
    background: var(--color-danger-bg);
    border-color: rgba(239, 68, 68, 0.25);
    color: #991b1b;
}

.auth-banner-info {
    background: var(--color-info-bg);
    border-color: rgba(59, 130, 246, 0.25);
    color: #1e3a8a;
}

/* ===== Auth-Footer (eine kurze Satzzeile unter der Card, kein Link-Reihen-Layout) ===== */
.auth-footer {
    margin: 1.25rem 0 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.auth-footer a {
    color: var(--color-primary);
    font-weight: 500;
    text-decoration: none;
    margin-left: 0.25rem;
}

.auth-footer a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* Kleiner Inline-Link rechts ausgerichtet (z. B. „Passwort vergessen?" unterm Passwortfeld). */
.auth-inline-link {
    display: block;
    text-align: right;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-primary);
    font-weight: 500;
    text-decoration: none;
}

.auth-inline-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* ===== Auth-Form-Helpers (Login, Register, Reset) ===== */
/* Stack-Container für Form-Inhalte (gap funktioniert nicht direkt auf <form>).
   1.25rem ist genug Atemraum zwischen Label-Input-Paaren ohne dass es zerfasert. */
.auth-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Vollbreiter Submit-Button. display:block + box-sizing:border-box, weil Browser bei
   <button>-Elementen sonst die Content-Breite + Padding zur intrinsischen Min-Breite machen
   und width:100% nicht greift. Zusätzliche margin-top trennt ihn klar vom letzten Input. */
.auth-submit {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.625rem;
    font-size: 1rem;
    min-height: 48px;
}

/* Unauffälliger Hinweistext unter Eingabefeldern (Policy, OAuth-Hinweis etc.). */
.auth-field-hint {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0.25rem 0 0;
}

/* Schlanker Inline-Block für die „Aktivierungslink erneut senden"-Aktion direkt unter
   dem Error-Banner — bewusst keine vollwertige Section, weil rein situativ. */
.auth-resend-strip {
    margin: -0.25rem 0 1.25rem;
    padding: 0.875rem 1rem;
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
}

.auth-resend-row {
    display: flex;
    gap: 0.625rem;
    align-items: stretch;
}

.auth-resend-row .form-input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
}

.auth-resend-row .btn-primary {
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .auth-resend-row {
        flex-direction: column;
    }
}

/* ===== Hero ===== */
.profile-hero {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.75rem;
    align-items: start;
    padding: 0.5rem 0 2rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 2rem;
}

.profile-hero-content {
    max-width: 620px;
}

.profile-hero-eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin: 0 0 0.5rem;
}

.profile-hero-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--color-text);
    margin: 0 0 0.5rem;
}

.profile-hero-subtitle {
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--color-text-secondary);
    margin: 0;
    max-width: 56ch;
}

.profile-hero-status {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
    padding: 0.875rem 1.125rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.profile-hero-status::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background: var(--gradient-accent);
    border-radius: 1px;
}

.profile-hero-status-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

/* ===== Sections ===== */
.profile-sections {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.profile-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: visible;
    transition: box-shadow var(--transition-base);
}

.profile-section:hover {
    box-shadow: var(--shadow-md);
}

.profile-section:focus-within {
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(14, 165, 233, 0.2);
}

.profile-section-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.profile-section-number {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary);
    flex-shrink: 0;
    padding-top: 0.125rem;
    min-width: 2.25rem;
}

.profile-section-heading {
    flex: 1;
    min-width: 0;
}

.profile-section-heading h2 {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--color-text);
    margin: 0 0 0.25rem;
}

.profile-section-heading p {
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
    max-width: 58ch;
}

.profile-section-body {
    padding: 1.5rem 1.75rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ===== Form Helpers (auf der Profil-Seite genutzt) ===== */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.form-row-two {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 560px) {
    .form-row-two {
        grid-template-columns: 1fr;
    }
}

.form-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.form-char-counter {
    font-size: 0.6875rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

.form-char-counter.is-warning {
    color: var(--color-warning);
    font-weight: 600;
}

.required-mark {
    color: var(--color-primary);
    margin-left: 0.125rem;
    font-weight: 600;
}

.form-group-small {
    max-width: 140px;
}

.form-input-prominent {
    font-size: 1.0625rem;
    font-weight: 500;
    min-height: 52px;
    padding: 0.625rem 1rem;
    letter-spacing: -0.005em;
}

/* ===== Location Chip ===== */
.location-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    align-self: flex-start;
    line-height: 1.4;
    transition: all var(--transition-base);
    animation: fadeSlideIn 260ms ease-out;
}

.location-chip-pending {
    background: var(--color-bg);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.location-chip-pending .location-chip-icon {
    color: var(--color-text-muted);
}

.location-chip-resolved {
    background: rgba(14, 165, 233, 0.08);
    color: var(--color-primary);
    border: 1px solid rgba(14, 165, 233, 0.25);
}

.location-chip-resolved .location-chip-icon {
    color: var(--color-primary);
}

.location-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.location-chip-label {
    letter-spacing: 0.01em;
}

.location-chip-value {
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    font-weight: 500;
    padding-left: 0.5rem;
    margin-left: 0.125rem;
    border-left: 1px solid rgba(14, 165, 233, 0.3);
    color: var(--color-text-secondary);
}

/* ===== Profile-Shell: Responsive ===== */
@media (max-width: 640px) {
    .profile-workspace {
        padding: 0.25rem 1rem 0;
    }

    .profile-hero {
        grid-template-columns: auto 1fr;
        padding: 0.25rem 0 1.5rem;
        margin-bottom: 1.5rem;
        gap: 1rem;
        align-items: center;
    }

    .profile-hero-status {
        grid-column: 1 / -1;
        justify-self: start;
        align-self: flex-start;
    }

    .profile-hero-title {
        font-size: 1.5rem;
        line-height: 1.2;
    }

    .profile-hero-subtitle {
        font-size: 0.875rem;
    }

    .profile-section-header {
        padding: 1.25rem 1.25rem 1rem;
        gap: 1rem;
    }

    .profile-section-body {
        padding: 1.25rem 1.25rem 1.5rem;
    }

    .profile-section-number {
        font-size: 1.75rem;
        min-width: 2rem;
    }
}

/* Entwicklermodus-Sektion: API-Endpunkt-Auswahl (nur sichtbar bei Dev:EnableEndpointSwitch=true) */
.dev-endpoint-options {
    border: 0;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dev-endpoint-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--profile-border, #e2e8f0);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.dev-endpoint-option:hover {
    background-color: rgba(14, 165, 233, 0.04);
}

.dev-endpoint-option input[type="radio"] {
    margin-top: 0.25rem;
}

.dev-endpoint-option-label {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.dev-endpoint-option-url code {
    font-size: 0.8125rem;
    color: var(--profile-muted, #64748b);
}

.dev-endpoint-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

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

/* Login-Footer: Einstieg in den API-Endpunkt-Switch (Notausstieg, falls eine
   versehentlich falsche URL gespeichert wurde und keine API-Calls mehr klappen). */
.auth-endpoint-footer {
    margin-top: 1.5rem;
}

.auth-endpoint-toggle {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: transparent;
    border: 1px dashed var(--profile-border, #cbd5e1);
    border-radius: 0.5rem;
    color: var(--profile-muted, #64748b);
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.auth-endpoint-toggle:hover {
    border-color: var(--brand-primary, #0ea5e9);
    color: var(--brand-primary, #0ea5e9);
}

.auth-endpoint-toggle-label {
    flex: 0 0 auto;
}

/* URL ohne Scheme rechts in der Pille — in Rot, klein und monospace, damit
   der Hostname als „akzeptierter Notausstieg-Hinweis" optisch heraussticht. */
.auth-endpoint-toggle-url {
    margin-left: auto;
    color: var(--color-danger, #dc2626);
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    text-align: right;
    word-break: break-all;
}

.auth-endpoint-toggle-label code {
    font-size: 0.75rem;
}

.auth-endpoint-footer-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}
