:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --bg: #f4f4f9;
    --text: #333;
    --card-bg: #ffffff;
}

* { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { margin: 0; padding: 0; background-color: var(--bg); color: var(--text); padding-bottom: 70px; }

/* Navigation */
nav {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: var(--card-bg); border-top: 1px solid #ccc;
    display: flex; justify-content: space-around; padding: 10px 0; z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
nav button {
    background: none; border: none; font-size: 12px; font-weight: bold; color: #888;
    cursor: pointer; padding: 10px; display: flex; flex-direction: column; align-items: center;
}
nav button.active { color: var(--primary); }

/* Views */
.view { display: none; padding: 15px; max-width: 800px; margin: 0 auto; }
.view.active { display: block; }

/* Karten & Formulare */
.card { background: var(--card-bg); padding: 15px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 20px; }
input, button, select { width: 100%; padding: 12px; margin: 8px 0 16px 0; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; }
button.btn-primary { background-color: var(--primary); color: white; border: none; cursor: pointer; font-weight: bold; transition: background 0.3s; }
button.btn-primary:hover { background-color: var(--primary-dark); }
button.btn-small { padding: 8px; font-size: 14px; margin: 0; }

/* Tabelle mit Sticky Column */
.table-container { overflow-x: auto; background: var(--card-bg); border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
table { border-collapse: collapse; width: 100%; min-width: 600px; }
th, td { border-bottom: 1px solid #eee; padding: 12px; text-align: left; }
th:first-child, td:first-child { position: sticky; left: 0; background: var(--card-bg); z-index: 2; border-right: 1px solid #eee; }
th:first-child { z-index: 3; }

.img-preview { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.img-placeholder { width: 60px; height: 60px; background: #eee; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #999; }

/* Rezept-Builder Liste */
.composition-list { list-style: none; padding: 0; margin: 10px 0; }
.composition-list li { background: #f9f9f9; padding: 8px 12px; border-radius: 6px; margin-bottom: 5px; display: flex; justify-content: space-between; align-items: center; }

/* Gerichte Tafeln (Grid Layout für Anforderung 4) */
.gerichte-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; margin-top: 15px; }
.dish-card { cursor: pointer; display: flex; flex-direction: column; overflow: hidden; padding: 0; transition: transform 0.2s; }
.dish-card:active { transform: scale(0.98); }
.dish-card-img { width: 100%; height: 150px; object-fit: cover; }
.dish-card-content { padding: 15px; flex-grow: 1; }
.dish-card h4 { margin: 0 0 10px 0; font-size: 18px; }

/* Modales Fenster (Rezept-Popup) */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 200; justify-content: center; align-items: center; padding: 10px; }
.modal-content { max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; animation: slideUp 0.3s ease-out; }
.close-modal { position: absolute; right: 15px; top: 10px; font-size: 28px; cursor: pointer; color: #aaa; }
.modal-main-img { width: 100%; height: 200px; object-fit: cover; border-radius: 8px; margin-bottom: 15px; }

.nutrition-badge-container { display: flex; justify-content: space-between; gap: 5px; margin: 15px 0; }
.badge { background: #e8f5e9; color: #2e7d32; padding: 8px; border-radius: 6px; font-size: 13px; text-align: center; flex: 1; }

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.chart-container { position: relative; height: 300px; width: 100%; }