@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

/* =================================
   Variablen & Grund-Setup
   ================================= */
:root {
    --primary-color: #4A90E2;
    --secondary-color: #F5A623;
    --background-color: #F8F9FA;
    --text-color: #333;
    --card-background: #FFFFFF;
    --border-radius: 8px;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --info-color: #6c757d;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* =================================
   Layout (Header, Main, Footer)
   ================================= */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 25px; /* Etwas kompakter */
    border-bottom: 1px solid #eee;
    background-color: var(--card-background);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky; /* Hält Header oben */
    top: 0;
    z-index: 1000;
}

.logo {
    display: block;
    width: 50px;
    height: 50px;
    background-image: url('images/logo-tands-500x500px-transparent.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    text-indent: -9999px;
    overflow: hidden;
    margin: 0;
}

nav {
    display: flex;
    align-items: center;
}

nav .nav-link {
    margin: 0 5px;
    padding: 8px 15px;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
    font-size: 1rem;
    display: inline-block;
    border: 1px solid transparent; /* Platzhalter für Hover */
}

nav .nav-link:hover, nav .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* Speziell für Buttons, falls du sie wieder brauchst */
nav button {
    margin: 0 5px;
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 1rem;
    transition: background-color 0.3s;
}
nav button:hover { background-color: #357ABD; }


main {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 20px; /* Nur seitliches Padding, oben/unten vom Margin */
}

footer {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 0.9em;
    margin-top: 40px;
    border-top: 1px solid #eee;
}

/* =================================
   Begrüßung & Icons (NEU)
   ================================= */
.greeting {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #e9f5ff; /* Leichtes Blau */
    border-radius: var(--border-radius);
    border-left: 6px solid var(--primary-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.greeting h1 {
    font-size: 1.9em; /* Groß */
    color: #2c3e50; /* Dunkleres Blau/Grau */
    margin: 0;
    font-weight: 700;
}

.greeting .user-icon {
    font-size: 1.4em; /* Icon Größe */
    margin-left: 12px;
    vertical-align: -0.1em; /* Bessere Ausrichtung */
}

/* =================================
   Views & Generelle Container
   ================================= */
.view {
    background-color: var(--card-background);
    border: 1px solid #e0e0e0;
    padding: 25px 30px;
    margin-top: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.view h2 {
    color: var(--primary-color);
    text-align: center;
    margin-top: 0;
    margin-bottom: 30px;
}
.view h3 {
    margin-top: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    color: var(--primary-color);
}
.admin-section { margin-bottom: 30px; }
.admin-section h3 { margin-bottom: 15px; }


/* =================================
   Formulare & Eingabefelder
   ================================= */
label { margin-bottom: 5px; display: block; font-weight: bold; color: #555; }
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
    display: block; width: 100%; padding: 12px; margin-bottom: 15px;
    border: 1px solid #ccc; border-radius: 5px; font-size: 1rem;
    font-family: 'Inter', sans-serif; box-sizing: border-box;
    transition: border-color 0.3s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}
input[readonly] { background-color: #e9ecef; cursor: not-allowed; }
.password-container { position: relative; margin-bottom: 15px; }
.password-container input { margin-bottom: 0; padding-right: 45px; }
.toggle-password {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 1.3em;
    color: #555; padding: 5px; line-height: 1;
}
.toggle-password.active { color: var(--primary-color); }

/* =================================
   Buttons
   ================================= */
button, input[type="submit"], .button-like { /* .button-like für Links, die wie Buttons aussehen */
    padding: 10px 20px; background-color: var(--primary-color); color: white;
    border: none; cursor: pointer; border-radius: 5px; font-size: 1rem;
    transition: background-color 0.3s, opacity 0.3s; text-decoration: none;
    display: inline-block; text-align: center;
}
button:hover, input[type="submit"]:hover, .button-like:hover {
    background-color: #357ABD; color: white;
}
button:disabled { background-color: #aaa; cursor: not-allowed; }
#generatePasswordBtn { background-color: var(--info-color); }
#generatePasswordBtn:hover { background-color: #5a6268; }
.delete-analysis-btn { background-color: var(--danger-color); padding: 5px 10px; font-size: 0.8em; }
.delete-analysis-btn:hover { background-color: #c82333; }
#readAloudBtn { background-color: var(--success-color); }
#readAloudBtn:hover { background-color: #218838; }
#readAloudBtn.playing { background-color: var(--warning-color); color: #333;}
#resetAnalysisBtn { background-color: var(--warning-color); color: #333; }
#resetAnalysisBtn:hover { background-color: #e0a800; }
.feedback-btn { background-color: var(--info-color); margin: 5px; }
.feedback-btn:hover { background-color: #5a6268; }

/* =================================
   Analyse-Sektion
   ================================= */
.textarea-container { position: relative; margin-bottom: 5px; }
#userInput { min-height: 120px; padding-right: 45px; }
#startSpeechBtn {
    position: absolute; right: 10px; top: 10px; background: none; border: none;
    font-size: 1.5em; cursor: pointer; color: #555; padding: 0;
}
#startSpeechBtn:hover { color: var(--primary-color); }
#startSpeechBtn.recording { color: var(--danger-color); animation: pulse 1s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
#charCounterContainer { text-align: right; font-size: 0.85em; color: #666; margin-bottom: 20px; }
#charCounterContainer.limit-reached { color: var(--danger-color); font-weight: bold; }
#analysisControls { display: flex; justify-content: center; margin-bottom: 25px; }
#analyzeBtn { background-color: var(--secondary-color); padding: 12px 25px; font-size: 1.1em; }
#analyzeBtn:hover { background-color: #E0951C; }
#output { margin-top: 20px; }
.result-card { background-color: #f9f9f9; padding: 15px; margin-bottom: 15px; border-radius: var(--border-radius); border: 1px solid #eee; }
.result-card h4 { margin-top: 0; color: var(--primary-color); border-bottom: 1px solid #eee; padding-bottom: 5px; margin-bottom: 10px; }
#feedbackSection { border-top: 1px dashed #ccc; padding-top: 15px; margin-top: 20px; text-align: center;}
#feedbackDone { margin-top: 20px; text-align: center; font-size: 2em; color: var(--success-color);}

/* =================================
   Kontext Filter
   ================================= */
.collapsible-header { background-color: #e9f5ff; padding: 10px 15px; cursor: pointer; border: 1px solid #ddeeff; border-radius: var(--border-radius) var(--border-radius) 0 0; display: flex; justify-content: space-between; align-items: center; }
.collapsible-header:hover { background-color: #d4e9fc; }
.collapsible-header h4 { margin: 0; color: var(--primary-color); font-size: 1em; }
.collapse-indicator { font-size: 0.8em; transition: transform 0.3s ease; }
.collapsible-header.open .collapse-indicator { transform: rotate(180deg); }
#contextFiltersContent { padding: 15px; background-color: #f0f8ff; border: 1px solid #ddeeff; border-top: none; border-radius: 0 0 var(--border-radius) var(--border-radius); }
.filter-option { margin-bottom: 8px; display: flex; align-items: center; }
.filter-option input[type="checkbox"] { margin-right: 8px; width: auto; margin-bottom: 0; }
.filter-option label { font-weight: normal; margin-bottom: 0; display: flex; align-items: center; cursor: pointer;}
.filter-option label strong { font-weight: bold; }
.filter-option span { font-weight: bold; margin-left: 4px; color: var(--secondary-color); }

/* =================================
   Lade-Indikator
   ================================= */
#loadingIndicator { display: none; flex-direction: column; justify-content: center; align-items: center; margin: 30px 0; color: #555; }
.loader { border: 8px solid #f3f3f3; border-top: 8px solid var(--primary-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1.5s linear infinite; margin-bottom: 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* =================================
   Verlauf & Dashboards
   ================================= */
.history-item, .dashboard-item { border: 1px solid #eee; margin-bottom: 15px; border-radius: 5px; background-color: #f9f9f9; }
.history-item summary, .dashboard-item summary { padding: 15px; cursor: pointer; font-weight: bold; background-color: #f0f0f0; border-radius: 5px 5px 0 0; }
.history-item summary:hover, .dashboard-item summary:hover { background-color: #e9e9e9; }
.history-item .history-content, .dashboard-item .history-content { padding: 15px; }
#allUsersList table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
#allUsersList th, #allUsersList td { border: 1px solid #ddd; padding: 8px; text-align: left; }
#allUsersList th { background-color: #f2f2f2; color: var(--primary-color); }

/* =================================
   Nachrichten
   ================================= */
.message { margin-top: 15px; padding: 12px; border-radius: 5px; display: none; text-align: center; }
.message.error { background-color: #f8d7da; color: #721c24; display: block; }
.message.success { background-color: #d4edda; color: #155724; display: block; }
.message.info { background-color: #d1ecf1; color: #0c5460; display: block; }
.message.warning { background-color: #fff3cd; color: #856404; display: block; }

/* =================================
   Links
   ================================= */
a { cursor: pointer; color: var(--primary-color); text-decoration: none; }
a:hover { text-decoration: underline; color: #357ABD; }
section p a { text-decoration: underline; } /* Links im Text unterstreichen */

/* =================================
   Responsive Design (Basic)
   ================================= */
@media (max-width: 600px) {
    header { flex-direction: column; padding: 10px; }
    nav { margin-top: 10px; flex-wrap: wrap; justify-content: center; }
    nav .nav-link { margin: 3px; }
    main { padding: 0 10px; }
    .view { padding: 15px; }
}

/* =================================
   Gamification Stile
   ================================= */

.gamification-status {
    text-align: right;
    color: #888;
    font-size: 0.9em;
}



.rank-icon {
    font-size: 1.5em; /* Macht das Icon größer */
    margin-right: 8px;
    vertical-align: -0.2em; /* Passt die vertikale Ausrichtung an */
}

#gamificationList .gamification-level {
    display: flex; /* Flexbox für Icon und Text nebeneinander */
    align-items: center; /* Vertikal zentrieren */
    background-color: var(--card-background);
    border: 1px solid #eee;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#gamificationList .gamification-level .icon {
    font-size: 2.5em;
    margin-right: 20px;
    flex-shrink: 0; /* Verhindert, dass das Icon schrumpft */
}

#gamificationList .gamification-level .details {
    flex-grow: 1; /* Lässt den Text den restlichen Platz einnehmen */
}

#gamificationList .gamification-level h4 {
    margin-top: 0;
    margin-bottom: 5px;
    color: var(--primary-color);
}

#gamificationList .gamification-level .points {
    font-size: 0.9em;
    color: var(--info-color);
    margin-bottom: 10px;
    font-weight: bold;
}

#gamificationList .gamification-level p {
    margin: 0;
    font-size: 0.95em;
}

/* Button-Stil für "Zurück"-Link */
.back-link-button {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--info-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}
.back-link-button:hover {
    background-color: #5a6268;
    color: white;
    text-decoration: none;
}

/* =================================
   FAQ Stile
   ================================= */

#faqList .faq-item {
    background-color: var(--card-background);
    border: 1px solid #e9e9e9;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    border-left: 5px solid var(--secondary-color); /* Akzentlinie */
}

#faqList .faq-item h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 1.1em;
}

#faqList .faq-item p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.5;
}

.faq-section-title {
    margin-top: 20px;
    margin-bottom: 15px;
    color: var(--secondary-color); /* Oder eine andere passende Farbe */
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

/* Stile für den erweiterten greetingContainer */
.greeting {
    /* Bestehende Stile für .greeting beibehalten oder anpassen */
    padding: 0; /* Padding wird jetzt von inneren Elementen gehandhabt */
    border-left: 6px solid var(--primary-color); /* Beibehalten oder anpassen */
    /* ... andere bestehende .greeting Stile ... */
}

.greeting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px; /* Padding für den Header-Bereich */
    cursor: pointer; /* Zeigt an, dass der Header klickbar ist */
    background-color: #e9f5ff; /* Leicht anderer Hintergrund für den Header */
    border-bottom: 1px solid transparent; /* Platzhalter, wird bei zugeklappt gesetzt */
}

.greeting.collapsed .greeting-header {
    border-bottom-color: #cce5ff; /* Linie, wenn Inhalt zugeklappt ist */
}

.greeting-header h1 { /* #userGreeting Stil */
    font-size: 1.6em; /* Etwas kleiner, da mehr Elemente im Container */
    color: #2c3e50;
    margin: 0;
    font-weight: 700;
    flex-grow: 1; /* Nimmt den meisten Platz ein */
}

.toggle-icon {
    font-size: 1.5em;
    color: var(--primary-color);
    padding: 5px;
    transition: transform 0.3s ease;
}

.greeting.collapsed .toggle-icon {
    transform: rotate(180deg); /* Pfeil drehen */
}

.greeting-content {
    padding: 0px 20px 20px 20px; /* Padding für den Inhaltsbereich */
    background-color: #f8fcff; /* Sehr heller Hintergrund für den Inhalt */
    border-top: 1px solid #d6eaff;
    overflow: hidden; /* Wichtig für Animationen */
    transition: max-height 0.4s ease-out, padding 0.4s ease-out, opacity 0.3s ease-out;
    max-height: 500px; /* Genug Platz für den Inhalt, wird für Animation gebraucht */
    opacity: 1;
}

.greeting.collapsed .greeting-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border-top-color: transparent;
}

#gamificationIntro {
    font-size: 1.1em;
    margin-top: 0; /* Direkt nach dem Header */
    margin-bottom: 15px;
    color: #333;
}
#gamificationIntro .level-icon { /* Icon für das Level im Text */
    font-size: 1.1em; /* Passend zur Textgröße */
}

/* Stile für die Punkteskala */
.points-scale-container {
    width: 100%;
    margin-bottom: 5px; /* Abstand zum Text darunter */
}

.points-scale-bar-background {
    width: 100%;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden; /* Damit der innere Balken die Rundung übernimmt */
    position: relative; /* Für Text im Balken */
}

.points-scale-bar-foreground { /* #userPointsBar */
    height: 100%;
    width: 0%; /* Startet leer, wird per JS gesetzt */
    background-color: var(--success-color); /* z.B. Grün für Fortschritt */
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
    text-align: center; /* Für Text im Balken */
    line-height: 20px; /* Vertikal zentrierter Text im Balken */
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    overflow: hidden; /* Verhindert, dass Text übersteht */
}

#userPointsBarText { /* Der Span im Balken, falls du Text dort möchtest */
    /* Kann leer bleiben, wenn Text nicht direkt auf dem Balken sein soll */
}

.points-progress-text { /* #pointsProgressText */
    text-align: right;
    font-size: 0.9em;
    color: #555;
    margin-top: 5px;
    margin-bottom: 15px;
}
.points-explanation-link-container {
    text-align: center;
    margin-top: 10px;
}