/* Globale Variablen für Farben und Stile */
:root {
    --background-color: #1e192a;
    --card-background: #2a243f;
    --text-color: #e0d8ff;
    --header-color: #ffffff;
    --accent-color: #a855f7; /* Lila */
    --button-color: #4a407c; /* Dunkleres Lila für Button */
    --button-hover-color: #5f52a0; /* Helleres Lila für Hover */
    --online-color: #43b581;
    --idle-color: #faa61a;
    --dnd-color: #f04747;
    --offline-color: #747f8d;
    --border-color: rgba(168, 85, 247, 0.3);
    --spotify-green: #1DB954;
}

/* Grundlegende Resets und Body Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center; /* Zentriert den .container horizontal */
    align-items: center; /* NEU: Zentriert den .container vertikal, wenn der Inhalt kürzer als die Bildschirmhöhe ist */
    min-height: 100vh; /* Stellt sicher, dass der Body mindestens die volle Bildschirmhöhe hat */
    overflow-x: hidden; 
    overflow-y: auto; /* Erlaubt Scrollen, wenn der Inhalt länger als der Bildschirm ist */
    position: relative;
    padding: 20px; /* Abstand zu den Bildschirmrändern */
}

/* Video Hintergrund Styling */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
}

#bg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 12, 20, 0.85); 
    z-index: -1;
}

/* Hauptcontainer für User-Card und Widget-Sektion */
.container {
    z-index: 1;
    display: flex;
    flex-direction: column; /* User-Card und Widget-Sektion untereinander */
    align-items: center; /* Zentriert die Kinder horizontal */
    gap: 25px; /* Abstand zwischen User-Card und Widget-Sektion */
    width: 100%;
    max-width: 400px; /* Maximale Breite des Hauptcontainers */
}

/* Die Benutzerkarte - Animation */
@keyframes cardFadeInUp {
    from { opacity: 0; transform: translateY(30px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.user-card {
    background-color: var(--card-background);
    border-radius: 15px;
    overflow: hidden;
    width: 380px;
    max-width: 100%; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-color);
    border: 1px solid var(--border-color);
    position: relative;
    animation: cardFadeInUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
    flex-shrink: 0;
}

/* Banner oben */
.banner {
    height: 120px;
    background-size: cover;
    background-position: center; 
    overflow: hidden;
}

.banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Avatar Bereich */
.avatar-section {
    position: relative;
    margin-top: -48px;
    padding-left: 20px;
    display: flex;
    align-items: flex-end;
    height: 96px;
}

.avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 6px solid var(--card-background);
    display: block;
    background-color: var(--background-color);
    transition: transform 0.3s ease-out;
}
.avatar:hover {
    transform: scale(1.06);
}

/* Status Punkt - Animation */
@keyframes statusPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 6px var(--status-glow-color, transparent); }
    50% { transform: scale(1.1); box-shadow: 0 0 12px var(--status-glow-color, transparent); }
}

.status-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 4px solid var(--card-background);
    position: absolute;
    bottom: 5px;
    left: 80px;
}
.status-dot.online { background-color: var(--online-color); --status-glow-color: var(--online-color); animation: statusPulse 2s infinite ease-in-out; }
.status-dot.idle { background-color: var(--idle-color); --status-glow-color: var(--idle-color); animation: statusPulse 2.2s infinite ease-in-out; }
.status-dot.dnd { background-color: var(--dnd-color); --status-glow-color: var(--dnd-color); animation: statusPulse 1.8s infinite ease-in-out; }
.status-dot.offline { background-color: var(--offline-color); animation: none; box-shadow: none; }

/* Hauptinformationsbereich Text etc. */
.user-info {
    padding: 15px 20px 20px 20px;
    text-align: left;
}

/* Header für Name und Button */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.username {
    color: var(--header-color);
    font-size: 1.5em;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
    flex-grow: 1;
    margin-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.username #discriminator {
    color: var(--text-color);
    font-size: 0.7em;
    font-weight: 400;
    opacity: 0.8;
}

/* Styling für den Profil-Button */
.profile-button {
    background-color: var(--button-color);
    color: var(--header-color);
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
}

.profile-button:hover {
    background-color: var(--button-hover-color);
    transform: translateY(-1px);
}
.profile-button:active {
    transform: translateY(0px);
}
.profile-button.disabled {
    background-color: var(--offline-color);
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.6;
}


.creation-date {
    font-size: 0.8em;
    color: var(--text-color);
    opacity: 0.6;
    margin-bottom: 10px;
}

/* Status Text */
.status-text {
    font-size: 0.95em;
    margin-bottom: 12px;
    min-height: 1.2em;
    color: var(--text-color);
    opacity: 0.9;
    word-wrap: break-word;
}
.status-text img {
    height: 1.1em;
    width: 1.1em;
    vertical-align: -0.2em;
    margin: 0 1px;
}

/* Badges */
.badges {
    margin-bottom: 15px;
    min-height: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.badge {
    height: 22px;
    width: auto;
    vertical-align: middle;
    cursor: help;
    transition: transform 0.2s ease, filter 0.2s ease;
}
.badge:hover {
    transform: scale(1.15);
    filter: brightness(1.1);
}
.badge-placeholder {
    font-size: 0.8em;
    font-style: italic;
    opacity: 0.6;
}

/* Section Header */
.section-header {
    color: var(--header-color);
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    border-top: 1px solid rgba(224, 216, 255, 0.15);
    margin-top: 15px;
    padding-top: 15px;
}

/* Aktivitäts- & Status Sections */
.activity-section, .custom-status-section, .spotify-section {
    margin-top: 0;
    padding-top: 0;
}
.custom-status-section p {
    font-size: 0.95em;
    line-height: 1.4;
    word-wrap: break-word;
}
.custom-status-section img {
     height: 1.1em;
     width: 1.1em;
     vertical-align: -0.2em;
     margin-right: 4px;
}

/* Aktivitäts-Details */
.activity-content {
    font-size: 0.9em;
    line-height: 1.4;
}
.activity-content p#activityText {
    margin-bottom: 5px;
}
.activity-content strong {
    font-weight: 600;
    color: var(--header-color);
}

.activity-timestamp {
    font-size: 0.8em;
    color: var(--text-color);
    opacity: 0.7;
    margin-top: 6px;
}

/* Spotify Section Styling */
.spotify-content { display: flex; align-items: flex-start; gap: 15px; }
.spotify-album-art { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; background-color: var(--background-color); flex-shrink: 0; transition: transform 0.3s ease; }
.spotify-album-art:hover { transform: scale(1.05) rotate(2deg); }
.spotify-info { flex: 1; font-size: 0.9em; line-height: 1.4; min-width: 0; }
.spotify-info strong { font-weight: 600; color: var(--header-color); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spotify-info span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.9; }

/* Spotify Fortschrittsanzeige */
.spotify-progress { margin-top: 8px; }
.spotify-progress-bar-container { background-color: rgba(255, 255, 255, 0.1); border-radius: 4px; height: 6px; overflow: hidden; margin-bottom: 4px; }
.spotify-progress-bar { background-color: var(--spotify-green); height: 100%; width: 0%; border-radius: 4px; transition: width 0.5s linear; }
.spotify-time { font-size: 0.8em; color: var(--text-color); opacity: 0.7; }

/* Generic Activity Progress */
.activity-progress { margin-top: 8px; }
.activity-progress-bar-container { background-color: rgba(255, 255, 255, 0.1); border-radius: 4px; height: 6px; overflow: hidden; margin-bottom: 4px; }
.activity-progress-bar { background-color: var(--accent-color); height: 100%; width: 0%; border-radius: 4px; transition: width 0.5s linear; }
.activity-progress-time { font-size: 0.8em; color: var(--text-color); opacity: 0.7; }

/* Lanyard Credit Styling */
.lanyard-credit { margin-top: 15px; font-size: 0.8em; color: var(--text-color); opacity: 0.7; }
.lanyard-credit a { color: var(--accent-color); text-decoration: none; font-weight: 600; text-shadow: 0 0 8px rgba(168, 85, 247, 0.4); transition: color 0.2s ease; }
.lanyard-credit a:hover { text-decoration: underline; color: var(--header-color); }

/* Discord Widget Section Styling */
.discord-widget-section {
    background-color: var(--card-background);
    border-radius: 15px;
    padding: 15px;
    width: 380px; /* Gleiche Breite wie User-Card */
    max-width: 100%;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    text-align: center;
}

.widget-toggle-button {
    background-color: var(--button-color);
    color: var(--header-color);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-toggle-button:hover {
    background-color: var(--button-hover-color);
}

.toggle-arrow {
    display: inline-block;
    transition: transform 0.3s ease-in-out;
}

.widget-toggle-button[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

.widget-iframe-wrapper {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in-out 0.1s; /* Opacity transition leicht verzögert */
    border-radius: 8px; /* Für abgerundete Ecken des iframes */
    margin-top: 15px; /* Abstand zum Button */
    background-color: #2f2746; /* Hintergrund für den iframe, falls er Ränder hat oder transparent ist */
}

.widget-iframe-wrapper.expanded {
    max-height: 460px; /* Etwas Puffer für den iframe */
    opacity: 1;
}

.widget-iframe-wrapper iframe {
    width: 100%; /* Passt sich dem Wrapper an */
    height: 450px; /* Feste Höhe für das Discord Widget */
    border: none;
    border-radius: 8px; /* Stellt sicher, dass der iframe selbst auch abgerundet ist */
}

/* Responsive Anpassungen für kleinere Bildschirme, falls nötig */
@media (max-width: 420px) {
    .container {
        gap: 20px; /* Etwas weniger Abstand auf sehr kleinen Bildschirmen */
    }
    .user-card, .discord-widget-section {
        width: 100%; /* Volle Breite innerhalb des gepaddeten Body */
    }
}