/* ============================================================
   Heimservice PWA — app.css
   Kein Tailwind, kein Build-Step. Vanilla CSS.
   ============================================================ */

:root {
  /* Modern Token-Set (Heimservice v0.3+) */
  --c-bg:        #f6f5f1;
  --c-surface:   #ffffff;
  --c-surface-2: #faf9f5;
  --c-ink:       #1a1f1a;
  --c-ink-soft:  #5a605a;
  --c-line:      #e6e3dc;

  /* Akzentfarbe — pro Partner via inline-style überschreibbar */
  --c-accent:        #9bb487;
  --c-accent-soft:   #c8d8b8;
  --c-accent-glow:   #e3edd5;

  --c-success: #5b9a6b;
  --c-warning: #d4a574;
  --c-danger:  #c47a8a;

  --font-display: 'Fraunces', Georgia, serif;

  --r-sm: 8px;  --r-md: 14px;  --r-lg: 22px;  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(26,31,26,.04), 0 2px 8px rgba(26,31,26,.04);
  --shadow-md: 0 4px 16px rgba(26,31,26,.06), 0 16px 40px rgba(26,31,26,.05);

  /* Legacy-Aliasse (alte Selektoren weiter funktionsfähig halten) */
  --red:     var(--c-accent);
  --red-dk:  var(--c-ink);
  --dark:    var(--c-ink);
  --gray-50: var(--c-bg);
  --gray-100:var(--c-surface-2);
  --gray-200:var(--c-line);
  --gray-400:#a8aea4;
  --gray-500:var(--c-ink-soft);
  --gray-600:#3f4640;
  --gray-700:#2a2f2a;
  --white:   var(--c-surface);
  --nav-h:   64px;
  --safe-b:  env(safe-area-inset-bottom, 0px);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--c-ink); background: var(--c-bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: transparent; font: inherit; }
input, textarea, select { font: inherit; }

/* ── Layout ─────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}

/* ── Pages ──────────────────────────────────────────────── */
.page {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: calc(100vh - var(--nav-h) - var(--safe-b));
  overflow-y: auto;
}
.page.active {
  display: flex;
}

/* ── Menu-Search ─────────────────────────────────────────── */
.menu-search {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 16px 8px;
  padding: 10px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, border-color .2s;
}
.menu-search:focus-within {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-glow);
}
.menu-search__icon { color: var(--c-ink-soft); flex-shrink: 0; }
.menu-search input {
  flex: 1; border: none; background: transparent;
  font: inherit; color: var(--c-ink);
  outline: none;
}
.menu-search input::placeholder { color: var(--c-ink-soft); }
.menu-search__clear {
  background: var(--c-surface-2);
  border: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 1rem; line-height: 1;
  color: var(--c-ink-soft);
  cursor: pointer;
}

/* ── Desktop-Layout: Sidebar-Cart (ab 980px) ────────────── */
@media (min-width: 980px) {
  #app {
    display: grid;
    grid-template-columns: 1fr 380px;
    padding-bottom: 0;
    min-height: 100vh;
  }
  #page-menu, #page-orders, #page-account, #page-track {
    grid-column: 1;
    min-height: 100vh;
    max-width: none;
  }
  #page-cart {
    display: flex !important;
    grid-column: 2;
    grid-row: 1;
    position: sticky; top: 0;
    height: 100vh;
    border-left: 1px solid var(--c-line);
    background: var(--c-surface);
    overflow-y: auto;
  }
  #page-cart .app-header {
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-line);
  }
  .bottom-nav {
    grid-column: 1 / -1;
    position: static;
    box-shadow: none;
    border-top: 1px solid var(--c-line);
    height: 56px;
  }
  .nav-item[data-page="cart"] { display: none; }
  .nav-item .cart-badge { display: none; }
  /* Hauptbereich nicht volle Breite — Eventcore-Pattern */
  #page-menu .menu-section,
  #page-menu .menu-search,
  #page-menu .cat-tabs,
  #page-orders > div,
  #page-account > div {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ── App Header (modern, mit dezentem Glow) ─────────────── */
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  color: var(--c-ink);
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--c-line);
  overflow: hidden;
}
.app-header__glow {
  position: absolute; pointer-events: none;
  inset: -40% -20% auto auto;
  width: 320px; height: 320px;
  background: radial-gradient(circle, var(--c-accent) 0%, transparent 65%);
  opacity: .25;
  filter: blur(40px);
  animation: app-header-glow 14s ease-in-out infinite alternate;
}
@keyframes app-header-glow {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(-30px, 20px) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) { .app-header__glow { animation: none; } }
.app-header__inner { position: relative; z-index: 1; }
.app-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -.01em;
}
.app-header p {
  font-size: .82rem;
  color: var(--c-ink-soft);
  margin-top: 2px;
}

/* ── Bottom Nav ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: stretch;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  color: var(--gray-400);
  font-size: .65rem;
  font-weight: 500;
  transition: color .15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover, .nav-item.active {
  color: var(--red);
}
.nav-item .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--red);
  border-radius: 0 0 2px 2px;
}

/* ── Cart Badge ─────────────────────────────────────────── */
.cart-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--red);
  color: var(--white);
  font-size: .6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  display: none;
}
.cart-badge.visible { display: flex; }

/* ── Category Tabs ──────────────────────────────────────── */
.cat-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: sticky;
  top: 57px;
  z-index: 9;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--gray-200);
  font-size: .8rem;
  font-weight: 500;
  color: var(--gray-600);
  background: var(--white);
  transition: all .15s;
  white-space: nowrap;
}
.cat-tab.active, .cat-tab:hover {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

/* ── Product Grid ───────────────────────────────────────── */
.menu-section {
  padding: 0 16px;
}
.menu-section h2 {
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 0 8px;
  color: var(--dark);
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding-bottom: 16px;
}

/* ── Product Card ───────────────────────────────────────── */
.product-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}
.product-card:active { transform: scale(.97); }
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.product-card__img {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--gray-400);
}
.product-card__body {
  padding: 10px 10px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.product-card__name {
  font-weight: 600;
  font-size: .85rem;
  line-height: 1.3;
  color: var(--dark);
}
.product-card__desc {
  font-size: .72rem;
  color: var(--gray-500);
  margin-top: 3px;
  line-height: 1.35;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.product-card__price {
  font-weight: 700;
  font-size: .9rem;
  color: var(--red);
}
.product-card__add {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Modal Overlay ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  display: none;
}
.modal-overlay.open { display: flex; }

@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
}

.modal-sheet {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp .25s ease;
}
@media (min-width: 600px) {
  .modal-sheet {
    border-radius: 16px;
    max-width: 480px;
    max-height: 85vh;
  }
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}
.qty-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dark);
}
.qty-btn:hover { background: var(--gray-200); }
.qty-val { font-weight: 700; min-width: 24px; text-align: center; }

/* ── Option rows ────────────────────────────────────────── */
.option-group h4 {
  font-weight: 600;
  font-size: .85rem;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.option-group + .option-group { margin-top: 16px; }
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}
.option-row:last-child { border-bottom: none; }
.option-row label { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; font-size: .88rem; }
.option-row input { accent-color: var(--red); width: 16px; height: 16px; }
.option-surcharge { font-size: .8rem; color: var(--gray-600); white-space: nowrap; }

/* ── Cart Page ──────────────────────────────────────────── */
.cart-page {
  padding: 16px;
}
.cart-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--gray-400);
}
.cart-empty .cart-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.cart-item {
  background: var(--white);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.cart-item__info { flex: 1; min-width: 0; }
.cart-item__name { font-weight: 600; font-size: .9rem; }
.cart-item__sub { font-size: .75rem; color: var(--gray-500); margin-top: 2px; }
.cart-item__remove { font-size: .7rem; color: var(--red); margin-top: 4px; display: inline-block; }
.cart-item__price { font-weight: 700; white-space: nowrap; font-size: .9rem; }
.cart-summary {
  background: var(--white);
  border-radius: 10px;
  padding: 14px;
  margin-top: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.cart-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  color: var(--gray-600);
  padding: 3px 0;
}
.cart-summary-row.total {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--gray-100);
}

/* ── Forms ──────────────────────────────────────────────── */
.form-section { margin-bottom: 20px; }
.form-section h3 {
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.form-group { margin-bottom: 12px; }
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 4px;
}
.form-input {
  width: 100%;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .9rem;
  color: var(--dark);
  background: var(--white);
  transition: border-color .15s;
  outline: none;
}
.form-input:focus { border-color: var(--red); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  font-size: .88rem;
  transition: border-color .15s, background .15s;
}
.radio-label:has(input:checked) {
  border-color: var(--red);
  background: #fdf2f2;
}
.radio-label input { accent-color: var(--red); }
.radio-label.disabled { opacity: .5; cursor: default; }
.error-box {
  background: #fde8e8;
  color: #9b1c1c;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 12px;
  display: none;
}
.error-box.visible { display: block; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  background: var(--red);
  color: var(--white);
  font-weight: 600;
  font-size: .95rem;
  padding: 13px 20px;
  border-radius: 10px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s, opacity .15s;
}
.btn-primary:hover { background: var(--red-dk); }
.btn-primary:disabled { background: var(--gray-400); cursor: not-allowed; }
.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 600;
  font-size: .9rem;
  padding: 11px 20px;
  border-radius: 10px;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--gray-200); }
.btn-link {
  color: var(--red);
  font-size: .85rem;
  text-decoration: underline;
  background: transparent;
}

/* ── Orders Page ─────────────────────────────────────────── */
.orders-page { padding: 16px; }
.orders-empty { text-align: center; padding: 48px 16px; color: var(--gray-400); }
.order-card {
  background: var(--white);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.order-card__num { font-family: monospace; font-weight: 700; font-size: .9rem; }
.order-card__time { font-size: .75rem; color: var(--gray-500); margin-top: 2px; }
.order-card__status { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.status-placed      { background: #e6f4ea; color: #1e7e34; }
.status-preparing   { background: #fff3cd; color: #856404; }
.status-ready       { background: #fff3cd; color: #856404; }
.status-out_for_delivery { background: #d1ecf1; color: #0c5460; }
.status-delivered   { background: #e6f4ea; color: #1e7e34; }
.status-cancelled   { background: #fde8e8; color: #9b1c1c; }

/* ── Track Page ──────────────────────────────────────────── */
.track-page { padding: 16px; }
.track-header { background: var(--white); border-radius: 10px; padding: 14px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.track-status-banner {
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 16px;
}
.track-timeline { background: var(--white); border-radius: 10px; padding: 14px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.timeline-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.timeline-step + .timeline-step::before {
  content: '';
  position: absolute;
  left: 11px;
  top: -8px;
  width: 2px;
  height: 16px;
  background: var(--gray-200);
}
.timeline-step.done + .timeline-step::before { background: var(--red); }
.timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  background: var(--white);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
}
.timeline-step.done .timeline-dot { border-color: var(--red); background: var(--red); color: var(--white); }
.timeline-step.active .timeline-dot { border-color: var(--red); animation: pulse 1.2s infinite; }
.timeline-label { font-size: .85rem; padding-top: 2px; }
.timeline-step.done .timeline-label { color: var(--dark); font-weight: 500; }
.timeline-step.active .timeline-label { color: var(--red); font-weight: 600; }
.timeline-step .timeline-label { color: var(--gray-400); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(193,39,45,.4); }
  50%       { box-shadow: 0 0 0 6px rgba(193,39,45,0); }
}
.delivery-animation {
  text-align: center;
  font-size: 2.5rem;
  animation: driveAcross 2s ease-in-out infinite alternate;
  margin: 8px 0;
}
@keyframes driveAcross {
  from { transform: translateX(-20px); }
  to   { transform: translateX(20px); }
}
.track-items { background: var(--white); border-radius: 10px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.track-item-row {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--gray-100);
}
.track-item-row:last-of-type { border-bottom: none; }
.track-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--gray-200);
}

/* ── Account Page ─────────────────────────────────────────── */
.account-page { padding: 16px; }
.account-page h2 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.push-status-card {
  background: var(--white);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 16px;
}
.push-status-card h3 { font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.push-status-text { font-size: .8rem; color: var(--gray-500); margin-bottom: 12px; }
.push-active { color: #1e7e34; font-weight: 600; font-size: .85rem; }

/* ── Success Banner ───────────────────────────────────────── */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  display: none;
}
.success-overlay.open { display: flex; }
.success-card {
  background: var(--white);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: fadeInUp .3s ease;
}
@keyframes fadeInUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.success-icon { font-size: 3.5rem; margin-bottom: 12px; }
.success-card h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.success-card p { font-size: .88rem; color: var(--gray-600); margin-bottom: 4px; }

/* ── Loading Spinner ──────────────────────────────────────── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc ─────────────────────────────────────────────────── */
.text-muted { color: var(--gray-500); font-size: .85rem; }
.text-red   { color: var(--red); }
.mt-8  { margin-top: 8px;  }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px;  }
.mb-12 { margin-bottom: 12px; }
