/* Profil-Verbesserungen: Hintergrundbild, neue Badge-Optik, Badge-Info, ohne app.js */

.profile-modal-box.profile-enhanced-box {
    max-width: 860px;
    width: min(860px, calc(100vw - 32px));
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(rgba(7, 12, 21, 0.78), rgba(7, 12, 21, 0.94)),
        url('images/profile/profile-modal-bg.png') center center / cover no-repeat !important;
    border: 1px solid rgba(215, 0, 28, 0.35) !important;
    border-top-color: #7a0012 !important;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255,255,255,0.06);
}

.profile-modal-box.profile-enhanced-box::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 215, 0, 0.16), transparent 28%),
        radial-gradient(circle at 84% 20%, rgba(213, 0, 28, 0.16), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,0.04), transparent 24%, rgba(0,0,0,0.20));
}

.profile-modal-box.profile-enhanced-box > * {
    position: relative;
    z-index: 1;
}

.profile-hero.profile-enhanced-hero {
    background: linear-gradient(135deg, rgba(0,0,0,0.46), rgba(122,0,18,0.18));
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(2px);
}

.profile-modal-avatar.profile-enhanced-avatar {
    width: 92px;
    height: 92px;
    border: 3px solid rgba(215, 0, 28, 0.92);
    background: rgba(10, 10, 14, 0.82);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.03), 0 10px 24px rgba(0,0,0,0.26);
}

.profile-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.profile-meta-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(8, 8, 10, 0.66);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.92);
    font-size: 0.8rem;
    font-weight: 800;
}

.profile-meta-pill strong {
    color: var(--gold);
    margin-left: 6px;
}

.profile-stats-grid.profile-enhanced-grid div {
    background: rgba(5, 8, 14, 0.54);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(2px);
}

.profile-stats-grid.profile-enhanced-grid strong {
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.14);
}

.profile-badges.profile-enhanced-badges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.profile-badge-chip {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(215, 0, 28, 0.34);
    background: linear-gradient(135deg, rgba(16, 18, 26, 0.86), rgba(7, 9, 15, 0.92));
    color: #fff;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.profile-badge-chip:hover,
.profile-badge-chip:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(255, 215, 0, 0.56);
    box-shadow: 0 10px 22px rgba(0,0,0,0.22), 0 0 0 1px rgba(255,255,255,0.04) inset;
    outline: none;
}

.profile-badge-chip.is-active {
    border-color: rgba(255, 215, 0, 0.82);
    background: linear-gradient(135deg, rgba(34, 27, 10, 0.94), rgba(13, 11, 10, 0.96));
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.10) inset, 0 12px 26px rgba(0,0,0,0.24);
}

.profile-badge-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(213, 0, 28, 0.16));
    font-size: 1.1rem;
}

.profile-badge-text {
    min-width: 0;
}

.profile-badge-name {
    display: block;
    color: #fff;
    font-weight: 900;
    font-size: 0.86rem;
    line-height: 1.18;
}

.profile-badge-hint {
    display: block;
    color: rgba(255,255,255,0.60);
    font-size: 0.72rem;
    line-height: 1.2;
    margin-top: 2px;
}

.profile-badge-info-box {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(5, 8, 14, 0.72);
    border: 1px solid rgba(255,255,255,0.08);
}

.profile-badge-info-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gold);
    font-size: 0.94rem;
    font-weight: 900;
    margin-bottom: 6px;
}

.profile-badge-info-text {
    color: rgba(255,255,255,0.88);
    font-size: 0.86rem;
    line-height: 1.42;
}

.profile-empty-badges {
    padding: 14px;
    border-radius: 12px;
    background: rgba(5, 8, 14, 0.58);
    border: 1px dashed rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.74);
    font-size: 0.88rem;
}

.profile-close-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.profile-close-row .btn-info {
    min-width: 140px;
}

@media (max-width: 700px) {
    .profile-modal-box.profile-enhanced-box {
        width: calc(100vw - 24px);
        padding: 18px 16px;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }

    .profile-hero.profile-enhanced-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    .profile-hero-meta {
        justify-content: center;
    }

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

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

    .profile-close-row .btn-info {
        width: 100%;
    }
}


.profile-badge-summary {
    margin: 4px 0 12px 0;
    color: rgba(255,255,255,0.74);
    font-size: 0.86rem;
    line-height: 1.35;
}

.profile-badge-summary strong {
    color: var(--gold);
}

.profile-badge-chip.is-locked {
    opacity: 0.55;
    filter: grayscale(0.85);
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, rgba(15, 16, 20, 0.74), rgba(7, 8, 12, 0.86));
}

.profile-badge-chip.is-locked .profile-badge-icon {
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
}

.profile-badge-chip.is-locked .profile-badge-name {
    color: rgba(255,255,255,0.72);
}

.profile-badge-chip.is-locked .profile-badge-hint {
    color: rgba(255,255,255,0.48);
}

.profile-badge-chip.is-locked:hover,
.profile-badge-chip.is-locked:focus-visible {
    opacity: 0.76;
    filter: grayscale(0.45);
    border-color: rgba(255, 215, 0, 0.30);
}

.profile-badge-chip.is-locked.is-active {
    opacity: 0.86;
    filter: grayscale(0.20);
    border-color: rgba(180, 180, 180, 0.40);
    background: linear-gradient(135deg, rgba(28, 28, 32, 0.92), rgba(10, 10, 14, 0.94));
}

.profile-badge-chip.is-unlocked .profile-badge-icon {
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.14);
}

.profile-badge-info-title em {
    margin-left: auto;
    font-style: normal;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.66rem;
    line-height: 1;
    font-weight: 900;
    white-space: nowrap;
}

.profile-badge-info-title em.is-unlocked {
    color: #1a1200;
    background: linear-gradient(135deg, #fff1a8, #d5a514);
}

.profile-badge-info-title em.is-locked {
    color: rgba(255,255,255,0.72);
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.10);
}

@media (max-width: 700px) {
    .profile-badge-info-title {
        flex-wrap: wrap;
    }

    .profile-badge-info-title em {
        margin-left: 0;
    }
}

/* Fix: Profil-Hintergrundbild sicher sichtbar halten */
#profile-modal .profile-modal-box.profile-enhanced-box,
.custom-modal-box.profile-modal-box.profile-enhanced-box {
    background:
        linear-gradient(rgba(7, 12, 21, 0.78), rgba(7, 12, 21, 0.94)),
        url('images/profile/profile-modal-bg.png') center center / cover no-repeat !important;
}


/* -------- Profilfenster Design-Fix -------- */
/* Entfernt die unschönen geerbten Badge-Pills und ordnet alles ruhiger an. */

.profile-modal-box.profile-enhanced-box {
    max-width: 900px;
    width: min(900px, calc(100vw - 32px));
    background:
        linear-gradient(rgba(6, 11, 19, 0.70), rgba(6, 11, 19, 0.92)),
        url('images/profile/profile-modal-bg.png') center center / cover no-repeat !important;
}

.profile-modal-box.profile-enhanced-box::before {
    background:
        radial-gradient(circle at 18% 15%, rgba(255, 215, 0, 0.10), transparent 24%),
        radial-gradient(circle at 86% 18%, rgba(213, 0, 28, 0.11), transparent 24%),
        linear-gradient(180deg, rgba(255,255,255,0.03), transparent 22%, rgba(0,0,0,0.18));
}

.profile-hero.profile-enhanced-hero {
    padding: 16px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(0,0,0,0.42), rgba(122,0,18,0.14));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.profile-modal-avatar.profile-enhanced-avatar {
    width: 88px;
    height: 88px;
}

.profile-hero-text h3,
.profile-modal-box h3 {
    letter-spacing: 0.01em;
}

.profile-meta-pill {
    background: rgba(5, 8, 14, 0.82);
    border-color: rgba(255,255,255,0.08);
}

.profile-section-title {
    margin: 16px 0 8px 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.profile-stats-grid.profile-enhanced-grid {
    gap: 12px;
}

.profile-stats-grid.profile-enhanced-grid div {
    padding: 14px 12px;
    border-radius: 14px;
    background: rgba(5, 8, 14, 0.64);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.profile-stats-grid.profile-enhanced-grid strong {
    font-size: 1.7rem;
}

.profile-badge-summary {
    margin: 2px 0 12px 0;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.78);
}

.profile-badge-summary strong {
    color: var(--gold);
}

.profile-badges.profile-enhanced-badges {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

/* WICHTIG: alte globale .profile-badges span-Styles neutralisieren */
.profile-enhanced-badges span,
.profile-enhanced-badges em {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}

.profile-badge-chip {
    appearance: none;
    min-height: 88px;
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: linear-gradient(135deg, rgba(11, 15, 25, 0.88), rgba(7, 10, 16, 0.93));
    color: #fff;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.profile-badge-chip:hover,
.profile-badge-chip:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(255, 215, 0, 0.44);
    box-shadow: 0 10px 22px rgba(0,0,0,0.22);
    outline: none;
}

.profile-badge-chip.is-active {
    border-color: rgba(255, 215, 0, 0.72);
    background: linear-gradient(135deg, rgba(31, 25, 13, 0.94), rgba(13, 11, 10, 0.97));
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.08) inset, 0 14px 26px rgba(0,0,0,0.24);
}

.profile-badge-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.16), rgba(213, 0, 28, 0.12)) !important;
    font-size: 1.18rem;
}

.profile-badge-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-badge-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.profile-badge-name {
    min-width: 0;
    color: #ffffff !important;
    font-weight: 900;
    font-size: 0.9rem;
    line-height: 1.18;
    text-wrap: balance;
}

.profile-badge-state {
    flex: 0 0 auto;
    align-self: flex-start;
    font-style: normal;
    font-size: 0.64rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.03em;
    white-space: nowrap;
    padding: 5px 8px !important;
    border-radius: 999px !important;
}

.profile-badge-state.is-unlocked {
    color: #1a1200;
    background: linear-gradient(135deg, #fff1a8, #d5a514) !important;
}

.profile-badge-state.is-locked {
    color: rgba(255,255,255,0.72);
    background: rgba(255,255,255,0.08) !important;
}

.profile-badge-subline {
    color: rgba(255,255,255,0.60) !important;
    font-size: 0.73rem;
    line-height: 1.2;
}

.profile-badge-chip.is-locked {
    opacity: 0.62;
    filter: grayscale(0.55);
    border-color: rgba(255,255,255,0.08);
    background: linear-gradient(135deg, rgba(12, 14, 20, 0.80), rgba(7, 8, 12, 0.90));
}

.profile-badge-chip.is-locked .profile-badge-icon {
    background: linear-gradient(135deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03)) !important;
}

.profile-badge-chip.is-locked .profile-badge-name {
    color: rgba(255,255,255,0.74) !important;
}

.profile-badge-chip.is-locked .profile-badge-subline {
    color: rgba(255,255,255,0.46) !important;
}

.profile-badge-chip.is-locked:hover,
.profile-badge-chip.is-locked:focus-visible {
    opacity: 0.82;
    filter: grayscale(0.18);
    border-color: rgba(255, 215, 0, 0.24);
}

.profile-badge-info-box {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(5, 8, 14, 0.72);
    border: 1px solid rgba(255,255,255,0.08);
}

.profile-badge-info-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--gold);
    font-size: 0.96rem;
    font-weight: 900;
    margin-bottom: 7px;
}

.profile-badge-info-title em {
    margin-left: auto !important;
    font-style: normal;
    font-size: 0.66rem;
    line-height: 1;
    font-weight: 900;
    white-space: nowrap;
    padding: 5px 8px !important;
    border-radius: 999px !important;
}

.profile-badge-info-title em.is-unlocked {
    color: #1a1200;
    background: linear-gradient(135deg, #fff1a8, #d5a514) !important;
}

.profile-badge-info-title em.is-locked {
    color: rgba(255,255,255,0.72);
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
}

.profile-badge-info-text {
    color: rgba(255,255,255,0.9);
    font-size: 0.88rem;
    line-height: 1.45;
}

.profile-close-row {
    margin-top: 16px;
}

@media (max-width: 860px) {
    .profile-badges.profile-enhanced-badges {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .profile-modal-box.profile-enhanced-box {
        width: calc(100vw - 20px);
        padding: 16px 14px;
    }

    .profile-stats-grid,
    .profile-stats-grid.profile-stats-grid-wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .profile-badges.profile-enhanced-badges {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .profile-badge-chip {
        min-height: 80px;
        padding: 11px 12px;
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 10px;
    }

    .profile-badge-icon {
        width: 40px;
        height: 40px;
        font-size: 1.08rem;
    }

    .profile-badge-name {
        font-size: 0.85rem;
    }

    .profile-badge-state {
        font-size: 0.6rem;
    }

    .profile-badge-subline {
        font-size: 0.7rem;
    }
}


/* -------- Profilfenster Scroll-/Schließen-Fix -------- */
/* Verhindert endloses Scrollen und hält den Schließen-Button sichtbar. */

#profile-modal.custom-modal-overlay {
    overflow: hidden !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
    box-sizing: border-box !important;
}

#profile-modal .profile-modal-box.profile-enhanced-box {
    display: flex !important;
    flex-direction: column !important;
    max-height: calc(100vh - 24px) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#profile-modal #profile-modal-content {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    max-height: 100% !important;
}

#profile-modal .profile-enhanced-hero,
#profile-modal .profile-close-row {
    flex: 0 0 auto !important;
}

#profile-modal .profile-close-row {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 5 !important;
    margin: 12px -2px -2px -2px !important;
    padding: 12px 2px 2px 2px !important;
    background: linear-gradient(180deg, rgba(5, 8, 14, 0), rgba(5, 8, 14, 0.88) 32%, rgba(5, 8, 14, 0.96) 100%) !important;
}

#profile-modal .profile-badge-info-box {
    flex: 0 0 auto !important;
}

@media (min-width: 701px) {
    #profile-modal .profile-modal-box.profile-enhanced-box {
        max-height: min(900px, calc(100vh - 24px)) !important;
    }

    #profile-modal #profile-modal-content {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 4px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin;
    }

    #profile-modal #profile-modal-content::-webkit-scrollbar {
        width: 8px;
    }

    #profile-modal #profile-modal-content::-webkit-scrollbar-track {
        background: rgba(255,255,255,0.04);
        border-radius: 999px;
    }

    #profile-modal #profile-modal-content::-webkit-scrollbar-thumb {
        background: rgba(255, 215, 0, 0.35);
        border-radius: 999px;
    }
}

@media (max-width: 700px) {
    #profile-modal.custom-modal-overlay {
        align-items: flex-start !important;
        padding: 10px !important;
        overflow: hidden !important;
    }

    #profile-modal .profile-modal-box.profile-enhanced-box {
        max-height: calc(100vh - 20px) !important;
        overflow: hidden !important;
    }

    #profile-modal #profile-modal-content {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 2px !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #profile-modal .profile-close-row {
        margin-top: 10px !important;
    }
}
