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

/* ── Base ──────────────────────────────────────────────────────────────────── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  min-height: 100vh;
  color: #1d1d1f;
  font-size: 16px;
  line-height: 1.5;
  /* iMac-blauer Hintergrund — an den Bondi-Blue-Klassiker angelehnt */
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(100,180,255,0.45) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 85% 110%, rgba(60,130,220,0.3) 0%, transparent 70%),
    linear-gradient(160deg, #b8d4ef 0%, #c8dfee 35%, #daeaf7 65%, #e8f3fb 100%);
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.header {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 1px 0 rgba(0,80,200,0.08);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-title {
  font-weight: 700;
  color: #1d1d1f;
  text-decoration: none;
  font-size: 16px;
  letter-spacing: -0.2px;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.header-user { font-size: 14px; font-weight: 500; color: #3a3a3c; }
.header-link { font-size: 14px; color: #0071e3; text-decoration: none; font-weight: 500; }
.header-link:hover { color: #0077f0; text-decoration: underline; }
.btn-bare { background: none; border: none; cursor: pointer; padding: 0; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container { max-width: 520px; margin: 0 auto; padding: 20px 16px 130px; }
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: #1d1d1f;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 16px rgba(0,70,180,0.1), 0 0 0 0.5px rgba(60,100,200,0.08);
}

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-box { width: 100%; max-width: 380px; }
.login-hero { text-align: center; margin-bottom: 28px; }
.login-emoji { font-size: 52px; display: block; margin-bottom: 10px; filter: drop-shadow(0 4px 12px rgba(0,80,200,0.25)); }
.login-hero h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; color: #1d1d1f; }
.login-hero p { font-size: 14px; color: #6e6e73; margin-top: 4px; }
.login-form {
  padding: 28px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.95);
  box-shadow: 0 8px 40px rgba(0,60,180,0.14), 0 0 0 0.5px rgba(60,100,200,0.1);
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #3a3a3c;
  margin-bottom: 5px;
}
input[type=text], input[type=password], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(60,100,200,0.2);
  border-radius: 10px;
  font-size: 16px;
  color: #1d1d1f;
  background: rgba(255,255,255,0.9);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
input:focus, select:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0,113,227,0.2);
}
.label-sm { font-size: 12px; font-weight: 500; color: #3a3a3c; display: block; margin-bottom: 3px; }
.label-note { font-weight: 400; color: #aeaeb2; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 11px 20px;
  border: none;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, box-shadow .15s;
  text-align: center;
  text-decoration: none;
  letter-spacing: -0.1px;
}
.btn-primary {
  background: linear-gradient(180deg, #47a6ff 0%, #0071e3 55%, #0058c4 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.28) inset, 0 3px 10px rgba(0,90,210,0.38);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 1px 0 rgba(255,255,255,0.28) inset, 0 4px 14px rgba(0,90,210,0.45); }
.btn-sm { display: inline-block; width: auto; padding: 7px 16px; font-size: 14px; }
.msg-error { color: #ff3b30; font-size: 14px; margin-bottom: 12px; }
.msg-success { color: #34c759; font-size: 14px; margin-bottom: 12px; }

/* ── PWA Banner ────────────────────────────────────────────────────────────── */
.pwa-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0,113,227,0.18);
  border-radius: 14px;
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(0,70,180,0.1);
}
.pwa-banner.hidden { display: none; }
.pwa-banner-icon { font-size: 20px; flex-shrink: 0; }
.pwa-banner-text { flex: 1; color: #1d1d1f; font-weight: 500; }
.pwa-banner-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-pwa {
  padding: 5px 14px;
  border-radius: 980px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s;
}
.btn-pwa-primary {
  background: linear-gradient(180deg, #47a6ff, #0071e3);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,90,210,0.3);
}
.btn-pwa-primary:hover { filter: brightness(1.1); }
.btn-pwa-dismiss { background: none; color: #aeaeb2; font-size: 15px; padding: 5px 8px; }

/* ── Favoriten ─────────────────────────────────────────────────────────────── */
.favorites-section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.favorites-empty {
  font-size: 13px;
  color: rgba(0,80,180,0.35);
  margin-bottom: 14px;
  padding-left: 2px;
}
.fav-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,113,227,0.1);
  border: 1px solid rgba(0,113,227,0.22);
  color: #0058c4;
  border-radius: 980px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}
.fav-chip:hover {
  background: rgba(0,113,227,0.18);
  box-shadow: 0 2px 8px rgba(0,80,200,0.18);
}

/* ── Artikel hinzufügen ────────────────────────────────────────────────────── */
.add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.input-wrap { flex: 1; min-width: 140px; position: relative; }
.input-wrap input[type=text] {
  width: 100%;
  border-radius: 12px;
  background: rgba(255,255,255,0.88);
}
.qty-wrap {
  width: 90px;
  flex-shrink: 0;
}
.qty-wrap input {
  width: 100%;
  border-radius: 12px;
  background: rgba(255,255,255,0.88);
}
.add-form input[name="quantity"] {
  width: 76px;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(255,255,255,0.88);
}
.btn-add {
  flex-shrink: 0;
  background: linear-gradient(180deg, #47a6ff 0%, #0071e3 55%, #0058c4 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  width: 48px;
  font-size: 26px;
  font-weight: 300;
  cursor: pointer;
  line-height: 1;
  transition: filter .15s;
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 3px 10px rgba(0,90,210,0.35);
}
.btn-add:hover { filter: brightness(1.1); }

/* ── Items ─────────────────────────────────────────────────────────────────── */
.item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 10px rgba(0,70,180,0.08), 0 0 0 0.5px rgba(60,100,200,0.07);
  margin-bottom: 8px;
  transition: opacity .15s, transform .1s;
}
.item:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,70,180,0.12); }
.item.checked { opacity: .52; transform: none !important; }

.item-check {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0,113,227,0.25);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, background .15s;
  color: #fff;
}
.item-check:hover { border-color: #34c759; }
.item-check.is-checked {
  background: linear-gradient(180deg, #4cd964 0%, #34c759 100%);
  border-color: #34c759;
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 2px 6px rgba(40,160,60,0.35);
}

.item-content { flex: 1; min-width: 0; }
.item-name { font-weight: 500; color: #1d1d1f; word-break: break-word; letter-spacing: -0.1px; }
.item-name.is-checked { text-decoration: line-through; color: #aeaeb2; }
.item-qty { font-size: 14px; color: #aeaeb2; margin-left: 8px; }
.item-meta { font-size: 12px; color: #aeaeb2; margin-top: 2px; }

.item-star {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(0,0,0,0.18);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  transition: color .15s, transform .1s;
}
.item-star:hover { color: #ff9f0a; transform: scale(1.2); }
.item-star.is-fav { color: #ff9f0a; filter: drop-shadow(0 1px 3px rgba(255,160,10,0.4)); }

.item-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(0,0,0,0.18);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
}
.item-delete:hover { color: #ff3b30; }

/* ── Autocomplete ──────────────────────────────────────────────────────────── */
.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.95);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,60,180,0.16), 0 0 0 0.5px rgba(60,100,200,0.1);
  z-index: 200;
  overflow: hidden;
}
.suggestions-dropdown:empty { display: none; }
.suggestion-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  color: #1d1d1f;
  transition: background .1s;
}
.suggestion-item:hover { background: rgba(0,113,227,0.07); }
.suggestion-item + .suggestion-item { border-top: 1px solid rgba(0,80,200,0.07); }
.sugg-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.sugg-icon-muted { opacity: 0.4; font-size: 13px; }
.sugg-name { flex: 1; }
.sugg-qty { font-size: 13px; color: #aeaeb2; }

/* ── Mengen-Chips ───────────────────────────────────────────────────────────── */
.qty-wrap { position: relative; }
.qty-wrap input { width: 100%; }
.qty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.qty-chips:empty { display: none; }
.qty-chip {
  background: rgba(255,255,255,0.85);
  border: 1.5px solid rgba(0,113,227,0.25);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #0071e3;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.qty-chip:hover { background: rgba(0,113,227,0.08); border-color: #0071e3; }
.qty-chip.active {
  background: #0071e3;
  border-color: #0071e3;
  color: #fff;
}

/* ── Sektionen ─────────────────────────────────────────────────────────────── */
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: rgba(0,70,180,0.45);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin: 20px 0 8px;
  padding: 0 2px;
}
.btn-clear {
  background: none;
  border: none;
  color: rgba(255,59,48,0.55);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  transition: color .15s;
}
.btn-clear:hover { color: #ff3b30; }
.empty-state { text-align: center; color: rgba(0,70,180,0.35); padding: 48px 0; font-size: 14px; }

/* ── Admin ─────────────────────────────────────────────────────────────────── */
.user-row {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 10px rgba(0,70,180,0.08);
  margin-bottom: 8px;
  overflow: hidden;
}
.user-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.user-name { font-weight: 600; color: #1d1d1f; letter-spacing: -0.1px; }
.user-meta { font-size: 12px; color: #aeaeb2; margin-top: 2px; }
.user-actions { display: flex; align-items: center; gap: 6px; }
.btn-edit {
  font-size: 12px;
  color: #0071e3;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 500;
  transition: background .15s;
}
.btn-edit:hover { background: rgba(0,113,227,0.1); }

.edit-panel {
  background: rgba(0,70,200,0.04);
  border-top: 1px solid rgba(0,80,200,0.08);
  padding: 14px 16px;
}
.edit-panel input, .edit-panel select { font-size: 14px; }

/* Rollen-Badges */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.role-badge.admin { background: rgba(255,59,48,0.12); color: #d00; }
.role-badge.avi   { background: rgba(0,113,227,0.12); color: #0058c4; }
.role-badge.benutzer { background: rgba(0,0,0,0.07); color: #6e6e73; }

hr { border: none; border-top: 1px solid rgba(0,80,200,0.1); margin: 20px 0; }

/* ── Dock ──────────────────────────────────────────────────────────────────── */
.dock {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 12px 22px 14px;
  background: rgba(22, 22, 34, 0.75);
  backdrop-filter: blur(32px) saturate(220%);
  -webkit-backdrop-filter: blur(32px) saturate(220%);
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 10px 48px rgba(0,0,0,0.36), inset 0 1px 0 rgba(255,255,255,0.1);
  z-index: 1000;
}
.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0.72;
}
.dock-item:hover { transform: translateY(-10px); opacity: 1; }
.dock-item.active { opacity: 1; }
.dock-item.active .dock-icon-wrap {
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.28), 0 0 0 2.5px rgba(255,255,255,0.22);
}
.dock-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.22);
  transition: box-shadow 0.2s, transform 0.2s;
  line-height: 1;
}
.dock-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  letter-spacing: -0.1px;
}
.dock-item.active .dock-label { color: #fff; }

/* Dock — mobil: volle Breite als Tab-Bar */
@media (max-width: 640px) {
  .dock {
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    border-radius: 20px 20px 0 0;
    justify-content: space-around;
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .dock-item:hover { transform: none; }
  .dock-icon-wrap { width: 48px; height: 48px; font-size: 26px; border-radius: 14px; }
  .container { padding-bottom: 100px; }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 420px) {
  .form-grid { grid-template-columns: 1fr; }
  .add-form input[name="quantity"] { width: 60px; }
}
