
/* ---------- Kochbuch Look & Feel (Smartphone-first) ---------- */

:root {
  --bg: #fffdf9; /* warmes Papier */
  --paper: #fffdf9; /* Blatt */
  --ink: #2c2c2c; /* Text */
  --muted: #6f6b67;
  --brand: #e07a5f; /* Akzent (Terracotta) */
  --brand-2: #81b29a; /* Salbei */
  --chip: #fff;
  --chip-border: #e8e2db;
  --card-border: #ece5dc;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(54, 32, 18, 0.08);
  --shadow-soft: 0 3px 10px rgba(0, 0, 0, 0.06);
}

/* Hintergrund: leicht texturiertes Papier */
html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: 'Times New Roman', ui-rounded, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  color: var(--ink);
  background: white;
}

/* Kopfbereich wie Registerkarte */
header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column; /* Titel und Suchleiste untereinander */
  gap: 10px;
  align-items: center;
}

header.site h1 {
  margin: 0;
  font-size: 2rem; /* Größeren Titel für bessere Sichtbarkeit */
  font-weight: 800;
  color: #3d3028;
}

/* Suchleiste */
.searchbar {
  display: flex;
  gap: 10px; /* Mehr Abstand zwischen den Eingabefeldern und Buttons */
  flex: 1 1 100%; /* Maximale Breite für das Suchfeld */
  justify-content: center; /* Zentrieren der Suchleiste */
}

.searchbar input[type="text"] {
  flex: 1;
  padding: 11px 13px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid var(--chip-border);
  background: #fff;
  outline: none;
}

.searchbar input[type="text"]:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(129, 178, 154, 0.15);
}

.searchbar button {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--brand-2);
  background: var(--brand-2);
  color: white;
  font-weight: 600;
}

/* Neue Button-Zeile unter der Suchleiste */
.searchbar-buttons {
  display: flex;
  gap: 15px; /* Abstand zwischen den Buttons */
  justify-content: center; /* Zentriert die Buttons */
}

.searchbar-buttons button {
  padding: 10px 15px;
  border-radius: 5px;
  border: 1px solid var(--brand-2);
  background: var(--brand-2);
  color: white;
  font-weight: 600;
  transition: background-color 0.3s;
}

.searchbar-buttons button:hover {
  background-color: var(--brand); /* Hover-Effekt */
}

/* Link-Styling global */
a {
  color: #7a4b2a;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Horizontale Gruppen-Chips (eine Zeile, scrollbar) */
.group-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px;
  background: transparent;
}
.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--chip-border);
  color: #3f3a36;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

/* ==== EINHEITLICHES KACHEL-LAYOUT ==== */

/* Mobile/Phone: gleich breite Kacheln im Grid */
.row-scroll{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(160px,1fr));
  gap:12px;
  padding:12px;
  overflow:visible;            /* kein X-Scroll auf Phone */
  scroll-snap-type:none;
  -ms-overflow-style:auto;
  scrollbar-width:auto;
}

/* Tablet/Desktop: horizontale Kartenleiste, alle Karten gleich breit */
@media (min-width: 600px){
  .row-scroll{
    display:grid;
    grid-template-columns:unset;       /* wechselt vom Grid-Layout zu Columns */
    grid-auto-flow:column;
    grid-auto-columns:clamp(220px, 32vw, 360px); /* alle Karten gleiche Breite */
    gap:12px;
    padding:4px 10px 10px;
    overflow-x:auto;
    scroll-snap-type:x proximity;
    -ms-overflow-style:none;
    scrollbar-width:none;
  }
}

/* Karten selbst füllen die Spalte komplett */
.row-scroll .card{
  width:100%;
  max-width:unset;    /* kein Deckel, Breite kommt von grid-auto-columns/1fr */
  min-height:150px;
}

/* Optional: Dezente Scrollbar */
.row-scroll::-webkit-scrollbar {
  height: 0;
}
.row-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.row-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .12);
  border-radius: 6px;
}

/* Kachel-Stil */
.card {
  background: var(--paper);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  height: 100%;
}

.card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.card .body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card .title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  color: #3a2f27;
}

.card .desc {
  font-size: 13.5px;
  color: var(--muted);
  height: 2.9em;
  overflow: hidden;
}

.card a {
  color: var(--brand);  /* Benutze die festgelegte Akzentfarbe */
  text-decoration: none; /* Entferne die Unterstreichung */
  transition: color 0.3s ease; /* Sanfter Übergang bei Hover */
}

.card a:hover {
  color: var(--brand-2);  /* Farbe beim Hover */
  text-decoration: underline; /* Unterstreichung bei Hover */
}

/* Rezeptseite */
.recipe {
  padding: 12px;
  max-width: 880px;
  margin: 0 auto;
}
.recipe h2 {
  margin: 10px 0 8px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: .2px;
  color: #3a2f27;
}

/* Infozeile */
.meta {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #6a5e55;
  font-size: 14px;
  flex-wrap: wrap;
}
.persons {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}
.persons input {
  width: 78px;
  padding: 7px 8px;
  border: 1px solid var(--chip-border);
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
}
.persons input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(224, 122, 95, 0.15);
}

/* Abschnitte */
.section {
  background: var(--paper);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 12px 0;
  box-shadow: var(--shadow-soft);
}
.section h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
  color: #3c2e25;
}

/* Tabelle */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 9px 6px;
  border-bottom: 1px solid #efe8df;
  text-align: left;
  font-size: 14px;
}
.table th {
  font-weight: 800;
  color: #4a3f36;
}
.table tr:hover td {
  background: #fffaf3;
}

/* Zutaten – optional abhakbar: Kochlöffel-Checkboxen */
.ingredients .checkcell {
  width: 38px;
}
.chk {
  --size: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.chk input {
  appearance: none;
  -webkit-appearance: none;
  width: var(--size);
  height: var(--size);
  margin: 0;
  border: 1.5px solid #cdbfb1;
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.03);
}
.chk input:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(129, 178, 154, 0.18);
}
.chk input:checked {
  background: linear-gradient(135deg, var(--brand-2), #6aa88e);
  border-color: transparent;
}
.chk input:checked::after {
  content: "";
  width: 12px;
  height: 12px;
  background: #fff;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 128'><path d='M79 10c-16 0-29 13-29 29 0 8 3 15 8 21L19 99c-4 4-4 10 0 14s10 4 14 0l39-39c6 5 13 8 21 8 16 0 29-13 29-29S95 10 79 10z' fill='%23ffffff'/></svg>") center/contain no-repeat;
}

/* Attachments */
.attach {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.attach a {
  color: #7a4b2a;
  font-weight: 700;
}

/* Footer-Spacer */
footer.spacer {
  height: 24px;
}

/* Kleinere Feinheiten */
::selection {
  background: rgba(224, 122, 95, 0.25);
}

/* Attachments als hübsches Grid */
.attach-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px) {
  .attach-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.attach-tile {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.attach-tile img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.attach-video {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}
.attach-tile.file {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  font-weight: 700;
}

/* ==== Gruppen-Ansicht: eine Zeile pro Gruppe, horizontal scrollbar ==== */
.group-section {
  margin: 14px 10px 20px;
}
.group-title {
  font-weight: 800;
  font-size: 22px;
  margin: 6px 4px 10px;
  color: #000000; /* warmes Braun */
}

/* horizontale Kartenleiste */
.row-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 60vw); /* Handy: breite Kacheln, Tablet: passt */
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
  -ms-overflow-style: none; /* Für IE und Edge */
  scrollbar-width: none; /* Für Firefox */
}
.row-scroll .card {
  scroll-snap-align: start;
  width: 100%;
  max-width: 420px; /* Deckel für große Screens */
  min-height: 150px;
}

/* optional: dezente Scrollbar */
.row-scroll::-webkit-scrollbar {
  height: 0;
}
.row-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.row-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .12);
  border-radius: 6px;
}

/* ============================================== */
/* MOBILE ADMIN LIST (recipes_list.php) */
/* ============================================== */

/* KLASSEN FÜR BEDIENGUNGSWEISE */
.desktop-only {
  display: table-cell;
}
.mobile-only {
  display: none !important;
}

@media screen and (max-width: 600px) {
  /* WICHTIG: Überschreiben der Desktop-Klassen auf Mobile */
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: flex !important;
  }
  .desktop-only-text {
    display: none !important;
  } /* NEUE REGEL: Text in Buttons ausblenden */

  /* ADMINBAR UND CHIPS */
  .adminbar {
    flex-wrap: wrap;
    align-items: flex-start;
    padding-bottom: 8px;
  }
  .adminbar .brand {
    width: 100%;
    margin-bottom: 4px;
  }
  .adminmenu {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  /* SUCHE UND BUTTONS UNTER DER ÜBERSCHRIFT */
  form[method="get"] {
    flex-wrap: wrap;
  }
  form[method="get"] input[name="q"] {
    flex-basis: 100%;
    margin-bottom: 8px;
  }
  form[method="get"] .group-chip {
    flex-grow: 1;
    justify-content: center;
    white-space: nowrap;
    min-width: 100px;
  }

  /* TABELLE IN KARTENANSICHT UMwandeln */
  .table {
    width: 100%;
  }
  .table thead {
    display: none;
  } /* Kopfzeile ausblenden */
  .table tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 10px;
  }
  .table td {
    /* Alle TD-Elemente in der mobilen Ansicht werden zu Blöcken */
    display: block;
    padding: 4px 0;
    border: none;
    text-align: left !important;
  }

  /* LAYOUT DER EINZELNEN BLÖCKE */

  /* Die Haupt-Zelle (Titel + Aktionen) nimmt volle Breite ein */
  .recipe-main-cell {
    width: 100% !important;
  }

  /* WICHTIG: Haupt-Container für alles auf einer mobilen Zeile */
  .recipe-content-line {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between; /* Verteilt Bild/Titel und Aktionen */
  }

  .recipe-row-top {
    /* Bild und Titel-Text */
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
    min-width: 0;
  }

  .recipe-title {
    font-weight: 800;
    font-size: 1.1em;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
  }

  /* AKTIONEN-SEKTION */
  .recipe-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
  }

  .recipe-actions .group-chip {
    flex-grow: 0;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }
  
  /* =======================================================   Gemeinsames Styling für alle Buttons */
  /* Header anpassen, um den Button oben rechts zu platzieren */
  header.site {
    position: relative; /* Setze den Header auf 'relative', um die Position des Buttons innerhalb des Headers zu kontrollieren */
  }
  
  .searchbar .group-chip {
    position: absolute; /* Absolut positioniert relativ zum Header */
    top: 2px    ; /* Abstände von oben */
    right: 2px; /* Abstände von rechts */
    font-size: 1.0rem; /* Passe die Größe des Buttons an, wenn nötig */
    color: black; /* Verwende die Akzentfarbe für den Button */
  }
  
  /* ==== Buttons oben rechts ==== */
  .button-container {
    display: flex;
    gap: 6px; /* Enge zwischen den Buttons */
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 10;
  }
  
  /* Spezifischer Container für die linken Buttons */
  .button-container.left {
    left: 15px; /* Abstand von der linken Seite */
    top: 15px;
    justify-content: flex-start; /* Links ausgerichtet */
  }
  
  /* Spezifischer Container für die rechten Buttons */
  .button-container.right {
    right: 15px; /* Abstand von der rechten Seite */
    top: 15px;
    justify-content: flex-end; /* Rechts ausgerichtet */
  }
  
  /* Gemeinsames Styling für alle Buttons */
  .button-function {
    background-color: #ffffff !important;  /* Vollständig transparent */
    color: #000000  !important;             /* Akzentfarbe für das Symbol */
    padding: 3px;                               /* Weniger Padding für kleinere Buttons */
    font-size: 20px;                            /* Größere Schriftgröße für die Symbole */
    border: none !important;                    /* Kein Rahmen */
    border-radius: 3px;                         /* Abgerundete Ecken */
    cursor: pointer;
    transition: transform 0.2s ease;             /* Sanfte Übergangseffekte */
    box-shadow: none;                           /* Kein Schatten */
    text-align: center;                         /* Symbole zentrieren */
  }
  
  /* Sicherstellen, dass der Button-Inhalt gut sichtbar ist */
  .button-function span {
    display: inline-block;
    font-size: 18px;                            /* Größere Schriftgröße für die Symbole */
    line-height: 1;                             /* Zeilenhöhe auf 1 setzen, damit es keine unerwünschten Abstände gibt */
  }
  
  /* Dropdown-Menü verstecken */
  .dropdown-content {
    display: none; /* Anfangs ausgeblendet */
    position: absolute;
    background-color: rgba(255, 255, 255, 0.8); /* Leicht transparente weiße Hintergrundfarbe */
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 12px; /* Abgerundete Ecken */
    padding: 10px; /* Abstand im Dropdown */
  }
  
  .dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    border-radius: 6px; /* Abgerundete Ecken für jedes Menü-Element */
  }
  
  .dropdown-content a:hover {
    background-color: #ddd;
  }
  
  /* Zeige das Dropdown-Menü an, wenn der Button aktiv ist */
  .button-function:hover + .dropdown-content, .dropdown-content:hover {
    display: block;
  }
  
  /* Animation beim Drücken (Vergrößern) */
  .button-function:active {
    transform: scale(1.5);          /* Button leicht vergrößern */
  }
}