/* ==========================================
   CSS VARIABLEN (Für Light / Dark Mode)
   ========================================== */
:root {
    --bg-color: #f4f4f9;
    --text-color: #333;
    --nav-bg: #333;
    --nav-hover: #555;
    --dropdown-bg: #444;
    --chat-bg: #fff;
    --chat-header: #2c3e50;
    --chat-box-bg: #f9f9f9;
    --chat-user-bg: #007bff;
    --chat-ai-bg: #e9ecef;
    --chat-ai-text: #333;
    --input-bg: #fff;
    --border-color: #ddd;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --nav-bg: #1e1e1e;
    --nav-hover: #333;
    --dropdown-bg: #2a2a2a;
    --chat-bg: #1e1e1e;
    --chat-header: #111;
    --chat-box-bg: #2a2a2a;
    --chat-user-bg: #0d6efd;
    --chat-ai-bg: #333;
    --chat-ai-text: #e0e0e0;
    --input-bg: #2a2a2a;
    --border-color: #444;
}

/* ==========================================
   GRUNDLAYOUT & PARTIKEL
   ========================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1; /* Partikel bleiben im Hintergrund */
}

/* ==========================================
   NAVIGATION
   ========================================== */
.navbar {
    background-color: var(--nav-bg);
    display: flex;
    justify-content: center; /* Zentriert den Inhalt */
    align-items: center;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

/* Brand nach links drücken */
.navbar-brand {
    position: absolute;
    left: 20px;
    color: white;
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 20px 15px;
    display: flex;
    align-items: center;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: var(--nav-hover);
}

/* Server-Status Punkte */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #888; /* Standard: Grau/Lädt */
    margin-left: 10px;
    transition: all 0.3s;
}
.status-dot.online {
    background-color: #28a745;
    box-shadow: 0 0 8px #28a745;
}
.status-dot.offline {
    background-color: #dc3545;
    box-shadow: 0 0 8px #dc3545;
}

/* Dropdown */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--dropdown-bg);
    min-width: 250px;
    max-height: 60vh; /* Verhindert, dass es aus dem Bildschirm ragt */
    overflow-y: auto; /* Scrollbar, wenn es zu viele Ordner sind */
    box-shadow: 0px 8px 16px rgba(0,0,0,0.4);
    z-index: 100;
    top: 100%;
    left: 0;
    border-radius: 0 0 8px 8px;
}

.dropdown-content a {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Dark Mode Button */
.theme-btn {
    position: absolute;
    right: 20px;
    background: none;
    border: 1px solid white;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}
.theme-btn:hover { background: white; color: black; }

.menu-toggle { display: none; }

.content {
    padding: 40px 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* ==========================================
   CHAT SYSTEM
   ========================================== */
#chat-container {
    width: 75%; /* Am PC 75% der Breite */
    max-width: 1200px;
    margin: 40px auto;
    background: var(--chat-bg);
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
    transition: all 0.3s;
}

#chat-header {
    background: var(--chat-header);
    color: white;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
}

#chat-box {
    height: 400px; /* Chat ist etwas höher geworden */
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--chat-box-bg);
}

.message {
    padding: 12px 18px;
    border-radius: 8px;
    max-width: 80%;
    line-height: 1.5;
    font-size: 15px;
}

.message.user {
    background: var(--chat-user-bg);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0;
}

.message.ai {
    background: var(--chat-ai-bg);
    color: var(--chat-ai-text);
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

#chat-input-area {
    display: flex;
    border-top: 1px solid var(--border-color);
    background: var(--input-bg);
}

#chat-input {
    flex-grow: 1;
    padding: 20px;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-color);
    font-size: 16px;
}

#chat-send {
    padding: 0 30px;
    background: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}

#chat-send:hover { background: #218838; }
#chat-send:disabled { background: var(--border-color); cursor: not-allowed; }

/* ==========================================
   HANDY OPTIMIERUNG
   ========================================== */
@media screen and (max-width: 900px) {
    .navbar { flex-direction: column; align-items: flex-start; padding-top: 60px; }
    .navbar-brand { top: 15px; }
    .theme-btn { top: 15px; right: 60px; }
    .menu-toggle {
        display: block; color: white; font-size: 28px; cursor: pointer;
        position: absolute; top: 10px; right: 20px;
    }
    .nav-links { flex-direction: column; width: 100%; display: none; }
    .nav-links.active { display: flex; }
    .nav-links a { padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
    .dropdown-content { position: static; display: none; max-height: none; }
    .dropdown.active .dropdown-content { display: block; }
    
    /* CHAT AUF DEM HANDY */
    #chat-container {
        width: 95%; /* Fast die volle Breite auf dem Handy */
    }
}

/* MARKDOWN STYLING FÜR KI */
.message.ai p { margin-top: 0; margin-bottom: 10px; }
.message.ai p:last-child { margin-bottom: 0; }
.message.ai pre {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 14px;
    margin: 10px 0;
}
.message.ai code {
    font-family: 'Courier New', Courier, monospace;
    background-color: rgba(0,0,0,0.1);
    padding: 2px 4px;
    border-radius: 4px;
}
.message.ai pre code {
    background-color: transparent;
    padding: 0;
}

#chat-header {
    background: var(--chat-header);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between; /* Text links, Button rechts */
    align-items: center;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Der neue Reset Button */
#chat-clear {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

#chat-clear:hover {
    background: rgba(255, 255, 255, 0.3);
}