/* --- 1. FARB-VARIABLEN (Das Gehirn der App) --- */
:root {
    /* Helle Version */
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #1c1e21;
    --primary: #4caf50;
    --accent-color: #4caf50;
    --border-color: #dddddd;
    --nav-bg: #ffffff;
    --shadow: rgba(0, 0, 0, 0.08);
}

body.dark-mode {
    /* Dunkle Version - Premium Midnight Grey */
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e4e6eb;
    --primary: #81c784;
    --accent-color: #81c784;
    --border-color: #333333;
    --nav-bg: #1e1e1e;
    --shadow: rgba(0, 0, 0, 0.4);
}

/* --- 2. GRUNDSTEUERUNG --- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 100px;
}

/* --- 3. HEADER & STATS --- */
header { margin-bottom: 25px; }

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#streakDisplay {
    font-weight: bold;
    font-size: 1.1rem;
    background: rgba(255, 152, 0, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    color: #ff9800;
}

#quoteContainer {
    text-align: center;
    font-style: italic;
    font-size: 0.9rem;
    margin: 15px 0;
    opacity: 0.8;
}

/* --- 4. PROGRESS BAR --- */
.progress-container {
    background: var(--border-color);
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar {
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
}

/* --- 5. EINGABE & KARTEN --- */
.input-section, .stat-card, li, .history-item, .modal-content {
    background-color: var(--card-bg);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px var(--shadow);
    color: var(--text-color);
    transition: background-color 0.3s ease;
}

.input-section { padding: 15px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }

input, select {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.add-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}

/* --- 6. WOCHENPLANER --- */
.day-selector { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; margin-bottom: 20px; }

.day-btn {
    padding: 8px 12px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
}

.day-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* --- 7. LISTEN & KATEGORIEN --- */
ul { list-style: none; padding: 0; }

li {
    margin-bottom: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--primary);
}

li.completed { opacity: 0.5; text-decoration: line-through; }
li.cat-sport { border-left-color: #ff9800; }
li.cat-lernen { border-left-color: #2196f3; }
li.cat-gesundheit { border-left-color: #4caf50; }
li.cat-alltag { border-left-color: #9e9e9e; }

/* --- 8. TREND & STATS --- */
.stats-container { display: flex; gap: 10px; margin-bottom: 20px; }

.stat-card {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label { font-size: 0.7rem; color: #888; text-transform: uppercase; margin-bottom: 5px; }
.stat-value { font-size: 1.3rem; font-weight: bold; color: var(--primary); }

/* --- 9. NAVIGATION --- */
.navbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 70px;
    background: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

.navbar button {
    background: none; border: none;
    color: var(--text-color);
    font-weight: bold;
    opacity: 0.5;
    padding: 10px;
}

.navbar button.active { opacity: 1; color: var(--primary); border-bottom: 2px solid var(--primary); }

/* --- 10. MODAL & CHART --- */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}

.modal-content {
    padding: 25px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1010;
}

.hidden { display: none !important; }

/* --- 11. SPEZIAL-BUTTONS --- */
#darkModeToggle, #notificationBtn {
    background: transparent; border: none; font-size: 1.4rem; cursor: pointer;
}

#notificationBtn.enabled { color: #4caf50; filter: drop-shadow(0 0 5px rgba(76, 175, 80, 0.4)); }

/* --- 12. FINISH DAY BUTTON (Der große rote Button) --- */
.finish-day-btn {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background: #dc3545; /* Ein kräftiges Rot */
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.3);
    transition: transform 0.2s ease, background 0.2s ease;
}

.finish-day-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.finish-day-btn:active {
    transform: translateY(0);
}

/* --- 13. HISTORIE-ITEMS ALS BUTTONS --- */
.history-item {
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background-color: var(--bg-color); /* Leichter Kontrast-Effekt */
    transform: scale(1.02);
}

.history-item:active {
    transform: scale(0.98);
}

/* Status-Farben für die Historie (Links der Balken) */
.history-item.excellent { border-left: 6px solid #4caf50; }
.history-item.good { border-left: 6px solid #2196f3; }
.history-item.okay { border-left: 6px solid #ff9800; }
.history-item.poor { border-left: 6px solid #f44336; }

/* Kleiner Pfeil-Indikator in der Historie (optional, sieht aber gut aus) */
.history-item::after {
    content: '›';
    font-size: 1.5rem;
    color: var(--border-color);
    margin-left: 10px;
}

/* Styling für die Emoji-Buttons */
.rating-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.rate-btn {
    font-size: 1.8rem;
    padding: 10px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    cursor: pointer;
    flex: 1;
    transition: all 0.2s;
}

/* Dein JS schaltet die Klasse 'active' bei den diff-Buttons */
.rate-btn.active {
    border-color: var(--primary);
    background: rgba(76, 175, 80, 0.1);
    transform: scale(1.1);
}

#dayNote {
    width: 100%;
    height: 60px;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
    resize: none;
}


#dayNote:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- DESIGN FÜR DIE MODAL-BUTTONS --- */

/* Der Container, der die Buttons nebeneinander hält */
.confirm-buttons {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

/* Gemeinsame Basis für beide Buttons */
.btn-primary, .btn-secondary {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* SPEICHERN BUTTON (Primär) */
.btn-primary {
    background: linear-gradient(135deg, #4caf50, #2e7d32); /* Premium Grün-Verlauf */
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ABBRECHEN BUTTON (Sekundär) */
.btn-secondary {
    background: var(--bg-color); /* Nutzt deine Hintergrundfarbe */
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Dark Mode Anpassung für den Abbrechen-Button */
.dark-mode .btn-secondary {
    background: #2c2c2c;
    border-color: #444;
}

.dark-mode .btn-secondary:hover {
    background: #383838;
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Die neuen Farb-Zustände für die Emojis */
.rate-btn.active-easy {
    background: #4caf50 !important; /* Grün */
    border-color: #2e7d32 !important;
    color: white;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.4);
    transform: scale(1.1);
}

.rate-btn.active-medium {
    background: #ffc107 !important; /* Gelb */
    border-color: #ffa000 !important;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.4);
    transform: scale(1.1);
}

.rate-btn.active-hard {
    background: #f44336 !important; /* Rot */
    border-color: #d32f2f !important;
    color: white;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.4);
    transform: scale(1.1);
}

html {
    /* Verhindert, dass beim "Ziehen" eine andere Farbe zum Vorschein kommt */
    background-color: var(--bg-color);
}

body {
    /* Sorgt dafür, dass der Body immer die volle Höhe deckt */
    min-height: 100vh;
    overscroll-behavior-y: contain; /* Verhindert den Gummiband-Effekt bei manchen Browsern */
}