/* --- OVERLAY FÜR DIE STARTSEITE --- */
#profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7); 
    backdrop-filter: blur(5px); 
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 2000; 
}

.profile-container {
    width: 1100px;
    height: 750px;
    background: linear-gradient(135deg, #1f140f 0%, #2a1a12 100%);
    border: 6px solid #8b6b43;
    outline: 2px solid #3a2214;
    outline-offset: 4px;
    padding: 30px;
    box-sizing: border-box;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.9), 0 15px 40px rgba(0,0,0,0.8);
    display: grid;
    grid-template-areas: 
        "sidebar header"
        "sidebar main"; 
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr; 
    gap: 25px;
}

/* --- Header --- */
.profile-header {
    grid-area: header;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start; 
    gap: 20px;
}

.edit-icon, .close-button {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.6);
    transition: all 0.2s;
}

.edit-icon {
    background: radial-gradient(circle, #5a422a, #2a1a12);
    border: 2px solid #cda873;
    display: flex; justify-content: center; align-items: center; font-size: 1.5em;
}

.edit-icon:hover {
    background: radial-gradient(circle, #7a5a3a, #3a2214);
    transform: translateY(-2px); box-shadow: 0 6px 12px rgba(205, 168, 115, 0.3);
}

.close-button {
    background: linear-gradient(to bottom, #6a1a1a, #3a0a0a);
    border: 2px solid #a63a3a; position: relative;
}
.close-button::before, .close-button::after {
    content: ''; position: absolute; width: 4px; height: 25px;
    background-color: #e8dcc4; top: 50%; left: 50%; border-radius: 2px;
}
.close-button::before { transform: translate(-50%, -50%) rotate(45deg); }
.close-button::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* --- Sidebar --- */
.sidebar-content {
    grid-area: sidebar; display: flex; flex-direction: column; gap: 15px;
}

.profile-pic-container {
    display: flex; align-items: center; gap: 12px;
    background: rgba(0,0,0,0.4); 
    padding: 10px; 
    border: 1px solid #4a3b2c; border-radius: 8px; margin-bottom: 5px;
}

.profile-pic {
    width: 80px; height: 80px; border-radius: 50%;
    background: radial-gradient(circle, #4a3b2c, #1a0f0a); border: 3px solid #cda873;
    box-shadow: 0 0 15px rgba(205, 168, 115, 0.4), inset 0 0 20px #000;
    display: flex; justify-content: center; align-items: center; font-size: 0.8em; color: #8b6b43;
    flex-shrink: 0; 
}

.welcome-rank { 
    font-size: 1.05em; 
    text-shadow: 1px 1px 3px #000; 
    line-height: 1.3;
}

.username-limit {
    display: inline-block;
    max-width: 15ch; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.welcome-rank .highlight-text { 
    color: #cda873; 
    font-weight: bold; 
    font-size: 1.15em; 
}

.navigation-buttons {
    display: flex; flex-direction: column; gap: 10px; flex-grow: 1; justify-content: center;
}

/* --- Buttons --- */
.fantasy-button {
    width: 100%; height: 45px; background: linear-gradient(to bottom, #3a281c 0%, #1a0f0a 100%);
    border: 2px solid #8b6b43; border-radius: 4px; color: #e8dcc4; font-family: 'Georgia', serif; font-size: 1.1em;
    cursor: pointer; transition: all 0.2s; text-shadow: 2px 2px 4px #000; box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

.fantasy-button:hover { border-color: #cda873; color: #fff; transform: translateY(-2px); }
.fantasy-button.active {
    background: linear-gradient(to bottom, #5a3c24 0%, #2a1810 100%); border-color: #fce2a6; color: #fff; box-shadow: 0 0 15px rgba(205, 168, 115, 0.6);
}

/* Streamer & DND Modus */
.streamer-mode-toggle { margin-top: auto; height: 45px; transition: background 0.3s, border-color 0.3s; }

.streamer-off { background: linear-gradient(to bottom, #3a1a1a, #1a0505) !important; border-color: #8a2a2a !important; }
/* Färbt nur noch exakt die Status-Anzeigen (AUS) rot */
.streamer-off #streamerStatus, .streamer-off #dndStatus { color: #ff6b6b; }

.streamer-on { background: linear-gradient(to bottom, #1a3a1a, #051a05) !important; border-color: #2a8a2a !important; }
/* Färbt nur noch exakt die Status-Anzeigen (AN) grün mit Leuchteffekt */
.streamer-on #streamerStatus, .streamer-on #dndStatus { color: #6bff6b; text-shadow: 0 0 10px #6bff6b; }

/* --- Hauptbereich (Dynamische Ansichten) --- */
.main-content-area { grid-area: main; position: relative; overflow: hidden; }
.view-section { display: none; width: 100%; height: 100%; animation: fadeIn 0.4s ease-in-out; flex-direction: column;}
.view-section.active-view { display: flex; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-title {
    color: #cda873; font-size: 1.4em; border-bottom: 2px solid #5a422a; padding-bottom: 10px; margin-bottom: 15px; text-shadow: 1px 1px 2px #000;
}

/* Profil Layout */
#view-profil { display: none; grid-template-columns: 1fr 280px; gap: 25px; }
#view-profil.active-view { display: grid; }
.center-content, .friends-list-content { display: flex; flex-direction: column; }
.char-image-container {
    flex-grow: 1; background: linear-gradient(45deg, #150f0a 0%, #251a12 100%); border: 4px solid #5a422a; box-shadow: inset 0 0 30px #000; display: flex; justify-content: center; align-items: center;
}
.char-placeholder-text { color: #5a422a; font-size: 1.2em; text-align: center; border: 2px dashed #5a422a; padding: 20px; border-radius: 10px; }
.friends-list-container { flex-grow: 1; background: rgba(0,0,0,0.6); border: 2px solid #5a422a; padding: 15px; }
.friends-list-container ul { list-style: none; padding: 0; margin: 0; }
.friends-list-container li { padding: 10px; border-bottom: 1px solid #3a2214; color: #cda873; }

.single-column { flex-direction: column; }
.content-box { background: rgba(0,0,0,0.5); border: 2px solid #5a422a; padding: 20px; flex-grow: 1; overflow-y: auto;}
.scrollable-text { max-height: 500px; line-height: 1.6; }

/* Hilfe & Feedback Boxen */
.split-content-box { display: flex; gap: 20px; flex-grow: 1; }
.half-box { flex: 1; background: rgba(0,0,0,0.5); border: 2px solid #5a422a; padding: 20px; display: flex; flex-direction: column; }
.half-box h3 { color: #cda873; margin-top: 0; }
.half-box p { color: #b59f71; line-height: 1.5; flex-grow: 1; }
.small-gold-button { background: linear-gradient(#8b6b43, #5a3c24); border: 1px solid #cda873; color: #fff; padding: 10px; cursor: pointer; font-family: 'Georgia', serif; margin-top: 15px; }
.small-gold-button:hover { background: linear-gradient(#a38155, #704b2d); }
.stats-list { list-style: none; padding: 0; font-size: 1.2em; line-height: 2; }
.stats-list strong { color: #cda873; }

/* --- Modales Fenster (Bearbeitung) --- */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); justify-content: center; align-items: center; z-index: 1000; }
.modal-box { background: linear-gradient(135deg, #2a1a12 0%, #1f140f 100%); border: 4px solid #cda873; padding: 30px; width: 500px; box-shadow: 0 0 50px #000; }
.modal-box h2 { color: #fce2a6; margin-top: 0; border-bottom: 1px solid #8b6b43; padding-bottom: 10px;}
.edit-group { margin-bottom: 25px; }
.edit-group label { display: block; color: #cda873; font-weight: bold; margin-bottom: 5px; }
.hint-text { font-size: 0.85em; color: #8b6b43; margin-top: 0; margin-bottom: 10px; }
.file-input { background: #1a0f0a; color: #cda873; padding: 10px; border: 1px solid #5a422a; width: 100%; box-sizing: border-box; }
.fantasy-select { width: 100%; padding: 10px; background: #1a0f0a; color: #cda873; border: 1px solid #5a422a; font-family: 'Georgia', serif; font-size: 1.1em; }
.modal-footer { text-align: right; margin-top: 30px; }
.close-modal-btn { width: auto; padding: 0 20px; height: 40px; }

/* =========================================
   ERWEITERUNG: ACHIEVEMENTS STYLING
   ========================================= */
.category-tabs {
    display: flex;
    flex-wrap: wrap;     
    justify-content: center; 
    gap: 10px;            
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
    padding: 0 15px;
}

.category-tabs .tab-btn {
    flex: 1 1 calc(25% - 10px);
    min-width: 110px;
    max-width: 200px;   
    padding: 10px 5px;  
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
}

.tab-btn { background: linear-gradient(to bottom, #3a281c 0%, #1a0f0a 100%); border: 2px solid #5a422a; color: #cda873; padding: 8px 16px; border-radius: 5px; cursor: pointer; font-size: 1em; font-family: 'Georgia', serif; transition: all 0.3s ease; }
.tab-btn:hover { background: linear-gradient(to bottom, #4a3525 0%, #2a1810 100%); border-color: #8b6b43; }
.tab-btn.active { background: linear-gradient(to bottom, #5a3c24 0%, #2a1810 100%); border-color: #fce2a6; color: #fff; box-shadow: 0 0 10px rgba(205, 168, 115, 0.4); }

.achievement-content-area { background: rgba(0,0,0,0.4); border: 2px solid #4a3b2c; border-radius: 8px; padding: 20px; flex-grow: 1; overflow-y: auto; }
.category-panel { display: none; }
.category-panel.active { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; }

.achievement-card { background-color: rgba(0, 0, 0, 0.5); border: 2px solid #5a422a; border-radius: 8px; padding: 15px; display: flex; align-items: center; gap: 15px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.achievement-card:hover { transform: translateY(-3px); cursor: pointer; }

.achievement-card.unlocked { border-color: #cda873; box-shadow: inset 0 0 15px rgba(205, 168, 115, 0.1); }
.achievement-card.unlocked .achievement-icon { text-shadow: 0 0 10px #cda873; }
.achievement-card.locked { opacity: 0.5; border-style: dashed; }
.achievement-card.locked .achievement-icon { filter: grayscale(100%); }

.achievement-icon { font-size: 35px; }
.achievement-details h2 { margin: 0 0 5px 0; font-size: 1.1em; color: #fce2a6; }
.achievement-details p { margin: 0; font-size: 0.9em; color: #b59f71; line-height: 1.3; }

.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.4); 
    border: 1px solid #5a422a;
    border-radius: 5px;
    margin-bottom: 8px;
}

.friend-info {
    display: flex;
    flex-direction: row; 
    align-items: center; 
    gap: 12px; 
    flex-grow: 1;
}

.friend-avatar, .friend-avatar-placeholder {
    width: 32px;  
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #cda873;
    flex-shrink: 0;
}

.friend-avatar-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #4a3b2c;
    font-size: 14px;
}

.friend-name-wrapper {
    display: flex;
    flex-direction: column; 
    justify-content: center;
    border: none !important;
}

.friend-name {
    color: #e8dcc4;
    font-weight: bold;
    font-size: 1rem;
    white-space: nowrap;
}

/* --- STATUS FARBEN --- */
.status-badge {
    font-size: 0.75rem;
    font-weight: bold;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    text-transform: none;
}

.status-offline { color: #888888 !important; } /* Grau */
.status-online  { color: #00ff88 !important; } /* Grün */
.status-lobby   { color: #ffd700 !important; } /* Gelb */
.status-game    { color: #ff4d4d !important; } /* Rot */

.friend-name {
    color: #e8dcc4;
    font-weight: bold;
    font-size: 1rem;
}

/* Buttons zum Löschen/Interagieren */
.friend-actions button {
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    opacity: 0.6;
}

.friend-actions button:hover { opacity: 1; }

/* --- STREAMERMODUS: CODES VERSTECKEN --- */
.streamer-hidden {
    filter: blur(8px) grayscale(1); 
    pointer-events: none;          
    user-select: none;
    transition: filter 0.3s ease;
}

/* Verhindert, dass der Text im Beitritts-Feld sichtbar ist */
#lobby-code-input.streamer-hidden {
    color: transparent !important;
    text-shadow: 0 0 12px #FFD700 !important;
    letter-spacing: 10px;
}

.streamer-hidden {
    filter: blur(8px) grayscale(1); 
    user-select: none;
    transition: filter 0.3s ease;
}

/* Speziell für das Eingabefeld (Lobby-Beitritt) */
#lobby-code-input.streamer-hidden {
    filter: none !important;
    pointer-events: auto !important; 
    letter-spacing: 5px;
}

/* --- Schicke Scrollbalken für Datenschutz & Impressum --- */

.achievement-content-area {
    max-height: 450px; 
    overflow-y: auto;
    padding-right: 5px; 
}

/* Breite des gesamten Scrollbalkens */
.scrollable-text::-webkit-scrollbar {
    width: 8px; 
}

/* Der Hintergrund (die Schiene) des Scrollbalkens */
.scrollable-text::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3); 
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.1); 
}

/* Der anfassbare Balken selbst */
.scrollable-text::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FFD700, #DAA520);
    border-radius: 10px;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}

/* Wenn man mit der Maus über den Balken fährt */
.scrollable-text::-webkit-scrollbar-thumb:hover {
    background: #FFD700; 
}