/* ============================================================
   Sammelraum – Design-System basierend auf Kassen-Kompass v3
   ============================================================ */

:root {
  --bg: #f4f5f7;
  --paper: #ffffff;
  --ink: #1c2330;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #1f5ed8;
  --danger: #ab2d2d;
  --success: #1e7a44;
  --radius: 14px;
  --shadow: 0 0 11px rgba(18, 27, 45, 0.1);
}

* { box-sizing: border-box; }

html {
  background: #f4f5f7;
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 180% 55% at 65% -15%, rgba(210, 225, 255, 0.48) 0%, transparent 55%),
    radial-gradient(ellipse 130% 65% at -10% 110%, rgba(200, 232, 212, 0.38) 0%, transparent 55%),
    linear-gradient(165deg, #f7f9ff 0%, #f4f5f7 50%, #f4f7f5 100%);
  line-height: 1.45;
}

/* Layout */

.container { width: min(1400px, 96vw); margin-inline: auto; }

.layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0 24px;
  align-items: start;
}

/* Typography */

h1, h2, h3, p { margin: 0; }

h1 { line-height: 1.15; font-size: clamp(1.25rem, 2vw, 1.6rem); }
h2 { line-height: 1.15; font-size: 1.05rem; }
h3 { font-size: 0.88rem; }

.kicker {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.muted-text { font-size: 0.8rem; color: var(--muted); margin: 0; }

/* Topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.topbar__sub { margin: 2px 0 0; font-size: 0.74rem; color: var(--muted); }

.topbar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Forms */

label { font-size: 0.88rem; font-weight: 600; }
input, select, button { font: inherit; }

input, select {
  width: 100%;
  border: 1px solid #c9d1de;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 7px 9px;
  font-size: 0.88rem;
}

input:focus, select:focus {
  outline: 2px solid #d6e1f7;
  border-color: #97abd4;
}

/* Buttons */

.btn {
  border: 1px solid #c7cfdd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 6px 9px;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
}

.btn:hover { border-color: #a8b4c7; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: #fff; border-color: #184aad; }
.btn--danger { background: var(--danger); color: #fff; border-color: #8e2424; }
.btn--mini { padding: 5px 8px; font-size: 0.78rem; }
.btn--sm { padding: 4px 8px; font-size: 0.82rem; }
.upload-label { display: inline-flex; align-items: center; }

/* Theme switch */

.theme-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 2px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
}

.theme-switch__track {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--line);
  border-radius: 999px;
  transition: background 0.25s;
  flex-shrink: 0;
}

.theme-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--paper);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s;
}

.theme-switch__sun, .theme-switch__moon { font-size: 0.95rem; user-select: none; }

/* Card */

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

/* Sidebar + Main */

.sidebar-panel { display: flex; flex-direction: column; gap: 8px; }
.main-panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 { flex: 1; font-size: 0.88rem; font-weight: 700; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #f0f2f5;
  color: var(--muted);
}

/* Lists */

.lists-container { display: flex; flex-direction: column; }

.list-card-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 12px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}

.list-card-btn:last-child { border-bottom: none; }
.list-card-btn:hover { background: #f5f7fb; }
.list-card-btn.active { background: #eef2fc; }

.list-card-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e8edf6;
  color: var(--accent);
}

/* Create form */

.create-form {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f9fafb;
}

.create-form label { font-size: 0.8rem; }
.form-field { display: flex; flex-direction: column; gap: 4px; }

/* Empty state */

.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); font-size: 0.88rem; }
.empty-state h2 { margin-bottom: 8px; color: var(--ink); }
.empty-state p { margin-bottom: 18px; }
.empty-state-icon { font-size: 2.2rem; margin-bottom: 12px; }

/* List header */

.list-header { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }

.list-header-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.list-header-row .grow { flex: 1; min-width: 130px; }
.list-header-row .form-field label { font-size: 0.8rem; }
.list-header-desc { font-size: 0.78rem; color: var(--muted); }

.list-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.field-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.field-inline select { width: auto; padding: 4px 8px; font-size: 0.78rem; }
.drag-hint { font-size: 0.74rem; color: var(--muted); }

/* Stats */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.stat-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
}

.stat-value { font-size: 1.45rem; font-weight: 700; color: var(--ink); line-height: 1.1; margin-top: 2px; }

/* Composer */

.composer { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

.composer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.composer-head h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.form-field-group { display: flex; flex-direction: column; gap: 4px; }
.form-field-group label { font-size: 0.8rem; }
.form-field-full { grid-column: 1 / -1; }

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: normal;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; margin: 0; flex-shrink: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Items */

.items-section { display: flex; flex-direction: column; }

.items-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.items-section-head h3 {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.items-list { list-style: none; margin: 0; padding: 0; }

.item-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.item-card:last-child { border-bottom: none; }
.item-card.done { background: #f6faf8; }
.item-card.dragging { opacity: 0.45; }

.drag-handle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: grab;
  user-select: none;
  margin-top: 2px;
}

.checkbox-cell { display: inline-flex; align-items: flex-start; padding-top: 2px; }
.checkbox-cell input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--success); }

.item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.item-topline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.item-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.item-card.done .item-name { text-decoration: line-through; opacity: 0.65; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.76rem; color: var(--muted); }
.item-desc { font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }

.item-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.item-actions .btn {
  width: 26px;
  min-width: 26px;
  height: 26px;
  padding: 0;
  font-size: 0.78rem;
  line-height: 1;
  border-radius: 999px;
  color: #fff;
  border-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-edit { background: #334155; }
.btn-edit:hover { background: #1f2937; border-color: transparent; }
.btn-delete { background: #d04545; }
.btn-delete:hover { background: #b83b3b; border-color: transparent; }

.status-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge--owned,
.status-badge--packed,
.status-badge--bought { background: #d1fae5; color: #065f46; }
.status-badge--wanted { background: #fee2e2; color: #991b1b; }
.empty-list-msg { padding: 20px; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* Modal */

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(14, 21, 36, 0.45); }

.modal-body {
  position: relative;
  width: min(480px, 92vw);
  border-radius: 14px;
  padding: 16px;
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(19, 28, 46, 0.25);
}

.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.modal-desc { font-size: 0.85rem; color: var(--muted); margin: 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Toast */

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  z-index: 1100;
  animation: toast-in 200ms ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Footer */

.site-footer { padding: 12px 0; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.site-footer .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-footer__links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.site-footer__links a { color: var(--muted); text-decoration: none; }
.site-footer__links a:hover { color: var(--accent); }
.site-footer__privacy-btn { background: none; border: none; padding: 0; color: var(--muted); cursor: pointer; font-size: inherit; }
.site-footer__privacy-btn:hover { color: var(--accent); }

/* Privacy consent */

.privacy-consent {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  margin: 0 auto;
  max-width: 760px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  z-index: 1200;
  display: none;
}

.privacy-consent.active { display: block; }
.privacy-consent__text { font-size: 0.81rem; color: var(--muted); margin: 0 0 10px; }
.privacy-consent__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.privacy-consent__meta { margin: 10px 0 0; font-size: 0.75rem; color: var(--muted); }

.privacy-consent__link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
}

.privacy-consent__link:hover { text-decoration: underline; }

/* Legal pages */

.legal-body { overflow: auto; }
.legal-page { padding-top: 24px; padding-bottom: 34px; }
.legal-content { max-width: 820px; line-height: 1.65; }
.legal-content h2 { margin: 20px 0 6px; font-size: 0.97rem; }
.legal-content p { margin: 0 0 10px; font-size: 0.9rem; }
.legal-hint { color: var(--muted); font-size: 0.8rem; margin-bottom: 14px; }

/* Dark mode */

[data-theme="dark"] {
  --bg: #0f1117;
  --paper: #1a1d27;
  --ink: #e8eaf0;
  --muted: #8b93a8;
  --line: #2e3347;
  --accent: #3b82f6;
  --danger: #d04545;
  --success: #43b86f;
  --shadow: 0 0 11px rgba(0, 0, 0, 0.8);
}

html[data-theme="dark"] { background: #0f1117; }

[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 180% 55% at 65% -15%, rgba(38, 68, 134, 0.28) 0%, transparent 55%),
    radial-gradient(ellipse 130% 65% at -10% 110%, rgba(28, 68, 50, 0.22) 0%, transparent 55%),
    linear-gradient(165deg, #0d1121 0%, #0f1117 50%, #0d1219 100%);
}

[data-theme="dark"] input,
[data-theme="dark"] select { background: #222534; border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .btn { background: #222534; border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .btn--primary { background: var(--accent); color: #fff; border-color: #2b67c7; }
[data-theme="dark"] .btn--danger { background: var(--danger); color: #fff; border-color: #a83636; }
[data-theme="dark"] .card { border: 1px solid var(--line); }
[data-theme="dark"] .stat-card { border: 1px solid var(--line); }
[data-theme="dark"] .list-card-btn:hover { background: #1e2132; }
[data-theme="dark"] .list-card-btn.active { background: #1b2440; }
[data-theme="dark"] .list-card-name { color: var(--ink); }
[data-theme="dark"] .item-card.done { background: #161f1a; }
[data-theme="dark"] .create-form { background: #14171f; }
[data-theme="dark"] .theme-switch__track { background: var(--accent); }
[data-theme="dark"] .theme-switch__thumb { transform: translateX(18px); }
[data-theme="dark"] .toast { background: #e8eaf0; color: #1c2330; }
[data-theme="dark"] .privacy-consent { border-color: var(--line); background: #1a1d27; }
[data-theme="dark"] .status-badge--owned,
[data-theme="dark"] .status-badge--packed,
[data-theme="dark"] .status-badge--bought { background: rgba(67, 184, 111, 0.18); color: #5ecb87; }
[data-theme="dark"] .status-badge--wanted { background: rgba(208, 69, 69, 0.2); color: #f08787; }
[data-theme="dark"] .type-badge { background: #1b2440; color: var(--accent); }
[data-theme="dark"] .item-name { color: var(--ink); }
[data-theme="dark"] .empty-state h2 { color: var(--ink); }
[data-theme="dark"] .stat-value { color: var(--ink); }

/* Responsive */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar__inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar__actions { width: 100%; }
  .site-footer .container { flex-direction: column; align-items: flex-start; }
  .privacy-consent { left: 10px; right: 10px; bottom: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .list-header-row { flex-direction: column; align-items: stretch; }
  .list-header-row .grow { min-width: 0; }
  .item-card { grid-template-columns: auto 1fr; }
  .item-card .item-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
