/**
 * Deutsch-Abenteuer - style.css
 * Styling der Benutzeroberfläche
 */

:root {
    /* Farbpalette des Spiels */
    --primary-color: #4CAF50;    /* Grün für Erfolg und Hauptaktionen */
    --secondary-color: #2196F3;  /* Blau für Navigation und Info */
    --accent-color: #FFC107;     /* Gelb/Gold für Sterne und Belohnungen */
    --bg-color: #f0f9ff;         /* Hellblauer Hintergrund */
    --text-color: #333;          /* Dunkelgrau für Text */
    --white: #ffffff;
    --correct-color: #4CAF50;
    --wrong-color: #f44336;
    --xp-color: #9C27B0;         /* Lila für XP */
    --fibi-color: #FF5722;       /* Orange für Fibi den Fuchs */
    --locked-color: #9e9e9e;     /* Grau für gesperrte Inhalte */
    --challenge-color: #f44336;  /* Rot für den Zeitmodus */
}

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

body {
    font-family: 'Comic Neue', cursive, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
}

/* Hauptcontainer der Anwendung */
#app {
    background: var(--white);
    width: 100%;
    max-width: 1100px;
    min-height: 850px;
    border-radius: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    padding: 20px;
    position: relative;
    border: 8px solid #e0f2fe;
    overflow: hidden;
}

/* Bildschirm-Management: Nur der aktive Screen wird angezeigt */
.screen { 
    display: none; 
    flex-direction: column; 
    align-items: center; 
    text-align: center; 
    animation: fadeIn 0.4s ease-out; 
    width: 100%; 
}
.screen.active { display: flex; }

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

/* Header & Statistiken */
header { 
    width: 100%; 
    margin-bottom: 20px; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
}
.player-stats-header { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    justify-content: flex-end; 
    font-weight: bold; 
    font-size: 0.85rem; 
}
.xp-mini-bar { 
    width: 80px; 
    height: 8px; 
    background: #eee; 
    border-radius: 4px; 
    overflow: hidden; 
}
#xp-mini-fill { 
    height: 100%; 
    background: var(--xp-color); 
    width: 0%; 
    transition: width 0.5s; 
}

.map-header { 
    width: 100%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px; 
}

/* Klassenauswahl-Gitter */
.grade-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    margin-top: 30px; 
    width: 100%; 
    max-width: 500px; 
}
.grade-btn { 
    background: var(--secondary-color); 
    color: white; 
    border: none; 
    padding: 30px; 
    border-radius: 20px; 
    font-size: 1.5rem; 
    cursor: pointer; 
    transition: transform 0.2s, background 0.2s; 
    font-family: inherit; 
}
.grade-btn:hover { transform: scale(1.05); background: #1976D2; }

/* Weltkarte und Orte */
.world-map {
    width: 100%;
    height: 600px;
    background: #e3f2fd;
    border-radius: 20px;
    position: relative;
    margin: 10px 0;
    background-image: radial-gradient(#bbdefb 2px, transparent 2px);
    background-size: 20px 20px;
    border: 4px solid #90caf9;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 30px 20px;
}

.map-location {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s;
    z-index: 2;
    width: 110px;
    position: relative;
}

.map-location:hover:not(.locked) { transform: scale(1.15); }

/* Gesperrte Orte */
.map-location.locked { cursor: not-allowed; filter: grayscale(1); opacity: 0.7; }
.map-location.locked .loc-icon { border-color: #999; }
.loc-lock { 
    position: absolute; 
    top: -10px; 
    right: 0; 
    background: #333; 
    color: white; 
    font-size: 0.7rem; 
    padding: 2px 6px; 
    border-radius: 8px; 
    font-weight: bold; 
    z-index: 3; 
}

.loc-icon { 
    font-size: 2.2rem; 
    background: white; 
    border-radius: 50%; 
    width: 60px; 
    height: 60px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
    border: 4px solid var(--secondary-color); 
}
.loc-label { 
    font-weight: bold; 
    margin-top: 5px; 
    background: rgba(255,255,255,0.9); 
    padding: 2px 8px; 
    border-radius: 10px; 
    font-size: 0.7rem; 
    white-space: nowrap; 
    text-align: center; 
    width: 100%; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}
.loc-stars { color: var(--accent-color); font-size: 0.8rem; height: 1.2rem; }

/* Missions-Anzeige */
.mission-panel { 
    width: 100%; 
    background: #fff9c4; 
    padding: 12px; 
    border-radius: 15px; 
    border: 2px solid #fff176; 
    text-align: left; 
    margin-top: 10px; 
}
.mission-panel h3 { margin-bottom: 5px; color: #fbc02d; font-size: 1rem; }
#mission-list { list-style: none; font-size: 0.9rem; }
.mission-item { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed #ffe082; }
.mission-done { text-decoration: line-through; color: #999; }

/* Fibi der Fuchs (Helfer-Figur) */
#fibi-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: flex-end;
    pointer-events: none;
    z-index: 999; /* Fibi immer ganz oben */
}

.fibi-bubble {
    background: white;
    border: 3px solid var(--fibi-color);
    padding: 8px 12px;
    border-radius: 15px 15px 0 15px;
    margin-right: 5px;
    max-width: 160px;
    font-size: 0.8rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    pointer-events: auto;
}

.fibi-avatar { 
    font-size: 3.5rem; 
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.1)); 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Neue Animationen für interaktive Fibi */
.fibi-bounce {
    animation: fibiBounce 0.6s ease;
}

@keyframes fibiBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.correct-anim {
    animation: correctFlash 0.5s ease;
}

@keyframes correctFlash {
    0% { background-color: white; }
    50% { background-color: #e8f5e9; transform: scale(1.02); }
    100% { background-color: white; }
}

.shake {
    animation: shakeAnim 0.4s ease;
}

@keyframes shakeAnim {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}


/* Allgemeine Button-Styles */
.btn-main { 
    background: var(--primary-color); 
    color: white; 
    padding: 12px 24px; 
    font-size: 1rem; 
    border-radius: 15px; 
    border: none; 
    cursor: pointer; 
    transition: background 0.2s; 
    font-family: inherit; 
}
.btn-main:hover { background: #45a049; }
.btn-main:disabled { background: #ccc; cursor: not-allowed; }
.btn-secondary { 
    background: var(--secondary-color); 
    color: white; 
    padding: 8px 16px; 
    border-radius: 10px; 
    border: none; 
    cursor: pointer; 
    font-family: inherit; 
}
.btn-small { 
    background: #eee; 
    padding: 6px 10px; 
    font-size: 0.75rem; 
    border-radius: 8px; 
    border: none; 
    cursor: pointer; 
    width: fit-content; 
    font-family: inherit; 
}

/* Challenge-Modus Button */
.btn-challenge { 
    background: #eee; 
    border: 2px solid #ccc; 
    padding: 8px 15px; 
    border-radius: 12px; 
    cursor: pointer; 
    font-weight: bold; 
    font-family: inherit; 
    transition: all 0.2s; 
}
.btn-challenge.active { 
    background: var(--challenge-color); 
    color: white; 
    border-color: #b71c1c; 
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.4); 
}

/* Spiel-Elemente */
.game-header-top { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.timer { 
    font-size: 1.2rem; 
    font-weight: bold; 
    color: var(--challenge-color); 
    background: #ffebee; 
    padding: 5px 12px; 
    border-radius: 10px; 
    border: 2px solid #ffcdd2; 
}
.timer.warning { animation: pulse 0.5s infinite alternate; }

@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.1); color: #d32f2f; } }

#game-container { width: 100%; margin: 20px 0; min-height: 200px; }
.progress-container { 
    width: 100%; 
    height: 10px; 
    background: #eee; 
    border-radius: 5px; 
    margin-top: 10px; 
    overflow: hidden; 
}
#progress-bar { height: 100%; background: var(--primary-color); width: 0%; transition: width 0.3s; }

/* Aufgaben-Typen Styling */
.choice-container { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
.choice-btn { 
    padding: 10px 20px; 
    font-size: 1.1rem; 
    background: #f8f9fa; 
    border: 3px solid #dee2e6; 
    border-radius: 12px; 
    cursor: pointer; 
    transition: all 0.2s; 
    font-family: inherit; 
}
.choice-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--secondary-color); }

.gap-text { font-size: 1.4rem; margin: 20px 0; line-height: 1.6; }
.gap-input { 
    border: 2px solid #ddd; 
    border-radius: 8px; 
    text-align: center; 
    font-family: inherit; 
    outline: none; 
    font-size: 1.2rem; 
}

/* Drag & Drop Styling */
.drop-zone { 
    min-height: 80px; 
    width: 100%; 
    border: 3px dashed #ccc; 
    border-radius: 15px; 
    margin: 20px 0; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    padding: 15px; 
    justify-content: center; 
    background: #fafafa; 
}
.drag-item { 
    padding: 8px 15px; 
    background: white; 
    border: 2px solid var(--secondary-color); 
    border-radius: 10px; 
    cursor: pointer; 
    font-size: 1.1rem; 
    font-family: inherit;
}

/* Feedback-Bereich */
#feedback { margin: 20px 0; padding: 15px; border-radius: 15px; background: #f9f9f9; width: 100%; }
.hidden { display: none; }

/* Spieler-Karten in der Auswahl */
.player-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin: 20px 0; }
.player-card { 
    border: 2px solid #ddd; 
    border-radius: 15px; 
    padding: 15px; 
    cursor: pointer; 
    transition: all 0.2s; 
    min-width: 150px; 
}
.player-card:hover { border-color: var(--primary-color); background: #f1f8e9; }

/* Tabellen-Styling für Bestenliste */
.highscore-table-container { width: 100%; max-height: 400px; overflow-y: auto; margin: 20px 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f8f9fa; }

/* Responsive Anpassungen für Mobilgeräte */
@media (max-width: 768px) {
    .world-map { height: auto; max-height: 600px; }
    .grade-grid { grid-template-columns: 1fr; }
    #app { min-height: auto; }
}
