:root {
  --bg-color: #fafafa;
  --text-color: #333;
  --card-bg: #fff;
  --card-border: #ddd;
  --accent: #750c0c;
  --button-hover: #8b1c1c; /* Helleres Rot für Hover */
}

body.dark-mode {
  --bg-color: #121212;
  --text-color: #eee;
  --card-bg: #1e1e1e;
  --card-border: #333;
  --accent: #501414; /* Helleres Akzentrot für bessere Sichtbarkeit im Dark Mode */
  --button-hover: #8b1c1c;
}

body {
  margin: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: "Segoe UI", sans-serif;
  padding-top: 80px;
}

#appHeader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,.3);
  z-index: 100;
}

#appHeader h1 {
  color: var(--accent);   /* Light-Mode: rot */
  font-size: 20px;
  flex: 1;
  text-align: center;
}

/* ✅ Dark-Mode Überschreibung */
body.dark-mode #appHeader h1 {
  color: #fff; /* Weiß im Darkmode */
}

button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s;
}

button:hover { 
  background: var(--button-hover); 
}

/* --- REZEPT-GRID & KARTEN --- */
#rezepteGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  justify-items: center;
}

.recipe-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  padding: 15px;
  text-align: center;
  width: 100%;
  max-width: 280px;
  min-height: 350px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.3s;
}
.recipe-card:hover { transform: scale(1.03); }
.recipe-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
}

/* --- MODAL (ALLGEMEIN) --- */
.modal {
  display: none;
  position: fixed;
  top: 0; 
  left: 0;
   overflow-y: auto;
  width: 100%; 
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  z-index: 5000;
}
.modal-content {
  position: relative;
  background: var(--card-bg);
  margin: 2% auto;
  padding: 20px;
  border-radius: 10px;
    width: 95%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 6000;
}
#modalClose, #dayModalClose {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  line-height: 30px;
  text-align: center;
  padding: 0;

  /* 🔧 FIX: immer oben rechts */
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 9999;
}
  
.cookmode-content {
  background: #000;
  color: #fff;
  font-size: 1.8em;    /* große Schrift */
  text-align: center;
  padding: 30px;
  max-width: 1000px;
}

#cookModeStep {
  margin: 40px 0;
  line-height: 1.6;
}

#cookModeButtons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

#translateBtn {
  background: #444;
}


/* --- REZEPT-MODAL (SPEZIFISCH) --- */
.recipe-details { display: grid; grid-template-columns: 300px 1fr; gap: 15px; }
.recipe-image-wrapper img { width: 100%; border-radius: 8px; }
.meta-info { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
#modalIngredients { columns: 2; }
#modalNotes { background: var(--card-bg); padding: 10px; border: 1px solid var(--card-border); border-radius: 6px; margin-top: 10px; }

/* --- KALENDER --- */
.kalender-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; }

.kalender-tag {
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 10px;
  min-height: 130px;
  position: relative;
  transition: all 0.2s ease-in-out;
}

.kalender-tag h4 { 
  margin: 0 0 6px; 
  color: #555; /* Das ist reines Weiß */
}

/* --- NEUE REGELN HIER EINGEFÜGT --- */
.kalender-tag ul {
  padding-left: 18px; /* Standard-Einrückung für Listen entfernen/anpassen */
  margin: 0;
}

.kalender-tag ul li {
  color: #555; /* Schriftfarbe für Rezeptnamen im Light Mode */
  cursor: pointer;
  margin-bottom: 4px;
}

.kalender-tag .add-recipe-to-day-btn {
  position: absolute; 
  bottom: 8px; 
  left: 8px; 
}

/* Styling für Gestern */
.kalender-tag.past-day {
  background-color: rgba(49, 163, 49, 0.438);
   border-color: #0e7e20;
}

/* Styling für Heute */
.kalender-tag.today {
  border: 2px solid var(--accent);
}

/* Dark Mode Anpassungen für Kalender */
body.dark-mode .kalender-tag.past-day {
  background-color: rgba(100, 180, 100, 0.1);
}

body.dark-mode .kalender-tag.today {
  border-color: #44d3ff; 
}

/* --- NEUE REGEL FÜR DARK MODE HIER EINGEFÜGT --- */
body.dark-mode .kalender-tag ul li {
  color: #ccc; /* Schriftfarbe für Rezeptnamen im Dark Mode */
}


/* --- EINKAUFSLISTE --- */
.shopping-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--card-border);
}
.shopping-list-item .item-menge {
  flex: 0 0 100px;
  color: #888;
  font-style: italic;
}
.shopping-list-item .item-name {
  flex-grow: 1;
  font-weight: 600;
}
.shopping-list-item .item-actions {
  display: flex;
  gap: 8px;
}
#shoppingListDone .shopping-list-item .item-name,
#shoppingListDone .shopping-list-item .item-menge {
  text-decoration: line-through;
  color: #aaa;
}
.suggestions {
  position: absolute;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: none;
  z-index: 10;
}

/* --- DATENBANK-SEITE --- */
#dbLogin { margin-top: 20px; }
#dbPasswordInput { padding: 6px; border: 1px solid var(--card-border); border-radius: 6px; }
#dbLoginBtn, #dbCloseBtn { background: var(--accent); margin-left: 8px; }
#dbLoginBtn:hover, #dbCloseBtn:hover { background: var(--button-hover); }
#databaseList li {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-color);
}
#databaseList button {
  background: #a83232;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  color: #fff;
}
#databaseList button:hover { background: #750c0c; }


/* --- MODAL BEARBEITUNGS-MODUS --- */
.edit-mode-item, #edit-mode-buttons { display: none; }
.modal-content.edit-mode .edit-mode-item {
  display: block;
  width: 95%;
  padding: 5px;
  margin-top: 5px;
  background-color: var(--bg-color);
  color: var(--text-color);
  border: 1px solid var(--card-border);
  border-radius: 4px;
}
.modal-content.edit-mode textarea.edit-mode-item { width: 98%; }
.modal-content.edit-mode .view-mode-item, .modal-content.edit-mode #view-mode-buttons { display: none; }
.modal-content.edit-mode #edit-mode-buttons { display: block; }

/* --- LADE-OVERLAY --- */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
}
#loadingOverlay.show { display: flex; }
#loadingText { margin-top: 20px; font-size: 1.2em; }
.spinner {
  width: 60px;
  height: 60px;
  border: 8px solid #f3f3f3;
  border-top: 8px solid var(--accent); 
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.suggestion-item:hover {
    background: var(--card-border);
}

/* 📱 Header-Optimierung für mobile */
@media (max-width: 600px) {
  #appHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px; /* kleiner Header nur auf Mobile */
    padding: 0 5px;
  }

  #appHeader h1 {
    font-size: 14px;
    flex: 1; /* Titel bleibt zentriert */
    text-align: center;
  }

  button {
    padding: 4px 8px;
  }
}

/* 📱 Mobile Ansicht für Rezepte-Modal */
@media (max-width: 600px) {
  .recipe-details {
    display: block;        /* statt 2-Spalten-Grid */
  }

  .recipe-image-wrapper img {
    width: 100%;
    height: auto;
  }

  .meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .meta-info > div {
    flex: 1 1 45%;
  }

  /* Buttons fixieren am unteren Rand */
  #modal-buttons {
    position: sticky;
    bottom: 0;
    background: var(--card-bg);
    padding: 10px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    z-index: 1000;
  }
}

#cookMode {
  display: none;              /* Standard unsichtbar */
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;             /* für iOS Safari */
  background: #111;
  color: #fff;
  z-index: 99999;             /* ganz oben */
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  padding: 20px;
}

#cookMode.show {
  display: flex;              /* beim Aktivieren sichtbar */
}

#cookMode h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

#cookMode p {
  font-size: 1.6rem;
  line-height: 1.5;
  min-height: 150px;
  margin: 20px 0;
}

#cookMode button {
  font-size: 1rem;
  padding: 10px 20px;
  margin: 5px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}


