/* =========================================================
   HBS Garage · Profil & Nachbarschaft
   ========================================================= */

.profile-page {
    display: grid;
    gap: 1.2rem;
    padding: 1rem 0 3rem;
}


/* ---------- Hero ---------- */

.profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.55rem 1.7rem;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    background:
        radial-gradient(
            circle at 90% 10%,
            rgba(126, 166, 112, .17),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #fafbf7 0%,
            #eff5ed 100%
        );
}

.profile-hero-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.profile-hero-avatar {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 4px solid #fff;
    border-radius: 50%;
    background: var(--color-primary-dark);
    color: #fff;
    box-shadow: 0 8px 24px rgba(24, 48, 32, .12);
    font-size: 1.7rem;
    font-weight: 900;
}

.profile-hero-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-hero-copy {
    min-width: 0;
}

.profile-hero-copy h1 {
    margin: .2rem 0 .25rem;
    color: var(--color-text);
    font-size: clamp(1.8rem, 4vw, 2.65rem);
    line-height: 1.05;
    letter-spacing: -.035em;
}

.profile-hero-copy p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: .82rem;
}

.profile-hero-facts {
    display: flex;
    gap: .65rem;
}

.profile-hero-fact {
    min-width: 145px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: .55rem;
    align-items: center;
    padding: .72rem .8rem;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .82);
}

.profile-hero-fact > span {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-weight: 900;
}

.profile-hero-fact div {
    min-width: 0;
    display: grid;
}

.profile-hero-fact small {
    color: var(--color-text-muted);
    font-size: .61rem;
}

.profile-hero-fact strong {
    margin-top: .08rem;
    font-size: .82rem;
}


/* ---------- Formular / Layout ---------- */

.profile-form {
    display: grid;
    gap: 1rem;
}

.profile-layout {
    display: grid;
    grid-template-columns:
        minmax(0, 1.55fr)
        minmax(260px, .58fr);
    gap: 1rem;
    align-items: start;
}

.profile-main,
.profile-sidebar {
    min-width: 0;
    display: grid;
    gap: 1rem;
}

.profile-section-card,
.profile-side-card,
.profile-security-link {
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-surface);
    box-shadow: 0 4px 16px rgba(25, 47, 31, .035);
}

.profile-section-card {
    padding: clamp(1.15rem, 3vw, 1.65rem);
}

.profile-section-heading {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: .8rem;
    align-items: start;
    padding-bottom: 1rem;
    margin-bottom: 1.15rem;
    border-bottom: 1px solid var(--color-border);
}

.profile-section-heading-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--color-primary-light);
    font-size: 1rem;
}

.profile-section-heading h2 {
    margin: .12rem 0 .2rem;
    color: var(--color-text);
    font-size: 1.25rem;
}

.profile-section-heading p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: .75rem;
    line-height: 1.5;
}


/* ---------- Avatar ---------- */

.profile-avatar-editor {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1.15rem;
    align-items: center;
    margin-bottom: 1.25rem;
    padding: 1rem;
    border-radius: 16px;
    background: var(--color-surface-muted);
}

.profile-avatar-preview {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 4px solid #fff;
    border-radius: 50%;
    background: #e5efe6;
    box-shadow: 0 5px 18px rgba(28, 62, 49, .1);
}

.profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-initial {
    color: var(--color-primary-dark);
    font-size: 2rem;
    font-weight: 900;
}

.profile-avatar-copy {
    min-width: 0;
}

.profile-avatar-copy > strong {
    display: block;
    font-size: .84rem;
}

.profile-avatar-copy > p {
    max-width: 580px;
    margin: .25rem 0 .65rem;
    color: var(--color-text-muted);
    font-size: .72rem;
    line-height: 1.5;
}

.profile-image-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .55rem;
}

.profile-image-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.profile-image-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: .55rem .8rem;
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--color-primary-dark);
    cursor: pointer;
    font-size: .7rem;
    font-weight: 850;
}

.profile-image-button:hover {
    background: var(--color-primary-light);
}

.profile-remove-image {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 38px;
    color: #874545;
    cursor: pointer;
    font-size: .68rem;
    font-weight: 750;
}

.profile-remove-image input {
    width: 15px;
    height: 15px;
}


/* ---------- Felder ---------- */

.profile-name-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}

.profile-field {
    min-width: 0;
    display: grid;
    gap: .35rem;
}

.profile-field > label {
    color: var(--color-text);
    font-size: .72rem;
    font-weight: 850;
}

.profile-input {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
}

.profile-field-help,
.profile-inline-help {
    color: var(--color-text-muted);
    font-size: .66rem;
    line-height: 1.5;
}

.profile-avatar-copy .profile-field-help {
    display: block;
    margin-top: .45rem;
}

.profile-inline-help {
    margin: .65rem 0 0;
}

.profile-field .error,
.profile-avatar-copy .error,
.profile-radius-control .error {
    display: block;
    color: #9b3838;
    font-size: .65rem;
}


/* ---------- PLZ ---------- */

.profile-location-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: end;
}

.profile-location-explanation {
    min-height: 48px;
    display: grid;
    grid-template-columns: 32px auto;
    gap: .45rem;
    align-items: center;
    padding: 0 .75rem;
    border: 1px solid var(--color-border);
    border-radius: 11px;
    background: var(--color-surface-muted);
}

.profile-location-explanation > span {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #fff;
    color: var(--color-primary-dark);
}

.profile-location-explanation div {
    display: grid;
}

.profile-location-explanation small {
    color: var(--color-text-muted);
    font-size: .58rem;
}

.profile-location-explanation strong {
    font-size: .68rem;
}


/* ---------- Radius ---------- */

.profile-radius-control {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background:
        linear-gradient(
            135deg,
            var(--color-surface-muted),
            #fff
        );
}

.profile-radius-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.profile-radius-heading label {
    color: var(--color-text);
    font-size: .75rem;
    font-weight: 850;
}

.profile-radius-heading p {
    margin: .2rem 0 0;
    color: var(--color-text-muted);
    font-size: .66rem;
}

.profile-radius-value {
    min-width: 84px;
    padding: .55rem .65rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #fff;
    text-align: center;
}

.profile-radius-value strong {
    color: var(--color-primary-dark);
    font-size: 1.4rem;
}

.profile-radius-value span {
    margin-left: .12rem;
    color: var(--color-text-muted);
    font-size: .7rem;
}

.profile-radius-slider {
    width: 100%;
    height: 8px;
    margin: 1rem 0 0;
    cursor: pointer;
    accent-color: var(--color-primary-dark);
}

.profile-radius-scale {
    display: flex;
    justify-content: space-between;
    margin-top: .35rem;
    color: var(--color-text-muted);
    font-size: .6rem;
}


/* ---------- Karten-Zusammenfassung ---------- */

.profile-map-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .55rem;
    margin-top: 1rem;
}

.profile-map-summary > div {
    min-width: 0;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: .5rem;
    align-items: center;
    padding: .65rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #fff;
}

.profile-map-summary-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.profile-map-summary > div > span:last-child {
    min-width: 0;
}

.profile-map-summary small,
.profile-map-summary strong,
.profile-place-name {
    display: block;
}

.profile-map-summary small {
    color: var(--color-text-muted);
    font-size: .56rem;
}

.profile-map-summary strong {
    margin-top: .08rem;
    overflow: hidden;
    font-size: .68rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.profile-place-name {
    margin-top: .08rem;
    overflow: hidden;
    color: var(--color-text-muted);
    font-size: .56rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}


/* ---------- Karte ---------- */

.profile-map-wrap {
    position: relative;
    margin-top: .75rem;
}

.profile-neighborhood-map {
    position: relative;
    z-index: 0;
    isolation: isolate;
    width: 100%;
    height: 330px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: #edf2ed;
}

.profile-map-privacy {
    position: absolute;
    right: .65rem;
    bottom: .65rem;
    z-index: 950;
    padding: .42rem .6rem;
    border: 1px solid rgba(36, 79, 62, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(24, 48, 32, .08);
    font-size: .6rem;
    font-weight: 800;
    pointer-events: none;
}

.profile-map-status {
    margin-top: .45rem;
    color: var(--color-text-muted);
    font-size: .62rem;
}

.profile-map-status.is-error {
    color: #a23d3d;
}


/* ---------- Leaflet Layer ---------- */

.profile-neighborhood-map .leaflet-tile-pane {
    z-index: 200;
}

.profile-neighborhood-map .leaflet-overlay-pane {
    z-index: 400;
}

.profile-neighborhood-map .leaflet-shadow-pane {
    z-index: 500;
}

.profile-neighborhood-map .leaflet-marker-pane {
    z-index: 600;
}

.profile-neighborhood-map .leaflet-tooltip-pane {
    z-index: 650;
}

.profile-neighborhood-map .leaflet-popup-pane {
    z-index: 700;
}

.profile-neighborhood-map .leaflet-control {
    z-index: 800;
}

.profile-neighborhood-map .leaflet-top,
.profile-neighborhood-map .leaflet-bottom {
    z-index: 900;
}


/* ---------- Sidebar ---------- */

.profile-side-card {
    padding: 1.15rem;
}

.profile-side-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    margin-bottom: .7rem;
    border-radius: 12px;
    background: var(--color-primary-light);
}

.profile-side-card h2 {
    margin: 0;
    font-size: 1rem;
}

.profile-side-card > p {
    margin: .4rem 0 0;
    color: var(--color-text-muted);
    font-size: .7rem;
    line-height: 1.55;
}

.profile-privacy-list {
    display: grid;
    gap: .5rem;
    margin: .85rem 0 0;
    padding: 0;
    list-style: none;
}

.profile-privacy-list li {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: .4rem;
    align-items: center;
    color: var(--color-text-muted);
    font-size: .66rem;
}

.profile-privacy-list li span {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e2f0df;
    color: #32643a;
    font-size: .56rem;
    font-weight: 900;
}

.profile-side-neighborhood {
    background:
        linear-gradient(
            145deg,
            #fbfdf9,
            #f3f7f1
        );
}

.profile-radius-affects {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .8rem;
}

.profile-radius-affects span {
    padding: .35rem .5rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    color: var(--color-text-muted);
    font-size: .59rem;
    font-weight: 750;
}

.profile-security-link {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: .65rem;
    align-items: center;
    padding: .9rem 1rem;
    color: var(--color-text);
    text-decoration: none;
    transition:
        transform 150ms ease,
        border-color 150ms ease;
}

.profile-security-link:hover {
    transform: translateY(-1px);
    border-color: var(--color-border-strong);
}

.profile-security-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--color-surface-muted);
}

.profile-security-link > span:nth-child(2) {
    min-width: 0;
    display: grid;
}

.profile-security-link small {
    color: var(--color-text-muted);
    font-size: .58rem;
}

.profile-security-link strong {
    margin-top: .08rem;
    font-size: .68rem;
}


/* ---------- Speichern ---------- */

.profile-save-bar {
    position: sticky;
    bottom: 1rem;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem .9rem .8rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 12px 34px rgba(24, 48, 32, .12);
    backdrop-filter: blur(12px);
}

.profile-save-bar > div {
    min-width: 0;
    display: grid;
}

.profile-save-bar strong {
    font-size: .72rem;
}

.profile-save-bar span {
    margin-top: .08rem;
    color: var(--color-text-muted);
    font-size: .61rem;
}

.account-profile-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
}


/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .profile-security-link {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .profile-page {
        padding-top: .4rem;
        padding-bottom: 6rem;
    }

    .profile-hero {
        align-items: stretch;
        flex-direction: column;
        gap: 1rem;
        padding: 1.2rem;
        border-radius: 20px;
    }

    .profile-hero-avatar {
        width: 64px;
        height: 64px;
        flex-basis: 64px;
    }

    .profile-hero-facts {
        display: grid;
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .profile-hero-fact {
        min-width: 0;
    }

    .profile-map-summary {
        grid-template-columns: 1fr;
    }

    .profile-neighborhood-map {
        height: 290px;
    }

    .profile-sidebar {
        grid-template-columns: 1fr;
    }

    .profile-security-link {
        grid-column: auto;
    }

    .profile-save-bar {
        bottom:
            calc(
                var(--mobile-nav-height, 78px)
                + env(safe-area-inset-bottom)
                + .55rem
            );
    }
}

@media (max-width: 560px) {
    .profile-name-grid,
    .profile-location-row {
        grid-template-columns: 1fr;
    }

    .profile-avatar-editor {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .profile-image-actions {
        justify-content: center;
    }

    .profile-location-explanation {
        justify-self: start;
    }

    .profile-radius-heading {
        align-items: flex-start;
    }

    .profile-save-bar > div {
        display: none;
    }

    .profile-save-bar .btn {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .profile-hero-facts {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   E-Mail-Benachrichtigungen
   ========================================================= */

.profile-email-settings {
    display: grid;
    gap: .7rem;
}

.profile-email-setting {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: .9rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-surface-muted);
    cursor: pointer;
}

.profile-email-setting:hover {
    border-color: var(--color-border-strong);
}

.profile-email-setting-copy {
    min-width: 0;
    display: grid;
    gap: .18rem;
}

.profile-email-setting-copy strong {
    color: var(--color-text);
    font-size: .78rem;
}

.profile-email-setting-copy small {
    color: var(--color-text-muted);
    font-size: .63rem;
    line-height: 1.5;
}

.profile-switch {
    position: relative;
    width: 46px;
    height: 26px;
    flex: 0 0 46px;
}

.profile-switch-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.profile-switch-control {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd3cd;
    transition:
        background 160ms ease,
        box-shadow 160ms ease;
}

.profile-switch-control::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(25, 47, 31, .2);
    transition: transform 160ms ease;
}

.profile-switch-input:checked + .profile-switch-control {
    background: var(--color-primary);
}

.profile-switch-input:checked
+ .profile-switch-control::after {
    transform: translateX(20px);
}

.profile-switch-input:focus-visible
+ .profile-switch-control {
    box-shadow:
        0 0 0 3px rgba(60, 112, 77, .2);
}

.profile-email-required {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: .7rem;
    align-items: start;
    margin-top: 1rem;
    padding: .85rem .95rem;
    border-radius: 13px;
    background: #f3f7f3;
    color: var(--color-text-muted);
}

.profile-email-required > span {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #fff;
}

.profile-email-required strong {
    color: var(--color-text);
    font-size: .7rem;
}

.profile-email-required p {
    margin: .2rem 0 0;
    font-size: .62rem;
    line-height: 1.5;
}

@media (max-width: 560px) {
    .profile-email-setting {
        padding: .85rem;
    }

    .profile-email-setting-copy small {
        max-width: 240px;
    }
}


.profile-notification-section {
    display: grid;
    gap: 18px;
    margin-top: 8px;
    padding-top: 26px;
    border-top: 1px solid #e3e9e4;
}

.profile-notification-heading {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 13px;
    align-items: start;
}

.profile-notification-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #edf6ef;
    color: #176c43;
    font-size: 18px;
    font-weight: 800;
}

.profile-notification-heading h2 {
    margin: 3px 0 5px;
    color: #1a2f24;
    font-size: 20px;
}

.profile-notification-heading p {
    margin: 0;
    color: #68766e;
    font-size: 13px;
    line-height: 1.5;
}
