/* ====================================================================
   Familien-Einkaufsplaner: Modernes, mobiles Stylesheet
   Hoher Kontrast, große Touch-Ziele & flüssige Animationen
   ==================================================================== */

:root {
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #ecfdf5;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  padding-bottom: 90px;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}

/* ================= Top Bar & Header ================= */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

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

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #059669;
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: 999px;
}

.sync-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

/* ================= Markt-Leiste oben ================= */
.market-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.select-market {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background-color: #f8fafc;
  color: var(--text-main);
  cursor: pointer;
}

.select-market:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #fff;
}

.btn-secondary {
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* ================= Marktempfehlungs-Banner ================= */
.market-advice-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.market-advice-banner.perfect {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

/* ================= Horizontale Gang-Navigationsleiste ================= */
.aisle-nav-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0 2px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.aisle-nav-scroll::-webkit-scrollbar {
  display: none;
}

.aisle-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.aisle-pill:active {
  transform: scale(0.96);
}

.aisle-pill-count {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
}

.aisle-pill.has-items {
  border-color: var(--primary);
}

.aisle-pill.has-items .aisle-pill-count {
  background: var(--primary);
  color: #fff;
}

/* ================= Schnell-Eingabezeile ================= */
.add-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.add-row-main {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.input-title {
  flex: 1;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

.input-title:focus {
  border-color: var(--primary);
}

.input-qty {
  width: 70px;
  text-align: center;
  font-size: 1rem;
  padding: 12px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

.btn-add {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0 16px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-add:hover {
  background: var(--primary-hover);
}

.add-row-sub {
  display: flex;
  gap: 8px;
}

.select-sub {
  flex: 1;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-muted);
}

/* ================= Gang-Gruppierung & Artikelliste ================= */
.aisle-section {
  margin-bottom: 20px;
}

.aisle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1.5px solid var(--border);
}

.aisle-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.aisle-badge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.items-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ================= Einzelne Artikel-Kachel ================= */
.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  user-select: none;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  cursor: pointer;
}

.item-checkbox {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.item-card:hover .item-checkbox {
  border-color: var(--primary);
}

.item-info {
  display: flex;
  flex-direction: column;
}

.item-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.item-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.item-qty-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 1px 6px;
  border-radius: 6px;
}

.item-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.tag-store {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
}

.tag-cat {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

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

.btn-item-action {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 6px;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
}

.btn-item-action:hover {
  color: var(--danger);
  background: #fee2e2;
}

.drag-handle {
  cursor: grab;
  color: #cbd5e1;
  padding: 6px;
}

.drag-handle:active {
  cursor: grabbing;
}

/* ================= Erledigte Artikel (Unten) ================= */
.completed-section {
  margin-top: 32px;
  border-top: 2px dashed var(--border);
  padding-top: 18px;
}

.completed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.completed-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}

.item-card.completed {
  background: #f8fafc;
  border-color: #f1f5f9;
  opacity: 0.65;
}

.item-card.completed .item-checkbox {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.item-card.completed .item-title {
  text-decoration: line-through;
  color: #94a3b8;
}

/* ================= Modale Dialoge ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

/* ================= Drag-and-Drop Liste für Gänge ================= */
.sortable-aisle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.sortable-aisle-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
}

.sortable-aisle-item:active {
  cursor: grabbing;
  background: #ecfdf5;
  border-color: var(--primary);
}

/* ================= Auth / Onboarding Screen ================= */
.auth-hero {
  text-align: center;
  padding: 40px 16px 20px 16px;
}

.auth-hero-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.auth-hero-title {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.auth-hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 440px;
  margin: 0 auto 24px auto;
}

.auth-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  max-width: 440px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}
