/* ==========================================================================
   Familie Zumpee – gemeinsames Stylesheet
   ========================================================================== */

:root {
  --color-primary: #2f9e6b;
  --color-primary-dark: #217a51;
  --color-primary-light: #e6f5ee;
  --color-accent: #f2a541;
  --color-bg: #fbfaf7;
  --color-surface: #ffffff;
  --color-text: #26312c;
  --color-text-muted: #647169;
  --color-border: #e5e2da;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 3px rgba(38, 49, 44, 0.08);
  --shadow-md: 0 8px 24px rgba(38, 49, 44, 0.10);
  --max-width: 960px;
  --header-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #3fbd82;
    --color-primary-dark: #2f9e6b;
    --color-primary-light: #17301f;
    --color-bg: #14181a;
    --color-surface: #1d2224;
    --color-text: #eef1ef;
    --color-text-muted: #9aa6a0;
    --color-border: #2c3335;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Header / Navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--color-text);
}

.logo .logo-icon {
  font-size: 1.4rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--color-text);
}

.nav-toggle svg {
  width: 26px;
  height: 26px;
}

.main-nav ul {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav a {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.main-nav a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.main-nav a.active {
  background: var(--color-primary);
  color: #fff;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: inline-flex;
  }

  .main-nav {
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .main-nav.open {
    max-height: 300px;
  }

  .main-nav ul {
    flex-direction: column;
    padding: 0.75rem 1.25rem 1.25rem;
    gap: 0.35rem;
  }

  .main-nav a {
    display: block;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding: 2.75rem 0 1.75rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 0.5rem;
}

.hero p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 40em;
  margin: 0 auto;
}

/* ---------- Card grid (Bereiche) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
  padding: 1.5rem 0 3rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card.is-active:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card .card-icon {
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
}

.card h2 {
  margin: 0.25rem 0 0;
  font-size: 1.2rem;
}

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

.card .badge {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--color-accent);
  color: #3a2705;
}

.card.is-soon {
  opacity: 0.6;
  cursor: default;
}

.card.is-soon .badge {
  background: var(--color-border);
  color: var(--color-text-muted);
}

/* ---------- Page header (subpages) ---------- */

.page-header {
  padding: 2rem 0 1rem;
}

.page-header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.page-header p {
  color: var(--color-text-muted);
  margin: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--color-primary-dark);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ---------- Leergut counter ---------- */

.counter-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0 6.5rem;
}

.counter-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.counter-item .item-icon {
  font-size: 1.6rem;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  border-radius: 50%;
  flex-shrink: 0;
}

.counter-item .item-info {
  min-width: 0;
}

.counter-item .item-name {
  font-weight: 600;
  font-size: 1rem;
}

.counter-item .item-price {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stepper button {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.stepper button:active {
  transform: scale(0.92);
}

.stepper button.increase {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.stepper input.qty {
  width: 2.6rem;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.3rem 0;
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
}

.counter-item .item-total {
  grid-column: 1 / -1;
  text-align: right;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.counter-item .item-total strong {
  color: var(--color-text);
}

.counter-item.custom-item {
  grid-template-columns: 1fr;
}

.custom-add {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.custom-add .row {
  display: flex;
  gap: 0.5rem;
}

.custom-add input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.95rem;
  background: var(--color-bg);
  color: var(--color-text);
}

.custom-add input.price-field {
  max-width: 6rem;
  flex: none;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0;
  align-self: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.actions-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

/* Sticky total bar */
.total-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08);
  padding: 0.9rem 1.25rem;
  padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
}

.total-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
}

.total-bar .label {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.total-bar .amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0 5.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.site-footer.no-total-bar {
  padding-bottom: 1.5rem;
}

/* ---------- Einkaufsliste ---------- */

.shopping-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0 0.5rem;
  min-height: 3rem;
}

.shopping-empty {
  color: var(--color-text-muted);
  text-align: center;
  padding: 1.5rem 0;
}

.shopping-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.shopping-check {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  cursor: pointer;
  min-width: 0;
}

.shopping-check input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0 0.6rem 0 0;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  align-self: center;
}

.shopping-name {
  font-weight: 600;
  word-break: break-word;
}

.shopping-note {
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.shopping-item.is-checked .shopping-name,
.shopping-item.is-checked .shopping-note {
  text-decoration: line-through;
  color: var(--color-text-muted);
}
