:root {
    --primary: #5c6bc0;
    --primary-light: #8e99f3;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-muted: #777777;
    
    --color-green: #2ecc71;
    --color-green-light: #eafaf1;
    --color-yellow: #f1c40f;
    --color-yellow-light: #fef9e7;
    --color-red: #e74c3c;
    --color-red-light: #fdedec;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    -webkit-tap-highlight-color: transparent;
}

body { 
    background-color: #e0e5ec; 
    color: var(--text-main); 
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--bg-color);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* =========================================
   HEADER (Fixiert & verkleinerte Überschrift)
   ========================================= */
.app-header {
    background: var(--primary);
    color: white;
    padding: 14px 20px;
    text-align: center;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 90;
}

.app-header h1 {
    font-size: 1.3rem; /* Überschrift verkleinert */
    font-weight: 700;
    margin: 0;
}

.subtitle {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.app-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    padding-bottom: 90px;
}

.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   CARDS & LISTS (Long-Press fähig)
   ========================================= */
.entries-list, .analysis-list { display: flex; flex-direction: column; gap: 15px; }

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid transparent;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:active {
    transform: scale(0.98);
}

.card.feeling-green { border-left-color: var(--color-green); background: var(--color-green-light); }
.card.feeling-green .card-icon { color: var(--color-green); }
.card.feeling-yellow { border-left-color: var(--color-yellow); background: var(--color-yellow-light); }
.card.feeling-yellow .card-icon { color: var(--color-yellow); }
.card.feeling-red { border-left-color: var(--color-red); background: var(--color-red-light); }
.card.feeling-red .card-icon { color: var(--color-red); }

.card-time { font-weight: bold; color: var(--text-muted); font-size: 0.9em; margin-bottom: 5px; }
.card-food { font-weight: 600; font-size: 1.1em; margin-bottom: 3px; }
.card-tags { font-size: 0.8em; color: var(--text-muted); }
.card-icon { font-size: 2em; }

/* =========================================
   KALENDER
   ========================================= */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.calendar-header button { background: none; border: none; font-size: 1.2em; cursor: pointer; color: var(--primary); }
.calendar-grid-header, .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    text-align: center;
}
.calendar-grid-header { font-weight: bold; color: var(--text-muted); margin-bottom: 10px; font-size: 0.9em; }
.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.cal-day.empty { background: transparent; box-shadow: none; cursor: default; }
.cal-day.green { background: var(--color-green); color: white; }
.cal-day.yellow { background: var(--color-yellow); color: white; }
.cal-day.red { background: var(--color-red); color: white; }
.legend { margin-top: 15px; display: flex; justify-content: center; gap: 15px; font-size: 0.9em; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.dot.green { background: var(--color-green); }
.dot.yellow { background: var(--color-yellow); }
.dot.red { background: var(--color-red); }

/* =========================================
   NAVIGATION & FIXIERTER PLUS-BUTTON (FAB)
   ========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    z-index: 100;
}

.nav-item {
    background: none; border: none; display: flex; flex-direction: column; align-items: center;
    color: var(--text-muted); cursor: pointer; font-size: 0.85em; transition: color 0.3s;
}
.nav-item .nav-icon { font-size: 1.5em; margin-bottom: 3px; }
.nav-item.active { color: var(--primary); font-weight: bold; }

/* Fixierter FAB Button */
.fab {
    position: fixed;
    bottom: 75px;
    right: calc(50% - 220px); /* Bleibt passend am rechten Rand des Containers zentriert */
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(92, 107, 192, 0.4);
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center;
    z-index: 101;
    transition: transform 0.2s;
}

@media (max-width: 480px) {
    .fab {
        right: 20px; /* Auf Smartphones am Bildschirmrand ausrichten */
    }
}

.fab:active { transform: scale(0.9); }

/* =========================================
   FIXIERTE POPUPS / MODALS
   ========================================= */
.modal-overlay {
    position: fixed; /* Fixiert damit es beim Scrollen nicht verrutscht */
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100vh;
    height: 100dvh; /* Verhindert Höhen-Sprünge auf mobilen Geräten */
    background: rgba(0,0,0,0.5); 
    z-index: 1000;
    display: flex; 
    align-items: center; 
    justify-content: center;
    backdrop-filter: blur(3px);
}

.modal-overlay.hidden { display: none; }

.modal-content {
    background: var(--card-bg); 
    width: 90%; 
    max-width: 430px;
    max-height: 85vh;
    border-radius: 20px; 
    padding: 25px; 
    position: relative; 
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.btn-close {
    position: absolute; top: 15px; right: 15px; background: none; border: none;
    font-size: 1.2em; color: var(--text-muted); cursor: pointer; padding: 5px;
}
.btn-close:hover { color: var(--text-main); }

.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeIn 0.3s; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9em; }
.form-group input[type="text"], .form-group input[type="datetime-local"] {
    width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px;
    font-size: 1em; outline: none; transition: border 0.3s;
}
.form-group input:focus { border-color: var(--primary); }

.feeling-selector { display: flex; justify-content: space-between; }
.feel-btn {
    font-size: 1.8em; background: none; border: 2px solid transparent; border-radius: 50%;
    cursor: pointer; transition: transform 0.2s, background 0.2s; padding: 10px;
    color: var(--text-muted);
}
.feel-btn.selected { background: #f0f0f0; border-color: var(--primary); transform: scale(1.1); color: var(--primary); }

.tags-selector { display: flex; flex-wrap: wrap; gap: 10px; }
.tags-selector label { margin: 0; cursor: pointer; }
.tags-selector input[type="checkbox"] { display: none; }
.tags-selector span {
    display: inline-block; padding: 8px 15px; background: #eee; border-radius: 20px;
    font-size: 0.9em; transition: background 0.2s, color 0.2s;
}
.tags-selector input:checked + span { background: var(--primary); color: white; }

.wizard-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 25px; }
.btn-primary, .btn-secondary {
    padding: 12px 20px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; flex: 1;
}
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: #e0e0e0; color: var(--text-main); }

.timeline { position: relative; padding-left: 20px; border-left: 2px solid #ddd; margin-top: 20px; }
.timeline-item { position: relative; margin-bottom: 20px; cursor: pointer; user-select: none; }
.timeline-item::before {
    content: ''; position: absolute; left: -26px; top: 0; width: 10px; height: 10px;
    background: var(--primary); border-radius: 50%;
}
.timeline-icon { color: var(--primary); font-size: 1.2em; margin-right: 5px; }