/* ============================================
   iOS Light / Dopamine Style
   ============================================ */

:root {
    --bg-app: #F2F2F7;
    --bg-card: #FFFFFF;
    --bg-input: #F2F2F7;
    --text-primary: #000000;
    --text-secondary: #3C3C4399;
    --text-muted: #3C3C434D;
    --accent-blue: #007AFF;
    --accent-danger: #FF3B30;
    --border-radius: 22px;
    --side-padding: 24px;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: var(--font-family);
    background: var(--bg-app);
    color: var(--text-primary);
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; 
    -webkit-font-smoothing: antialiased;
    
    min-height: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   MOBILE CONTAINER
   ============================================ */
.mobile-wrapper {
    width: 100vw;
    height: 100vh;
    padding: env(safe-area-inset-top, 20px) var(--side-padding) env(safe-area-inset-bottom, 20px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ============================================
   HEADER SECTION
   ============================================ */
.app-header {
    padding-top: 40px;
    padding-bottom: 10px;
    flex-shrink: 0; 
    display: flex;
    flex-direction: column;
}

.nav-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.greeting-text {
    font-size: 32px;
    font-weight: 700;
    color: #000;
}
#secretBtn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s;
}

#secretBtn:hover { opacity: 1; }

.page-title {
    font-size: 24px;
    font-weight: 400;
    color: #8E8E93;
    line-height: 1.3;
}

/* ============================================
   MIDDLE SECTION: FREISTEHENDE TO-DOS
   ============================================ */
/* Positionierung des Wrappers für absolute Elemente */
.todo-wrapper {
    position: relative; /* Wichtig für den absoluten Button */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding-top: 40px; /* Platz für den Button oben schaffen */
}

/* Die Liste selbst */
.todo-list {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Etwas mehr Abstand zwischen den offenen Items */
    padding: 10px 0;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 1px 0; /* Dieser Wert bestimmt den Abstand zwischen allen Items */
    transition: 
        opacity 0.15s ease, 
        max-height 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
        transform 0.15s ease,
        margin 0.2s ease;
    max-height: 80px; 
    opacity: 1;
    overflow: hidden;
   
}

/* Der "Zusammenschrumpf"-Zustand */
.hide-done .todo-item.is-done {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    pointer-events: none;
    border: none;
}

/* Das Durchstreichen-Styling */
.todo-item.is-done .todo-text {
    text-decoration: line-through;
    color: #8E8E93;
    transition: color 0.3s ease;
}

.todo-item.moving-down {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    transform: scale(0.95); /* Leichter Slide-Effekt nach rechts */
}

.hide-done .todo-item:has(input:checked) {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    pointer-events: none; /* Nicht mehr anklickbar während unsichtbar */
}

.todo-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Den alten .clear-btn Stil ersetzen oder ergänzen */
/* Der Button schwebt jetzt oben rechts */
#toggleDoneBtn {
    display: none;
    position: absolute;
    top: 5px;
    right: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #8E8E93;
    background: transparent;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

#toggleDoneBtn.visible {
    display: flex;
}

#toggleDoneBtn::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #3C3C43;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#toggleDoneBtn.hiding-done::after {
    opacity: 0;
    transform: scale(0.5);
}

/* Verstecke die erledigten To-Dos, wenn die Liste die Klasse hat */
.todo-list.hide-done .todo-item:has(input:checked) {
    display: none;
}

/* Custom Checkmark (Kreis) - etwas dickerer Rand für besseren Kontrast auf grauem BG */
.checkmark {
    position: relative;
    height: 24px;
    width: 24px;
    background-color: transparent;
    border: 2px solid #8E8E93; 
    border-radius: 50%;
    margin-right: 15px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Wenn gecheckt */
.todo-item input:checked ~ .checkmark {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Häkchen Icon */
.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 8px;
    top: 4px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.todo-item input:checked ~ .checkmark:after {
    display: block;
}

/* Text Style */
.todo-text {
    font-size: 17px; /* Etwas größer für bessere Lesbarkeit ohne Box */
    color: #000;
    font-weight: 500;
    transition: color 0.2s;
}

.todo-item input:checked ~ .todo-text {
    text-decoration: line-through;
    color: #8E8E93;
}


/* ============================================
   BOTTOM SECTION: MENU GRID
   ============================================ */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px; 
    width: 100%;
    margin-bottom: 50px;
    flex-shrink: 0;
}

.glass-card {
    background: #F0F0F5; 
    border-radius: 22px;
    padding: 20px;
    transition: background 0.2s;
}

.menu-grid .glass-card {
    height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.glass-card:active {
    transform: scale(0.98);
    background-color: #F0F0F5;
}

/* Container für das Icon anpassen */
.card-icon {
    width: 32px;       /* Oder größer, z.B. 40px, je nach Icon-Design */
    height: 32px;
    background: none !important; /* Entfernt alte Hintergründe */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

/* WICHTIG: Damit das Bild genau in den Container passt */
.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Stellt sicher, dass das ganze Icon sichtbar ist */
    display: block;
}

/* Entferne die alten Gradienten-Hintergründe, falls sie noch stören */
.stats-card .card-icon,
.finance-card .card-icon,
.routine-card .card-icon {
    background: none !important;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: auto;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #000;
}

.card-desc, .card-arrow { display: none; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed; inset: 0; 
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none; 
    align-items: center; 
    justify-content: center; 
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.open { display: flex; opacity: 1; }

.modal {
    background: rgba(255, 255, 255, 0.95);
    padding: 24px; 
    border-radius: 24px;
    width: 85%; 
    max-width: 320px; 
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.open .modal { transform: scale(1); }
.modal h3 { margin-bottom: 8px; font-size: 1.2rem; color: var(--text-primary); }
.desc { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }

.modal input {
    width: 100%; 
    padding: 12px; 
    border-radius: 12px; 
    background: var(--bg-input); 
    border: none;
    color: var(--text-primary); 
    font-size: 1rem; 
    margin-bottom: 20px; 
    text-align: center;
}
.modal input:focus { outline: 2px solid var(--accent-blue); background: #fff; }

.actions { display: flex; gap: 10px; margin-bottom: 16px; }
.btn { flex: 1; padding: 12px; border-radius: 12px; border: none; font-weight: 600; cursor: pointer; font-size: 1rem; transition: opacity 0.2s; }
.btn:active { opacity: 0.7; }
.btn.pri { background: var(--accent-blue); color: #fff; }
.btn.sec { background: var(--bg-input); color: var(--text-primary); }
.btn.danger-link { background: none; color: var(--accent-danger); font-size: 0.9rem; width: 100%; padding: 5px; }

@media (max-width: 360px) {
    .menu-grid { grid-template-columns: 1fr; }
    .menu-grid .glass-card { height: auto; flex-direction: row; align-items: center; gap: 15px; padding: 15px; }
    .card-icon { margin-bottom: 0; width: 40px; height: 40px; font-size: 1.2rem; }
}

/* ... (Dein vorheriger CSS Code bleibt gleich) ... */

/* ============================================
   NEU: STYLES FÜR DAS EINGABEFELD
   ============================================ */

/* Wrapper für das Eingabefeld, damit es wie ein Item aussieht */
.input-wrapper {
    display: flex;
    align-items: center;
    padding: px 0;
    border-bottom: none;
}
/* Das eigentliche Input-Feld */
#newTodoInput {
    border: none;
    border-bottom: 1px solid rgba(142, 142, 147, 0.3);
    background: transparent;
    font-size: 17px;
    width: 100%;
    outline: none;
    padding: 5px 0;
    color: #000;
    display: block !important;
}

#newTodoInput:focus {
    border-bottom-color: var(--accent-blue);
    /* Ein ganz sanfter blauer Hintergrund zeigt an, dass man gerade schreibt */
    background: rgba(0, 122, 255, 0.03); 
}

#newTodoInput::placeholder {
    color: #8E8E93;
    opacity: 0.6;
}

/* ============================================
   AMBIENT GLOW (Zeitabhängig)
   ============================================ */
body {
    transition: box-shadow 3s ease; /* Sanfter Übergang zwischen den Zeiten */
}

/* MORGENS (5 - 12 Uhr): Warmes Orange */
body.time-morning {
    box-shadow: inset 0 0 120px rgba(255, 140, 0, 0.2);
}

/* TAGSÜBER (12 - 18 Uhr): Neutrales / Helles Blau */
body.time-day {
    box-shadow: inset 0 0 100px rgba(0, 122, 255, 0.2);
}

/* ABENDS (18 - 22 Uhr): Lila / Sonnenuntergang */
body.time-evening {
    box-shadow: inset 0 0 140px rgba(137, 43, 226, 0.2);
}

/* NACHTS (22 - 5 Uhr): Mitternachtslila / Dunkelblau */
body.time-night {
    box-shadow: inset 0 0 150px rgba(25, 25, 112, 0.2);
    background-color: #F0F0F5; /* Optional: Hintergrund nachts minimal abdunkeln */
}