/*
 * chaji — 茶事 — Stylesheet
 * Optimiert für iPhone 13 mini (375×812 Viewport)
 * Ästhetik: Japanisch-chinesische Teezeremonie
 */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@300;400;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=JetBrains+Mono:wght@300;400&display=swap');

/* ═══ Tokens ═══════════════════════════════════ */

:root {
  --ink:       #1a0f0a;
  --br9:       #2c1a0e;
  --br8:       #3e2723;
  --br7:       #4e342e;
  --br6:       #6d4c41;
  --br5:       #795548;
  --br4:       #a1887f;
  --br3:       #bcaaa4;
  --br2:       #d7ccc8;
  --br1:       #efebe9;
  --br0:       #fdf8f5;

  --gold:      #b8943f;
  --gold-l:    #d4b866;
  --gold-ll:   #eedfa3;

  --weck-bg:   #fdf6e3;
  --done-bg:   rgba(188,170,164,0.30);
  --done-txt:  #a1887f;
  --reset:     #bf4e00;

  --font-serif:  'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-kanji:  'Noto Serif SC', serif;
  --font-mono:   'JetBrains Mono', 'SF Mono', monospace;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ═══ Reset ════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--br0);
  color: var(--br8);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button { font: inherit; border: none; cursor: pointer; background: none; }
input[type="checkbox"] { margin: 0; }

/* ═══ Scrollbar (Desktop) ═════════════════════ */

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--br1); }
::-webkit-scrollbar-thumb { background: var(--br3); border-radius: 2px; }

/* ══════════════════════════════════════════════
   SORTENAUSWAHL — Liste
   ══════════════════════════════════════════════ */

.header-list {
  background: var(--br9);
  padding: calc(var(--safe-top) + 16px) 20px 24px;
  text-align: center;
}

.header-list .kanji {
  font-family: var(--font-kanji);
  font-size: 28px;
  font-weight: 300;
  color: var(--gold);
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 4px;
}

.header-list h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 300;
  color: var(--br1);
  letter-spacing: 0.08em;
}

.header-list .tagline {
  font-size: 13px;
  font-weight: 300;
  color: var(--br4);
  letter-spacing: 0.04em;
  margin-top: 6px;
}

/* Kategorie-Sektionen */

.tea-list {
  padding: 12px 14px calc(var(--safe-bottom) + 24px);
}

.kat-section {
  margin-bottom: 20px;
}

.kat-header {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--br5);
  padding: 10px 6px 6px;
  border-bottom: 1px solid var(--br2);
  margin-bottom: 6px;
}

/* Tee-Karte */

.tea-card {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 10px;
  border-radius: 10px;
  transition: background 0.15s ease;
  gap: 12px;
  text-align: left;
}

.tea-card:active {
  background: var(--br1);
}

.tea-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.06);
}

.tea-card-text {
  flex: 1;
  min-width: 0;
}

.tea-name {
  display: block;
  font-size: 17px;
  font-weight: 400;
  color: var(--br8);
  line-height: 1.3;
}

.tea-meta {
  display: block;
  font-size: 12px;
  font-weight: 300;
  color: var(--br4);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tea-count {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 300;
  color: var(--br4);
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

/* ══════════════════════════════════════════════
   AUFGUSS-TRACKER
   ══════════════════════════════════════════════ */

.header-tracker {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--br9);
  padding: calc(var(--safe-top) + 10px) 14px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 3px 18px rgba(0,0,0,0.3);
}

.btn-back {
  font-size: 28px;
  color: var(--gold);
  padding: 4px 8px;
  line-height: 1;
}

.header-tracker-text {
  flex: 1;
  min-width: 0;
}

.header-tracker h1 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--br1);
  line-height: 1.2;
}

.header-tracker p {
  font-size: 12px;
  font-weight: 300;
  color: var(--br4);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Info-Bereich */

.tracker-info {
  padding: 14px 18px 8px;
  border-bottom: 1px solid var(--gold-ll);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.info-label {
  font-weight: 300;
  color: var(--br5);
}

.info-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--br7);
}

.info-hinweis {
  font-size: 12px;
  font-weight: 300;
  font-style: italic;
  color: var(--br5);
  margin-top: 8px;
  line-height: 1.4;
}

/* Fortschrittsbalken */

.progress-bar-wrap {
  height: 3px;
  background: var(--br2);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-l));
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
  border-radius: 0 2px 2px 0;
}

/* Aufguss-Liste */

.infusion-list {
  list-style: none;
  padding: 6px 10px calc(var(--safe-bottom) + 100px);
}

.infusion-row {
  padding: 14px 8px;
  border-bottom: 1px solid var(--br1);
  transition: opacity 0.3s ease, background 0.3s ease;
}

.infusion-row.weck {
  background: var(--weck-bg);
  border-left: 3px solid var(--gold);
}

.infusion-row.done {
  background: var(--done-bg);
  opacity: 0.55;
}

.infusion-row.done .infusion-desc,
.infusion-row.done .infusion-temp,
.infusion-row.done .infusion-zeit,
.infusion-row.done .infusion-nr {
  text-decoration: line-through;
  color: var(--done-txt);
}

.infusion-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.infusion-cb {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border: 2px solid var(--br3);
  border-radius: 6px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.infusion-cb:checked {
  background: var(--gold);
  border-color: var(--gold);
}

.infusion-cb:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 16px;
  font-weight: 700;
}

.infusion-nr {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 400;
  color: var(--br6);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.infusion-temp {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 400;
  color: var(--br7);
  width: 60px;
  flex-shrink: 0;
}

.infusion-zeit {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 300;
  color: var(--br6);
  flex: 1;
}

.infusion-desc {
  display: block;
  font-size: 13px;
  font-weight: 300;
  font-style: italic;
  color: var(--br5);
  padding-left: 72px;
  margin-top: 4px;
  line-height: 1.4;
}

/* Aktionsbereich */

.tracker-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 18px calc(var(--safe-bottom) + 12px);
  background: linear-gradient(transparent, var(--br0) 30%);
  text-align: center;
}

.btn-reset {
  font-size: 14px;
  font-weight: 400;
  color: var(--reset);
  padding: 10px 24px;
  border: 1px solid var(--reset);
  border-radius: 8px;
  background: var(--br0);
  transition: background 0.15s;
}

.btn-reset:active {
  background: #fff0e6;
}

/* Reset-Overlay */

.reset-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(26,15,10,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.reset-overlay.hidden {
  display: none;
}

.reset-dialog {
  background: var(--br0);
  border-radius: 14px;
  padding: 28px 24px 20px;
  text-align: center;
  box-shadow: 0 12px 48px rgba(0,0,0,0.35);
  max-width: 300px;
  width: 100%;
}

.reset-dialog p {
  font-size: 17px;
  font-weight: 400;
  margin-bottom: 20px;
  color: var(--br8);
}

.reset-buttons {
  display: flex;
  gap: 12px;
}

.btn-confirm {
  flex: 1;
  padding: 12px;
  background: var(--reset);
  color: white;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
}

.btn-cancel {
  flex: 1;
  padding: 12px;
  background: var(--br2);
  color: var(--br7);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 400;
}

/* ═══ PWA Standalone ══════════════════════════ */

@media (display-mode: standalone) {
  .header-list {
    padding-top: calc(var(--safe-top) + 20px);
  }
  .header-tracker {
    padding-top: calc(var(--safe-top) + 14px);
  }
}
