/* ============================================================
   Einkaufsliste – Stylesheet (Minimalistisch, Mobile-First)
   ============================================================ */

:root {
  --bg:        #f5f5f2;
  --surface:   #ffffff;
  --border:    #e8e8e4;
  --text:      #1a1a18;
  --text-2:    #6b6b64;
  --text-3:    #9b9b94;
  --accent:    #2d6a4f;
  --accent-2:  #1b4332;
  --ok:        #2d6a4f;
  --err:       #c62828;
  --info:      #1565c0;
  --warn:      #e65100;
  --radius:    10px;
  --shadow:    0 1px 4px rgba(0,0,0,.08);
  --list-accent: var(--accent);
}

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

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

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
}

/* ---- Header ---- */
.header {
  background: #1c2b1c;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.logo { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.logo-icon { font-size: 1.6rem; flex-shrink: 0; }
.logo h1 { font-family: 'Playfair Display', serif; font-size: 1.2rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tagline { font-size: .72rem; color: rgba(255,255,255,.6); }
.header-nav { display: flex; gap: 4px; }
.nav-link { color: rgba(255,255,255,.75); text-decoration: none; font-size: 1.3rem; padding: 6px; border-radius: 6px; transition: background .15s; }
.nav-link:hover { background: rgba(255,255,255,.12); }
.back-btn { color: rgba(255,255,255,.85); font-size: 1.6rem; text-decoration: none; padding: 0 8px 0 0; line-height: 1; flex-shrink: 0; }
.progress-bar { height: 3px; background: rgba(255,255,255,.15); }
.progress-fill { height: 100%; background: #74c69d; transition: width .5s ease; }

/* ---- Main ---- */
.main { max-width: 640px; margin: 0 auto; padding: 16px 12px 40px; display: flex; flex-direction: column; gap: 12px; }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-title { font-size: .9rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 14px; }

/* ---- Details/Summary (Add Form) ---- */
.card--add { padding: 0; overflow: hidden; }
.card-summary {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px;
  font-weight: 600; font-size: .9rem; cursor: pointer;
  list-style: none; user-select: none;
  border-bottom: 1px solid transparent;
  transition: background .15s;
}
.card-summary:hover { background: var(--bg); }
details[open] .card-summary { border-bottom-color: var(--border); }
.card-summary::-webkit-details-marker { display: none; }
.add-form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* ---- Forms ---- */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.fg-grow { flex: 1; min-width: 140px; }
label { font-size: .78rem; font-weight: 500; color: var(--text-2); }
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: inherit;
  font-size: .9rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
select { cursor: pointer; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border: 1.5px solid transparent;
  border-radius: 7px;
  font-family: inherit; font-size: .9rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-2); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--bg); }
.btn--full { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: .82rem; }
.btn--xs { padding: 4px 9px; font-size: .78rem; border-radius: 5px; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 6px; font-size: 1rem; border-radius: 6px; transition: background .15s; color: var(--text-2); }
.btn-icon:hover { background: var(--bg); }
.btn-icon--del:hover { background: #fde8e8; color: var(--err); }

/* ---- File Drop ---- */
.file-drop { position: relative; border: 2px dashed var(--border); border-radius: 8px; overflow: hidden; }
.file-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-drop-ui { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; color: var(--text-3); font-size: .82rem; }
.file-drop-ui span:first-child { font-size: 1.6rem; }
.bild-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 6px; margin-top: 8px; }

/* ---- Filter Bar ---- */
.filter-bar { display: flex; flex-direction: column; gap: 8px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.si { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.search-wrap input { padding-left: 36px; padding-right: 32px; }
.clear-search { position: absolute; right: 10px; color: var(--text-3); text-decoration: none; font-size: 1rem; }
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-row select { flex: 1; min-width: 130px; }
.tabs { display: flex; gap: 4px; }
.tab { padding: 7px 13px; border: 1.5px solid var(--border); border-radius: 6px; background: var(--surface); font-size: .82rem; font-family: inherit; font-weight: 500; cursor: pointer; color: var(--text-2); transition: all .15s; }
.tab--on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Action Strip ---- */
.action-strip { display: flex; justify-content: flex-end; }

/* ---- Artikel-Liste ---- */
.artikel-liste { display: flex; flex-direction: column; gap: 8px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: .95rem; }

.artikel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  transition: opacity .2s;
  position: relative;
}
.artikel-card--done { opacity: .55; }
.artikel-card--done .artikel-name { text-decoration: line-through; color: var(--text-3); }

.check-btn { background: none; border: none; cursor: pointer; font-size: 1.3rem; padding: 2px; flex-shrink: 0; }
.artikel-bild { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; cursor: zoom-in; flex-shrink: 0; }
.artikel-info { flex: 1; min-width: 0; }
.artikel-name { font-weight: 500; font-size: .92rem; line-height: 1.3; }
.artikel-menge { font-size: .78rem; font-weight: 400; color: var(--text-2); margin-left: 6px; }
.artikel-kat { font-size: .74rem; color: var(--list-accent); margin-top: 2px; font-weight: 500; }
.artikel-notiz { font-size: .74rem; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

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

/* ---- Move Menu ---- */
.move-menu {
  display: none; position: absolute; right: 0; top: 100%; z-index: 200;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
  width: 230px; padding: 8px;
}
.move-menu.open { display: block; }
.move-menu-label { font-size: .8rem; font-weight: 600; padding: 6px 4px 2px; color: var(--text-2); }
.move-actions { display: flex; gap: 6px; padding: 4px; }
.inline-form { display: inline; }

/* ---- Lists Grid (Index) ---- */
.section-title { font-family: 'Playfair Display', serif; font-size: 1.3rem; padding: 4px 4px 0; }
.lists-grid { display: flex; flex-direction: column; gap: 10px; }
.list-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
  transition: box-shadow .15s, transform .1s;
}
.list-card:active { transform: scale(.99); }
.list-card-icon { font-size: 1.8rem; flex-shrink: 0; }
.list-card-body { flex: 1; min-width: 0; }
.list-card-name { font-weight: 600; font-size: 1rem; }
.list-card-meta { font-size: .8rem; color: var(--text-2); margin-top: 2px; }
.list-progress { height: 4px; background: var(--bg); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.list-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s; }
.list-card-arrow { font-size: 1.4rem; color: var(--text-3); flex-shrink: 0; }

/* ---- Benutzer ---- */
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.user-row:last-child { border-bottom: none; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: .92rem; }
.user-sub { font-size: .75rem; color: var(--text-3); }
.user-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pw-input { width: 130px !important; padding: 5px 8px !important; font-size: .82rem !important; }

/* ---- Alerts & Toast ---- */
.alert { padding: 10px 14px; border-radius: 7px; font-size: .85rem; margin-bottom: 8px; }
.alert--error { background: #fdecea; color: var(--err); border: 1px solid #f5c6cb; }
.alert--warn  { background: #fff3e0; color: var(--warn); border: 1px solid #ffe0b2; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  padding: 10px 20px; border-radius: 20px; font-size: .88rem; font-weight: 500;
  z-index: 999; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.15);
  transition: opacity .5s;
}
.toast--ok   { background: var(--ok); color: #fff; }
.toast--err  { background: var(--err); color: #fff; }
.toast--info { background: var(--info); color: #fff; }

/* ---- Login ---- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100dvh; background: #1c2b1c; }
.login-wrap { width: 100%; max-width: 380px; padding: 16px; }
.login-card { background: var(--surface); border-radius: 14px; padding: 32px 28px; box-shadow: 0 8px 40px rgba(0,0,0,.25); text-align: center; }
.login-logo { font-size: 3rem; margin-bottom: 8px; }
.login-title { font-family: 'Playfair Display', serif; font-size: 1.6rem; margin-bottom: 4px; }
.login-sub { color: var(--text-2); font-size: .88rem; margin-bottom: 24px; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: 14px; }

/* ---- Lightbox ---- */
.lightbox {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85);
  z-index: 500; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88dvh; border-radius: 8px; }

/* ---- Responsive ---- */
@media (min-width: 480px) {
  .lists-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .list-card { flex-direction: column; text-align: center; gap: 8px; }
  .list-card-arrow { display: none; }
  .list-card-body { width: 100%; }
}

@media (max-width: 360px) {
  .header-inner { padding: 10px 12px; }
  .main { padding: 12px 8px 32px; }
  .form-row { flex-direction: column; }
}
