/* style.css - Gemini Style Dark Mode */

:root {
    --bg-color: #131314;       /* Gemini Deep Background */
    --surface-color: #1E1F20;  /* Input Feld & User Bubble Hintergrund */
    --text-primary: #E3E3E3;   /* Haupttext */
    --text-secondary: #C4C7C5; /* Nebentext */
    --accent-color: #A8C7FA;   /* Google Blue (Light) */
    --border-color: #444746;   /* Subtile Grenzen */
    --user-bubble-bg: #282A2C; /* User Bubble Farbe */
}

body {
    font-family: 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    line-height: 1.6;
}

/* --- LOGIN OVERLAY (Modernisiert) --- */
#auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(19, 19, 20, 0.95); /* Fast deckend */
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
}

.login-box {
    background-color: var(--surface-color);
    width: 100%; max-width: 380px;
    padding: 40px; border-radius: 24px; /* Runde Ecken */
    display: flex; flex-direction: column; gap: 15px;
    text-align: center;
}

.login-box h2 { font-weight: 400; margin-bottom: 20px; color: var(--text-primary); }

.login-box input {
    width: 100%; padding: 16px; border-radius: 12px;
    border: 1px solid var(--border-color); background: var(--bg-color);
    color: var(--text-primary); font-size: 1rem; box-sizing: border-box;
    transition: border 0.2s;
}
.login-box input:focus { border-color: var(--accent-color); outline: none; }

.login-box button {
    width: 100%; padding: 14px; border-radius: 24px; border: none;
    background: var(--text-primary); color: var(--bg-color); /* Invers */
    font-weight: 500; cursor: pointer; font-size: 1rem; margin-top: 10px;
}
.login-box button:hover { opacity: 0.9; }
.login-box a { color: var(--accent-color); text-decoration: none; }

/* --- HAUPT LAYOUT --- */
.chat-container {
    display: flex; flex-direction: column;
    height: 100%; width: 100%;
    background-color: var(--bg-color);
}

/* --- HEADER (Minimalistisch) --- */
.chat-header {
    padding: 20px 40px;
    background-color: transparent; /* Kein Hintergrundbalken mehr */
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-secondary);
}

#header-username { font-size: 1rem; font-weight: 500; }

#logoutBtn {
    background: transparent; border: none;
    color: var(--accent-color); font-size: 0.9rem; cursor: pointer;
    padding: 8px 16px; border-radius: 20px;
}
#logoutBtn:hover { background-color: rgba(168, 199, 250, 0.1); }

/* --- CHAT FENSTER --- */
.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex; flex-direction: column;
    gap: 30px; /* Mehr Luft zwischen Nachrichten */
}

/* --- NACHRICHTEN STYLING --- */
.message {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Zentrierter Content Bereich */
.bubble {
    width: 100%;
    max-width: 800px;
    font-size: 1.05rem; /* Etwas größer, besser lesbar */
    position: relative;
}

/* === BOT NACHRICHTEN (Gemini Style: Links, kein Hintergrund) === */
.message.bot { justify-content: center; }
.message.bot .bubble {
    background-color: transparent;
    color: var(--text-primary);
    padding: 0; /* Kein Padding, da kein Hintergrund */
}

/* Optional: Kleines Icon vor Bot-Nachricht (CSS Hack) */
.message.bot .bubble::before {
    content: "✨"; /* Gemini Sparkle */
    position: absolute; left: -30px; top: 0;
    font-size: 1.2rem;
    opacity: 0.8;
}

/* === USER NACHRICHTEN (Gemini Style: Rechts, Bubble) === */
.message.user { justify-content: center; }
.message.user .bubble {
    background-color: var(--user-bubble-bg);
    color: var(--text-primary);
    padding: 15px 25px;
    border-radius: 24px 24px 4px 24px; /* Runde Ecken, eine eckig */
    margin-left: auto; /* Nach rechts schieben (innerhalb der max-width) */
    width: fit-content; /* Nur so breit wie der Text */
    max-width: 80%; /* Aber nicht breiter als 80% */
}
/* Damit der User Block im zentrierten Layout rechts erscheint: */
.message.user { align-items: flex-end; } 
/* Korrektur für das Zentrierungs-Layout: */
.message.user .bubble { margin-right: 0; margin-left: auto; } 
/* Da .message flex-center ist, müssen wir tricksen um User nach rechts zu kriegen innerhalb der 800px */
.message.user { 
    padding-left: 20%; /* Platz links lassen */
}


/* --- INPUT BEREICH (Floating Pill) --- */
.chat-input-area {
    padding: 20px 20px 40px 20px; /* Mehr Platz unten */
    background: transparent; /* Kein Verlauf mehr */
    display: flex; justify-content: center;
}

.input-wrapper {
    width: 100%; max-width: 800px;
    background-color: var(--surface-color);
    border-radius: 30px; /* Die Pille */
    border: 1px solid transparent;
    display: flex; align-items: center;
    padding: 8px 15px;
    transition: background 0.2s, border 0.2s;
    position: relative;
}

.input-wrapper:focus-within {
    background-color: #2D2E31; /* Etwas heller bei Fokus */
    border-color: var(--border-color);
}

.input-wrapper input[type="text"] {
    flex: 1; padding: 12px;
    background: transparent; border: none;
    color: var(--text-primary); font-size: 1rem; outline: none;
}

/* Buttons (Icons) */
.input-wrapper button {
    background: transparent; border: none;
    width: 40px; height: 40px; border-radius: 50%;
    cursor: pointer; color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.input-wrapper button:hover { background-color: rgba(255,255,255,0.1); color: var(--text-primary); }
#sendBtn { color: var(--text-primary); } 
#sendBtn:hover { color: var(--accent-color); }

/* File Preview als kleiner Chip über dem Input */
/* Dateianhang Vorschau (Chip Style) */
#filePreview {
    display: none; /* Standardmäßig aus */
    
    position: absolute;
    top: -60px; /* Schwebt über dem Input Feld */
    left: 10px; /* Links bündig mit leichtem Einzug */
    transform: none; /* Kein Zentrieren mehr! */
    
    background-color: #2D2E31; /* Dunkler Hintergrund */
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    
    padding: 8px 16px;
    border-radius: 12px; /* Runde Ecken */
    font-size: 0.9rem;
    font-weight: 500;
    
    /* Flexbox für Icon und Text */
    align-items: center;
    gap: 10px;
    
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); /* Schöner Schatten */
    z-index: 10;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Markdown Styles für Gemini */
.bubble h3 { font-weight: 500; font-size: 1.2rem; margin-top: 20px; color: var(--text-primary); }
.bubble strong { color: #FFF; font-weight: 600; }
.bubble code { background: #2D2E31; padding: 2px 6px; border-radius: 6px; font-family: 'Roboto Mono', monospace; font-size: 0.9em; }
.bubble pre { background: #1E1F20; border: 1px solid var(--border-color); padding: 20px; border-radius: 12px; overflow-x: auto; margin: 15px 0; }
.bubble ul { margin-left: 20px; }
.bubble li { margin-bottom: 8px; }

/* Typing Indicator */
.typing-indicator {
    text-align: left;
    margin-left: 45px; /* Passend zum Bot-Icon eingerückt */
    font-size: 0.9rem;
    color: var(--text-secondary);
    
    position: absolute; 
    bottom: 100px; /* Schwebt über der Eingabe */
    left: 0;
    right: 0;
    width: 100%;
    max-width: 800px; /* Begrenzung wie beim Text */
    margin: 0 auto;   /* Zentrieren */
    padding-left: 20px; /* Kleiner Abstand links */
    
    display: none; /* <--- WICHTIG: Standardmäßig unsichtbar! */
    pointer-events: none; /* Klicks gehen durch */
    animation: pulse 1.5s infinite;
}

@keyframes pulse { 
    0% { opacity: 0.5; } 
    50% { opacity: 1; } 
    100% { opacity: 0.5; } 
}