/* =========================================================
   XEPT KUNDENPROFIL
   Rechtes Account-Panel / Drawer
   Nur Darstellung – Profil-/Speicherlogik bleibt in PHP.
   ========================================================= */

/*
 * Der Popup-Wrapper wird im Header bereits per JS ein-/ausgeblendet.
 * Wenn er offen ist, bildet er die feste Ebene über der Website.
 */
#customerProfilePopup {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2400 !important;

    overflow: hidden !important;
    pointer-events: auto !important;
}

#customerProfilePopup::before {
    content: "";
    position: absolute;
    inset: 0;

    background: rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);

    pointer-events: none;
}

.hero .customer-profile,
.customer-profile {
    position: fixed !important;
    top: 88px !important;
    right: 24px !important;
    bottom: 20px !important;
    left: auto !important;

    width: min(560px, calc(100vw - 32px)) !important;
    max-width: none !important;
    height: auto !important;

    margin: 0 !important;
    padding: 0 !important;

    transform: none !important;
    transform-origin: initial !important;

    z-index: 2 !important;
    pointer-events: auto !important;

    color: #172033;
    font-family: inherit;
}

.hero .profile-box,
.customer-profile .profile-box {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;

    display: flex !important;
    flex-direction: column !important;

    overflow: hidden !important;

    background: rgba(255, 255, 255, 0.99) !important;
    border: 1px solid rgba(15, 23, 42, 0.10) !important;
    border-top: 4px solid var(--brand-primary, #e60000) !important;
    border-radius: 14px !important;

    box-shadow:
        0 28px 70px rgba(15, 23, 42, 0.18),
        0 8px 24px rgba(15, 23, 42, 0.08) !important;
}

/*
 * WICHTIG:
 * Nicht mehr die gesamte Box scrollen.
 * Header/Kundennummer bleiben stehen und nur das Formular scrollt.
 */
.customer-profile #customerProfileForm {
    flex: 1 1 auto !important;
    min-height: 0 !important;

    display: block !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;

    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;

    scrollbar-width: thin;
    scrollbar-color: #c5ccd5 transparent;
}

.customer-profile #customerProfileForm::-webkit-scrollbar {
    width: 9px;
}

.customer-profile #customerProfileForm::-webkit-scrollbar-track {
    background: transparent;
}

.customer-profile #customerProfileForm::-webkit-scrollbar-thumb {
    background: #c5ccd5;
    border: 2px solid #fff;
    border-radius: 999px;
}

.customer-profile #customerProfileForm::-webkit-scrollbar-thumb:hover {
    background: #aeb7c3;
}

/* =========================================================
   HEADER
   ========================================================= */

.customer-profile .profile-header {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;

    margin: 0;
    padding: 26px 28px 22px;

    border-bottom: 1px solid #edf0f3;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.88), rgba(255, 255, 255, 0));
}

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

.customer-profile .profile-heading-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
}

.customer-profile .profile-header h1 {
    margin: 0 !important;
    color: #101827 !important;
    font-size: 26px !important;
    line-height: 1.15 !important;
    font-weight: 800 !important;
    letter-spacing: -0.45px;
}

.customer-profile .profile-subtitle {
    margin: 7px 0 0 !important;
    color: #697386 !important;
    font-size: 13px !important;
    line-height: 1.5;
}

.customer-profile .profile-type {
    display: inline-flex;
    align-items: center;
    min-height: 25px;

    padding: 4px 9px;

    border: 1px solid rgba(230, 0, 0, 0.18);
    border-radius: 999px;
    background: rgba(230, 0, 0, 0.055);

    color: var(--brand-primary, #e60000);
    font-size: 9px;
    line-height: 1.2;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.055em;
}

.customer-profile .profile-customer-number {
    display: inline-flex;
    width: max-content;
    align-items: center;
    gap: 7px;

    margin-top: 16px;
    margin-bottom: 2px;
    padding: 7px 10px;

    border: 1px solid #e8ebef;
    border-radius: 7px;
    background: #f8fafc;

    color: #7a8494;
    font-size: 11px;
    line-height: 1;
}

.customer-profile .profile-customer-number strong {
    color: #273244;
    font-weight: 800;
}

.customer-profile .profile-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin: -4px -6px 0 0;
    padding: 0;

    border: 1px solid #e2e6ea;
    border-radius: 9px;
    background: #fff;
    color: #6b7280;

    font: inherit;
    font-size: 23px;
    line-height: 1;

    cursor: pointer;

    transition:
        color .16s ease,
        border-color .16s ease,
        background .16s ease,
        transform .16s ease;
}

.customer-profile .profile-close:hover {
    border-color: rgba(230, 0, 0, 0.35);
    background: rgba(230, 0, 0, 0.045);
    color: var(--brand-primary, #e60000);
    transform: translateY(-1px);
}

/* =========================================================
   FORMULAR / BEREICHE
   ========================================================= */

.customer-profile form {
    margin: 0;
}

.customer-profile .profile-section {
    margin: 0 !important;
    padding: 22px 28px 0;
}

.customer-profile #customerProfileForm > .profile-section:first-of-type {
    padding-top: 28px;
}

.customer-profile .profile-section + .profile-section {
    margin-top: 4px !important;
}

.customer-profile .profile-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.customer-profile .profile-section-title::before {
    content: "";
    width: 3px;
    height: 16px;
    border-radius: 999px;
    background: var(--brand-primary, #e60000);
}

.customer-profile .profile-section h2 {
    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;

    color: #293446 !important;
    font-size: 11px !important;
    line-height: 1.3;
    font-weight: 850 !important;
    text-transform: uppercase;
    letter-spacing: 0.065em;
}

.customer-profile .profile-grid {
    display: grid;
    gap: 14px 14px;
}

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

.customer-profile .profile-address-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(105px, .75fr);
}

.customer-profile .profile-address-zip {
    max-width: 160px;
}

.customer-profile .profile-span-two {
    grid-column: 1 / -1;
}

.customer-profile .profile-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.customer-profile .profile-field label {
    margin: 0 0 6px !important;
    color: #485468 !important;
    font-size: 11px !important;
    line-height: 1.35;
    font-weight: 750 !important;
}

.customer-profile .profile-field input {
    width: 100% !important;
    min-width: 0;
    height: 43px;

    margin: 0 !important;
    padding: 0 12px !important;
    box-sizing: border-box;

    border: 1px solid #dce1e6 !important;
    border-radius: 7px !important;
    background: #fff !important;

    color: #182235 !important;
    font: inherit !important;
    font-size: 13px !important;
    line-height: 1.2;

    outline: none;

    transition:
        border-color .16s ease,
        box-shadow .16s ease,
        background .16s ease;
}

.customer-profile .profile-field input:hover {
    border-color: #c6ccd3 !important;
}

.customer-profile .profile-field input:focus {
    border-color: var(--brand-primary, #e60000) !important;
    box-shadow: 0 0 0 3px rgba(230, 0, 0, 0.075);
}

.customer-profile .profile-field input[readonly] {
    border-color: #e6e9ed !important;
    background: #f6f8fa !important;
    color: #697386 !important;
    cursor: default;
}

/* Unternehmensblock optisch leicht absetzen */
.customer-profile .profile-section-company {
    margin-top: 22px !important;
    padding-top: 21px;
    border-top: 1px solid #edf0f3;
}

/* =========================================================
   MELDUNGEN
   ========================================================= */

.customer-profile .profile-message {
    flex: 0 0 auto;
    margin: 0 28px;
}

.customer-profile .profile-message:not(:empty) {
    margin-top: 18px;
    padding: 11px 13px;

    border: 1px solid #dfe5ea;
    border-radius: 7px;
    background: #f8fafc;

    color: #485468;
    font-size: 12px;
    line-height: 1.45;
}

/* =========================================================
   ACTIONS
   ========================================================= */

.customer-profile .profile-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;

    display: flex;
    justify-content: flex-end;

    margin: 26px 0 0 !important;
    padding: 18px 28px 22px;

    border-top: 1px solid #edf0f3;
    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.88) 0%,
            #fff 28%,
            #fff 100%
        );
}

.customer-profile .profile-actions button {
    min-height: 43px;

    padding: 10px 18px !important;

    border: 1px solid var(--brand-primary, #e60000) !important;
    border-radius: 7px !important;
    background: var(--brand-primary, #e60000) !important;

    color: #fff !important;
    font: inherit !important;
    font-size: 11px !important;
    line-height: 1.2;
    font-weight: 850 !important;
    text-transform: uppercase;
    letter-spacing: .035em;

    cursor: pointer;

    box-shadow: 0 7px 18px rgba(230, 0, 0, 0.16);

    transition:
        transform .16s ease,
        box-shadow .16s ease,
        opacity .16s ease;
}

.customer-profile .profile-actions button:hover {
    opacity: .96;
    transform: translateY(-1px);
    box-shadow: 0 9px 22px rgba(230, 0, 0, 0.21);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 760px) {
    #customerProfilePopup::before {
        background: rgba(15, 23, 42, 0.16);
    }

    .hero .customer-profile,
    .customer-profile {
        top: 12px !important;
        right: 12px !important;
        bottom: 12px !important;
        left: 12px !important;

        width: auto !important;
        max-width: none !important;
        height: auto !important;
    }

    .hero .profile-box,
    .customer-profile .profile-box {
        height: 100% !important;
        max-height: none !important;
        border-radius: 12px !important;
    }

    .customer-profile .profile-header {
        padding: 22px 20px 18px;
    }

    .customer-profile .profile-section {
        padding-left: 20px;
        padding-right: 20px;
    }

    .customer-profile .profile-actions {
        padding-left: 20px;
        padding-right: 20px;
    }

    .customer-profile .profile-message {
        margin-left: 20px;
        margin-right: 20px;
    }
}

@media (max-width: 540px) {
    .customer-profile .profile-grid-two,
    .customer-profile .profile-address-grid {
        grid-template-columns: 1fr;
    }

    .customer-profile .profile-span-two {
        grid-column: auto;
    }

    .customer-profile .profile-address-zip {
        max-width: none;
    }

    .customer-profile .profile-heading-row {
        padding-right: 4px;
    }

    .customer-profile .profile-header h1 {
        font-size: 23px !important;
    }

    .customer-profile .profile-actions button {
        width: 100%;
    }
}
