/* reflect.moser.ai — Mobile-First, LifeOS Design DNA
 * Glassmorphism, Lexend, Anthrazit + Blau-Akzent (psychologisch ruhig)
 * Single Source of Truth — kein Inline-CSS in index.html
 */

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

/* :root block migrated to /tokens.css + /tokens-reflect.css */

html, body { height: 100%; overscroll-behavior: none; }

body {
  background:
    radial-gradient(circle at 20% -10%, rgba(86, 163, 199, 0.08), transparent 40%),
    radial-gradient(circle at 100% 10%, rgba(86, 163, 199, 0.05), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: "Lexend", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: env(safe-area-inset-bottom);
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

.hidden { display: none !important; }

/* ── PIN Screen ── */

#pin-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.pin-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  width: 100%; max-width: 380px;
  text-align: center;
  backdrop-filter: blur(20px);
}

.pin-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(86, 163, 199, 0.42);
}

.pin-card h1 {
  font-size: 22px; font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.pin-card p {
  color: var(--text-muted); font-size: 13px;
  margin-bottom: 24px;
}

.pin-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

#pin-input {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  font-size: 18px;
  letter-spacing: 4px;
  text-align: center;
  margin-bottom: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#pin-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ── Topbar ── */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(20, 23, 30, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
}

.brand {
  display: flex; align-items: center; gap: 10px;
}

.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(86, 163, 199, 0.36);
}

.brand-name {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.topbar-info {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Tabs ── */

.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
  max-width: 720px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition);
}

.tab:hover {
  color: var(--text);
  background: var(--surface);
}

.tab.active {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

/* ── Main ── */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 64px;
  display: flex; flex-direction: column;
  gap: 14px;
}

.tab-panel { display: none; flex-direction: column; gap: 14px; }
.tab-panel.active { display: flex; }

/* ── Cards ── */

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  backdrop-filter: blur(8px);
}

.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
  gap: 10px;
}

.card-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.1px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.card-reflection {
  border-color: rgba(86, 163, 199, 0.22);
  background: linear-gradient(180deg, var(--surface2) 0%, var(--surface3) 100%);
}

/* ── Mood Slider ── */

.mood-slider-wrap {
  padding: 8px 4px 4px;
}

#mood-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  background: linear-gradient(90deg,
    var(--mood-1) 0%,
    var(--mood-3) 25%,
    var(--mood-5) 50%,
    var(--mood-7) 75%,
    var(--mood-10) 100%);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
}

#mood-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent-dark);
  box-shadow: var(--shadow-md);
  cursor: grab;
  transition: transform var(--transition);
}

#mood-slider::-webkit-slider-thumb:active { transform: scale(1.12); cursor: grabbing; }

#mood-slider::-moz-range-thumb {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent-dark);
  box-shadow: var(--shadow-md);
  cursor: grab;
}

.mood-scale {
  display: flex; justify-content: space-between;
  margin: 8px 4px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.mood-legend {
  display: flex; justify-content: space-between;
  margin: 4px 4px 0;
  color: var(--text-secondary);
  font-size: 11px;
}

#mood-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}

/* ── Inputs ── */

textarea, input[type="text"], input[type="time"], input[type="password"], select {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea { min-height: 120px; }

.select-mini {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
  background: var(--surface3);
}

.reflection-question {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-weight: 400;
}

/* ── Buttons & Save Bar ── */

.btn {
  background: var(--surface3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.btn:hover {
  background: var(--surface2);
  border-color: var(--text-muted);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(86, 163, 199, 0.28);
}

.btn.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn.ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.save-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  bottom: 12px;
  backdrop-filter: blur(12px);
}

.save-bar .btn { flex: 1; }
.save-hint { font-size: 12px; color: var(--text-muted); }

/* ── Verlauf-Tab ── */

.chart-wrap {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.dash-tile {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}

.dash-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.dash-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
}

.entry-list {
  display: flex; flex-direction: column;
  gap: 8px;
}

.entry-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
}

.entry-row:hover {
  background: var(--surface2);
  border-color: var(--border-strong);
}

.entry-mood {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.entry-meta {
  flex: 1; min-width: 0;
}

.entry-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.entry-snippet {
  font-size: 13px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Ziele-Tab ── */

.goal-row {
  padding: 12px 14px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.goal-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}

.goal-name {
  font-size: 14px;
  font-weight: 500;
}

.goal-value {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.goal-bar {
  height: 6px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
}

.goal-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ── Settings-Tab ── */

.settings-row {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.settings-row label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.settings-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.kv {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.kv-row {
  display: flex; justify-content: space-between;
  font-size: 13px;
  padding: 8px 12px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.kv-row span:first-child { color: var(--text-muted); }

/* ── Toast ── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(40px);
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */

@media (min-width: 540px) {
  body { font-size: 14.5px; }
  .topbar-inner, main, .tabs { padding-left: 24px; padding-right: 24px; }
  .card { padding: 22px; }
}

@media (max-width: 360px) {
  .tabs { padding: 8px 8px 0; }
  .tab { padding: 7px 10px; font-size: 12.5px; }
  .card { padding: 16px; }
}

/* ── Tagebuch Frei ───────────────────────────────────── */

#tagebuch-composer-mount {
  --composer-bg: var(--surface3);
  --composer-fg: var(--text);
  --composer-accent: var(--accent);
  --composer-radius: var(--radius);
  --composer-font: 'Lexend', system-ui, sans-serif;
  margin-top: 6px;
}

.reflect-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  min-height: 1.2em;
}

.tf-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tf-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}
.tf-empty.error { color: var(--red); font-style: normal; }

.tf-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color var(--transition);
}
.tf-item:hover { border-color: var(--accent-soft, rgba(86,163,199,0.4)); }

.tf-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  gap: 12px;
}
.tf-date { letter-spacing: 0.3px; }
.tf-mood {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.tf-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}

.tf-content {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.tf-tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tf-tag {
  background: var(--surface3);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

/* ── Tagebuch-Frei Mood/Tags-UI im Composer ──────────── */

.tf-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.tf-mood-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tf-mood-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
  font-family: inherit;
}

.tf-mood-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.tf-mood-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(86, 163, 199, 0.32);
}

.tf-mood-emoji {
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.tf-mood-name { letter-spacing: 0.2px; }

.tf-tags-input {
  flex: 1;
  min-width: 200px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.tf-tags-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.tf-options-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.tf-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.tf-checkbox input { accent-color: var(--accent); cursor: pointer; }

/* ── Mood-Pill Variationen in der Liste ──────────────── */

.tf-mood {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.2px;
}
.tf-mood-good    { background: #5e9e6b; }
.tf-mood-neutral { background: #6c7a89; }
.tf-mood-heavy   { background: #b06a5b; }
.tf-mood-intense { background: #c75c8a; }

/* ── Such- und Filter-Leiste ─────────────────────────── */

.tf-search-row {
  margin-bottom: 10px;
}

.tf-search-input {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.tf-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.tf-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.tf-filter-btn {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
  font-family: inherit;
}

.tf-filter-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.tf-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tf-filter-mood.active { background: var(--accent-dark); border-color: var(--accent-dark); }

.tf-filter-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

.tf-tagchips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tf-tag-chip {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-family: inherit;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tf-tag-chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tf-tag-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  border-style: solid;
  color: #fff;
}

.tf-tag-chip .tf-tag-count {
  font-size: 10px;
  opacity: 0.7;
}

/* ── Hermine-Reply unter dem Eintrag ──────────────────── */

.tf-reply {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--accent-bg, rgba(86, 163, 199, 0.08));
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}

.tf-reply-pending { display: none; }

.tf-reply-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.tf-reply-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.tf-reply-play {
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: inherit;
  transition: var(--transition);
}

.tf-reply-play:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tf-reply-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  font-style: italic;
  white-space: pre-wrap;
}
