/*
 * TeamFlow Canteen - Darstellung des Speiseplans.
 *
 * Keine eigenen Farben und Schriften (ADR-0003, ADR-0015): Alles erbt vom
 * Theme. Hier steht nur Aufbau - Abstände, Raster, Flächen und Linien, alle
 * aus currentColor abgeleitet. So passt der Plan auf jede Website.
 *
 * --teamflow-canteen-accent: Akzent für Linien und Markierungen. Vorgabe ist
 * die Textfarbe; der Betreiber setzt ihn im CSS seines Themes, z.B.
 *   .teamflow-canteen { --teamflow-canteen-accent: #1f6fa8; }
 * Die Vorgaben stehen in :where() und haben damit Spezifität null. Das ist
 * nötig, weil WordPress dieses Stylesheet erst im Seitenfuß lädt, also nach
 * dem Theme-CSS - bei gleicher Spezifität gewönne sonst unsere Vorgabe.
 *
 * Die übrigen Selektoren sind bewusst doppelt verankert (.teamflow-canteen .x):
 * Themes wie Divi geben Listen und Überschriften Innenabstände, die eine
 * einfache Klassenregel nicht überstimmt.
 */

:where(.teamflow-canteen) {
  --teamflow-canteen-accent: currentColor;
  /* Schrift auf Akzentflächen (Aushang-Layout, Fußblock). Einzige Farbe,
     die das Plugin mitbringt - überschreibbar wie der Akzent. */
  --teamflow-canteen-on-accent: #fff;
  --teamflow-canteen-surface: color-mix(in srgb, currentColor 5%, transparent);
  --teamflow-canteen-line: color-mix(in srgb, currentColor 15%, transparent);
}

.teamflow-canteen {
  color: inherit;
  font-family: inherit;
  margin: 1.5em 0;
}

.teamflow-canteen ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* hidden muss gewinnen, auch gegen display-Regeln hier und im Theme -
   sonst bleiben ausgeblendete Wochen und die Leiste ohne Skript sichtbar. */
.teamflow-canteen [hidden] {
  display: none !important;
}

/* Wochen-Umschalter */
.teamflow-canteen .teamflow-canteen__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: 0 0 1.5em;
}

.teamflow-canteen .teamflow-canteen__tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font: inherit;
  line-height: 1.3;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 2px solid var(--teamflow-canteen-line);
  border-radius: 0.5em;
  padding: 0.5em 1.1em;
  cursor: pointer;
}

.teamflow-canteen .teamflow-canteen__tab:hover {
  background: var(--teamflow-canteen-surface);
}

.teamflow-canteen .teamflow-canteen__tab[aria-selected="true"] {
  border-color: var(--teamflow-canteen-accent);
  background: var(--teamflow-canteen-surface);
}

.teamflow-canteen .teamflow-canteen__tab:focus-visible {
  outline: 2px solid var(--teamflow-canteen-accent);
  outline-offset: 2px;
}

.teamflow-canteen .teamflow-canteen__tab-week {
  font-weight: bold;
}

.teamflow-canteen .teamflow-canteen__tab-dates {
  font-size: 0.8em;
  opacity: 0.75;
}

.teamflow-canteen h3,
.teamflow-canteen h4 {
  padding: 0;
  color: inherit;
}

/* Wiegepreis über dem Plan */
.teamflow-canteen .teamflow-canteen__banner {
  font-weight: bold;
  font-size: 1.15em;
  text-align: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 1.5em;
  padding: 0.6em 1em;
  border: 2px solid var(--teamflow-canteen-accent);
  border-radius: 0.5em;
}

/* Woche */
.teamflow-canteen .teamflow-canteen__week {
  margin: 0 0 2.5em;
}

.teamflow-canteen .teamflow-canteen__week-title {
  font-size: 1.6em;
  font-weight: bold;
  line-height: 1.2;
  margin: 0 0 0.15em;
}

.teamflow-canteen .teamflow-canteen__serving {
  margin: 0 0 1.2em;
  padding: 0;
  opacity: 0.75;
}

/* Tag als Karte */
.teamflow-canteen .teamflow-canteen__day {
  background: var(--teamflow-canteen-surface);
  border-left: 4px solid var(--teamflow-canteen-accent);
  border-radius: 0.5em;
  padding: 0.9em 1.2em 0.6em;
  margin: 0 0 1em;
}

.teamflow-canteen .teamflow-canteen__day-title {
  font-size: 1.1em;
  font-weight: bold;
  letter-spacing: 0.02em;
  margin: 0 0 0.4em;
}

.teamflow-canteen .teamflow-canteen__entry {
  display: grid;
  grid-template-columns: 9em 1fr auto;
  gap: 0.25em 1.2em;
  align-items: baseline;
  padding: 0.55em 0;
  border-top: 1px solid var(--teamflow-canteen-line);
}

.teamflow-canteen .teamflow-canteen__entry:first-child {
  border-top: 0;
}

/* Menülinie als kleines Etikett */
.teamflow-canteen .teamflow-canteen__menu-line {
  font-size: 0.75em;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.teamflow-canteen .teamflow-canteen__dish {
  line-height: 1.45;
}

.teamflow-canteen .teamflow-canteen__codes,
.teamflow-canteen .teamflow-canteen__note,
.teamflow-canteen .teamflow-canteen__block-size,
.teamflow-canteen .teamflow-canteen__occasion {
  font-size: 0.8em;
  opacity: 0.7;
}

.teamflow-canteen .teamflow-canteen__price,
.teamflow-canteen .teamflow-canteen__block-price {
  white-space: nowrap;
  font-weight: bold;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.teamflow-canteen .teamflow-canteen__holiday {
  font-style: italic;
  margin: 0;
  padding: 0.3em 0 0.5em;
}

/* Bausteine (Getränke, Becher, ...) */
.teamflow-canteen .teamflow-canteen__blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16em, 1fr));
  gap: 1em;
  margin: 2em 0 1.5em;
}

.teamflow-canteen .teamflow-canteen__block {
  background: var(--teamflow-canteen-surface);
  border-radius: 0.5em;
  padding: 0.9em 1.2em;
}

.teamflow-canteen .teamflow-canteen__block--separated {
  border-top: 3px solid var(--teamflow-canteen-accent);
}

.teamflow-canteen .teamflow-canteen__block-title {
  font-size: 0.85em;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.5em;
}

.teamflow-canteen .teamflow-canteen__block-intro,
.teamflow-canteen .teamflow-canteen__block-footer {
  margin: 0.3em 0;
  padding: 0;
  font-size: 0.85em;
  opacity: 0.75;
}

.teamflow-canteen .teamflow-canteen__block-lines li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
  padding: 0.2em 0;
}

.teamflow-canteen .teamflow-canteen__block-size {
  white-space: nowrap;
}

/* Legende und Hinweise */
.teamflow-canteen .teamflow-canteen__legend {
  font-size: 0.85em;
  line-height: 1.6;
  margin: 1.5em 0 0.5em;
  padding-top: 1em;
  border-top: 1px solid var(--teamflow-canteen-line);
}

.teamflow-canteen .teamflow-canteen__legend p {
  padding: 0;
}

.teamflow-canteen .teamflow-canteen__legend-title {
  margin: 0 0 0.3em;
  font-size: 1em;
  font-weight: bold;
}

.teamflow-canteen .teamflow-canteen__legend-item {
  white-space: nowrap;
}

.teamflow-canteen .teamflow-canteen__disclaimer,
.teamflow-canteen .teamflow-canteen__empty,
.teamflow-canteen .teamflow-canteen__admin-note {
  font-size: 0.85em;
  opacity: 0.75;
}

.teamflow-canteen .teamflow-canteen__admin-note {
  border-left: 3px solid currentColor;
  padding-left: 0.6em;
}

/* Gast-Bewertung (ADR-0006, ADR-0029). Keine eigenen Farben: Rahmen und
   Flächen aus currentColor wie alles andere (ADR-0003). */
.teamflow-canteen .teamflow-canteen__rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 1em;
  font-size: 0.9em;
}

.teamflow-canteen .teamflow-canteen__entry .teamflow-canteen__rating {
  grid-column: 2 / -1;
}

.teamflow-canteen .teamflow-canteen__cell .teamflow-canteen__rating {
  justify-content: center;
  margin-top: 0.3em;
}

.teamflow-canteen .teamflow-canteen__rating-buttons {
  display: inline-flex;
  gap: 0.4em;
}

.teamflow-canteen .teamflow-canteen__rate {
  font: inherit;
  font-size: 1.1em;
  line-height: 1;
  color: inherit;
  background: transparent;
  border: 1px solid var(--teamflow-canteen-line);
  border-radius: 999px;
  padding: 0.35em 0.6em;
  cursor: pointer;
}

.teamflow-canteen .teamflow-canteen__rate:hover {
  background: var(--teamflow-canteen-surface);
  border-color: var(--teamflow-canteen-accent);
}

.teamflow-canteen .teamflow-canteen__rate:focus-visible {
  outline: 2px solid var(--teamflow-canteen-accent);
  outline-offset: 2px;
}

.teamflow-canteen .teamflow-canteen__rate:disabled {
  cursor: progress;
  opacity: 0.5;
}

.teamflow-canteen .teamflow-canteen__rating-counts {
  display: inline-flex;
  gap: 0.8em;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.teamflow-canteen .teamflow-canteen__rating-count {
  white-space: nowrap;
}

.teamflow-canteen .teamflow-canteen__rating-status:empty {
  display: none;
}

.teamflow-canteen .teamflow-canteen__rating-status {
  font-size: 0.9em;
  font-style: italic;
}

/* Kommentar nach dem Daumen (ADR-0030). Erbt Schrift und Farbe vom Theme. */
.teamflow-canteen .teamflow-canteen__comment {
  flex-basis: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3em 0.6em;
  align-items: center;
  max-width: 32em;
}

.teamflow-canteen .teamflow-canteen__comment label {
  grid-column: 1 / -1;
}

.teamflow-canteen .teamflow-canteen__comment-text {
  grid-column: 1 / -1;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--teamflow-canteen-line);
  border-radius: 0.3em;
  padding: 0.4em 0.5em;
  resize: vertical;
  min-height: 2.6em;
  width: 100%;
  box-sizing: border-box;
}

.teamflow-canteen .teamflow-canteen__comment-text:focus-visible {
  outline: 2px solid var(--teamflow-canteen-accent);
  outline-offset: 1px;
}

.teamflow-canteen .teamflow-canteen__comment-hint,
.teamflow-canteen .teamflow-canteen__comment-counter {
  font-size: 0.85em;
  opacity: 0.75;
}

.teamflow-canteen .teamflow-canteen__comment-counter {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.teamflow-canteen .teamflow-canteen__comment-send {
  justify-self: start;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--teamflow-canteen-line);
  border-radius: 999px;
  padding: 0.3em 0.9em;
  cursor: pointer;
}

.teamflow-canteen .teamflow-canteen__comment-send:hover:not(:disabled) {
  background: var(--teamflow-canteen-surface);
  border-color: var(--teamflow-canteen-accent);
}

.teamflow-canteen .teamflow-canteen__comment-send:focus-visible {
  outline: 2px solid var(--teamflow-canteen-accent);
  outline-offset: 2px;
}

.teamflow-canteen .teamflow-canteen__comment-send:disabled {
  cursor: default;
  opacity: 0.5;
}

.teamflow-canteen .teamflow-canteen__comment-status {
  grid-column: 1 / -1;
  font-size: 0.9em;
  font-style: italic;
}

.teamflow-canteen .teamflow-canteen__comment-status:empty {
  display: none;
}

/* Standortwahl „Ich esse im: …“ (ADR-0031, Nachtrag). Wie die Wochen-Knöpfe
   ohne eigene Farben; die Wahl zeigt der Rahmen in der Akzentfarbe. */
.teamflow-canteen .teamflow-canteen__location-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 0.8em;
  margin: 0 0 1em;
}

.teamflow-canteen .teamflow-canteen__locations {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4em;
}

.teamflow-canteen .teamflow-canteen__location {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--teamflow-canteen-line);
  border-radius: 999px;
  padding: 0.3em 0.9em;
  cursor: pointer;
}

.teamflow-canteen .teamflow-canteen__location[aria-checked="true"] {
  border-color: var(--teamflow-canteen-accent);
  box-shadow: inset 0 0 0 1px var(--teamflow-canteen-accent);
  font-weight: bold;
}

.teamflow-canteen .teamflow-canteen__location:focus-visible {
  outline: 2px solid var(--teamflow-canteen-accent);
  outline-offset: 2px;
}

/* Vormerkung je Gericht (ADR-0031) */
.teamflow-canteen .teamflow-canteen__prereg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4em 1em;
  font-size: 0.9em;
  margin-top: 0.3em;
}

.teamflow-canteen .teamflow-canteen__prereg[hidden] {
  display: none;
}

.teamflow-canteen .teamflow-canteen__entry .teamflow-canteen__prereg {
  grid-column: 2 / -1;
}

.teamflow-canteen .teamflow-canteen__cell .teamflow-canteen__prereg {
  justify-content: center;
}

.teamflow-canteen .teamflow-canteen__prereg-button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--teamflow-canteen-line);
  border-radius: 999px;
  padding: 0.3em 0.9em;
  cursor: pointer;
}

.teamflow-canteen .teamflow-canteen__prereg-button[aria-pressed="true"] {
  border-color: var(--teamflow-canteen-accent);
  box-shadow: inset 0 0 0 1px var(--teamflow-canteen-accent);
}

.teamflow-canteen .teamflow-canteen__prereg-button:hover:not(:disabled) {
  background: var(--teamflow-canteen-surface);
  border-color: var(--teamflow-canteen-accent);
}

.teamflow-canteen .teamflow-canteen__prereg-button:focus-visible {
  outline: 2px solid var(--teamflow-canteen-accent);
  outline-offset: 2px;
}

.teamflow-canteen .teamflow-canteen__prereg-button:disabled {
  cursor: default;
  opacity: 0.5;
}

.teamflow-canteen .teamflow-canteen__prereg-close {
  opacity: 0.75;
}

.teamflow-canteen .teamflow-canteen__prereg-close:empty,
.teamflow-canteen .teamflow-canteen__prereg-status:empty {
  display: none;
}

.teamflow-canteen .teamflow-canteen__prereg-status {
  font-style: italic;
}

.teamflow-canteen .teamflow-canteen__rating-notice {
  font-size: 0.8em;
  opacity: 0.7;
}

/* Nur für Screenreader, z.B. "gut" hinter der Zahl. */
.teamflow-canteen .teamflow-canteen__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================================
   Layout "Aushang": Raster wie der gedruckte Speiseplan
   Tage als Zeilen, Menülinien als Spalten. Text in der Akzentfarbe,
   Bausteine auf einer Akzentfläche.
   ========================================================================= */

.teamflow-canteen--aushang {
  color: var(--teamflow-canteen-accent);
}

.teamflow-canteen--aushang .teamflow-canteen__week-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.2em 1em;
  margin: 0 0 1em;
}

.teamflow-canteen--aushang .teamflow-canteen__week-title {
  font-size: 1.3em;
  font-weight: normal;
  margin: 0;
}

.teamflow-canteen--aushang .teamflow-canteen__separator {
  opacity: 0.5;
  margin: 0 0.15em;
}

.teamflow-canteen--aushang .teamflow-canteen__serving {
  margin: 0;
  opacity: 1;
}

.teamflow-canteen .teamflow-canteen__table {
  display: grid;
  grid-template-columns: 5.5em repeat(var(--teamflow-canteen-columns, 2), minmax(0, 1fr));
  gap: 4px;
}

.teamflow-canteen .teamflow-canteen__column-title {
  background: var(--teamflow-canteen-surface);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
  padding: 0.45em 0.5em;
}

.teamflow-canteen .teamflow-canteen__row-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-top: 1px solid var(--teamflow-canteen-line);
  padding: 0.6em 0;
}

.teamflow-canteen .teamflow-canteen__row-title strong {
  font-size: 1.25em;
  line-height: 1.1;
}

.teamflow-canteen .teamflow-canteen__row-title span {
  font-size: 0.85em;
}

.teamflow-canteen .teamflow-canteen__cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.25em;
  text-align: center;
  padding: 0.8em 1em;
  background: var(--teamflow-canteen-surface);
}

.teamflow-canteen .teamflow-canteen__cell--holiday {
  grid-column: 2 / -1;
  font-style: italic;
}

.teamflow-canteen--aushang .teamflow-canteen__dish {
  line-height: 1.35;
}

.teamflow-canteen .teamflow-canteen__meta {
  font-size: 0.8em;
}

.teamflow-canteen--aushang .teamflow-canteen__meta .teamflow-canteen__codes {
  font-size: 0.95em;
}

.teamflow-canteen--aushang .teamflow-canteen__note {
  font-size: 1em;
  font-weight: bold;
  opacity: 1;
}

/* Bausteine als Akzentfläche wie der Fuß des Aushangs */
.teamflow-canteen--aushang .teamflow-canteen__blocks {
  gap: 0.5em 2em;
  padding: 1.2em 1.5em;
  background: var(--teamflow-canteen-accent);
  color: var(--teamflow-canteen-on-accent);
  border-radius: 2px;
}

.teamflow-canteen--aushang .teamflow-canteen__block {
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.teamflow-canteen--aushang .teamflow-canteen__block--separated {
  border-top: 1px solid currentColor;
  padding-top: 0.4em;
}

.teamflow-canteen--aushang .teamflow-canteen__block-title {
  font-size: 1.1em;
  color: inherit;
}

.teamflow-canteen--aushang .teamflow-canteen__block-lines li {
  font-weight: bold;
}

.teamflow-canteen--aushang .teamflow-canteen__block-size {
  font-weight: normal;
}

.teamflow-canteen--aushang .teamflow-canteen__legend {
  font-size: 0.75em;
  line-height: 1.5;
  border-top: 0;
  padding-top: 0;
}

.teamflow-canteen--aushang .teamflow-canteen__disclaimer {
  font-size: 0.75em;
}

/* Schmale Bildschirme: Etikett über dem Gericht, Preis rechts daneben. */
@media (max-width: 600px) {
  .teamflow-canteen .teamflow-canteen__day {
    padding: 0.8em 0.9em 0.5em;
  }

  .teamflow-canteen .teamflow-canteen__entry {
    grid-template-columns: 1fr auto;
  }

  .teamflow-canteen .teamflow-canteen__menu-line,
  .teamflow-canteen .teamflow-canteen__entry .teamflow-canteen__rating {
    grid-column: 1 / -1;
  }

  /* Aushang: Raster wird zu Tageskarten, Menülinie aus data-line als Etikett */
  .teamflow-canteen .teamflow-canteen__table {
    grid-template-columns: 1fr;
  }

  .teamflow-canteen .teamflow-canteen__corner,
  .teamflow-canteen .teamflow-canteen__column-title,
  .teamflow-canteen .teamflow-canteen__cell--empty {
    display: none;
  }

  .teamflow-canteen .teamflow-canteen__row-title {
    flex-direction: row;
    justify-content: flex-start;
    align-items: baseline;
    gap: 0.5em;
    margin-top: 0.8em;
  }

  .teamflow-canteen .teamflow-canteen__cell {
    align-items: flex-start;
    text-align: left;
  }

  .teamflow-canteen .teamflow-canteen__cell .teamflow-canteen__rating {
    justify-content: flex-start;
  }

  .teamflow-canteen .teamflow-canteen__cell--holiday {
    grid-column: 1 / -1;
  }

  .teamflow-canteen .teamflow-canteen__cell[data-line]::before {
    content: attr(data-line);
    font-size: 0.7em;
    font-weight: bold;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
}
