/* ============================================================
   mobile.css — Handy-Optimierung (Okt. 2026)
   Wird NACH style.css und den Inline-<style>-Blöcken geladen.
   Am Desktop (> 768 px, Maus) ändert sich hier fast nichts.
   ============================================================ */

/* ── 1. Nie seitlich wackeln ─────────────────────────────── */
html, body { max-width: 100%; overflow-x: clip; }
img, svg, video, canvas, iframe { max-width: 100%; }

/* ── 2. Kein Auto-Zoom auf iOS: Eingabefelder ≥ 16 px ───── */
@media (max-width: 1024px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select, textarea { font-size: 16px !important; }
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, input, select, label { touch-action: manipulation; -webkit-tap-highlight-color: rgba(200,149,42,.15); }

/* ── 3. Produktkarten ohne Dreh-Effekt auf Touch-Geräten ──── */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .product-card {
    perspective: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0,0,0,.06);
    border: 1px solid #F0EDE6;
    transform: none !important;
  }
  .product-card .karte-inner {
    transform: none !important;
    height: auto !important;
    transition: none !important;
  }
  .product-card .karte-vorne {
    position: relative !important;
    height: auto !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
    display: flex; flex-direction: column;
  }
  .product-card .karte-hinten { display: none !important; }
  .product-card .product-img { height: 200px !important; }
  .product-card .product-body { padding: 16px 18px 6px !important; }
  .product-card .product-body h3 { margin-bottom: 4px; }
  .product-card .p-desc {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; margin-bottom: 8px;
  }
  .product-card .p-meta { display: none !important; }

  /* Kaufzeile – wird von js/mobile.js in jede Karte eingefügt */
  .km-buy {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 18px 18px; margin-top: auto;
  }
  .km-preis { font-family: 'Playfair Display', serif; font-size: 24px; color: #1a1a1a; white-space: nowrap; line-height: 1.1; }
  .km-preis small { display: block; font-family: 'Inter', sans-serif; font-size: 11px; color: #888178; letter-spacing: .02em; }
  .km-btn {
    flex: 0 0 auto; min-height: 48px; padding: 0 20px; border: none; border-radius: 100px;
    background: #C8952A; color: #fff; font: 600 15px/1 'Inter', sans-serif; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; position: relative; z-index: 3;
  }
  .km-btn:active { background: #B8851A; transform: scale(.97); }
  .km-btn[disabled] { background: #ddd; color: #888; }
}
@media (min-width: 769px) and (hover: hover) { .km-buy { display: none !important; } }

/* ── 4. Header am Handy: Logo | Warenkorb | Menü ─────────── */
@media (max-width: 768px) {
  .nav-inner { padding: 0 12px 0 16px !important; gap: 8px !important; }
  .nav-logo { font-size: 1.2rem !important; white-space: nowrap; }
  .nav-right { gap: 6px !important; margin-left: auto; }
  .nav-right .lang-switch,
  .nav-right .nav-konto-wrap { display: none !important; }
  .nav-cart-link {
    min-width: 48px; height: 44px; padding: 0 12px !important;
    display: inline-flex !important; align-items: center; justify-content: center; gap: 6px;
  }
  .nav-toggle {
    width: 44px; height: 44px; padding: 0 !important;
    align-items: center; justify-content: center; flex-shrink: 0;
  }
  .nav-links {
    left: 12px !important; right: 12px !important; min-width: 0 !important;
    max-height: calc(100vh - 90px); overflow-y: auto; padding: 12px !important;
  }
  .nav-links a { padding: 14px 16px !important; font-size: 1.05rem !important; }
  .km-nav-extra { display: list-item; }
  .km-lang { display: flex; gap: 8px; padding: 12px 16px 4px; }
  .km-lang button {
    flex: 1; min-height: 44px; border-radius: 100px; border: 1.5px solid #E8E0D0;
    background: #fff; font: 600 14px 'Inter', sans-serif; color: #888178;
  }
  .km-lang button.aktiv { border-color: #C8952A; color: #C8952A; background: #FDF8EE; }
}
@media (min-width: 769px) { .km-nav-extra { display: none !important; } }

/* ── 5. Bug-Knopf: am Handy nur kleines Icon unten links ─── */
@media (max-width: 768px) {
  #bug-report-btn {
    right: auto !important; left: 12px !important; bottom: 12px !important;
    width: 40px; height: 40px; padding: 0 !important; justify-content: center;
    font-size: 0 !important; gap: 0 !important; opacity: .75;
    box-shadow: 0 2px 8px rgba(0,0,0,.15) !important;
  }
  #bug-report-btn > * { display: none !important; }
  #bug-report-btn::before { content: "🐛"; font-size: 18px; line-height: 1; }
  body.km-sticky-aktiv #bug-report-btn { bottom: 84px !important; }
  .scroll-top { display: none !important; }
  .toast { left: 12px !important; right: 12px !important; bottom: 12px !important; max-width: none !important; }
}

/* ── 6. „Im Warenkorb“-Leiste nach dem Hinzufügen ────────── */
.km-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9500;
  background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 40px rgba(0,0,0,.18);
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(110%); transition: transform .3s cubic-bezier(.2,.8,.2,1);
  font-family: 'Inter', sans-serif;
}
.km-sheet.offen { transform: translateY(0); }
.km-sheet-kopf { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: #1a1a1a; margin-bottom: 4px; }
.km-sheet-kopf .km-haken { width: 28px; height: 28px; border-radius: 50%; background: #22a35a; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.km-sheet-sub { font-size: 14px; color: #888178; margin: 0 0 14px 38px; }
.km-sheet-btns { display: flex; gap: 10px; }
.km-sheet-btns a, .km-sheet-btns button {
  flex: 1; min-height: 50px; border-radius: 100px; font: 600 15px 'Inter', sans-serif;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer;
}
.km-sheet-weiter { background: #fff; border: 1.5px solid #E8E0D0; color: #1a1a1a; }
.km-sheet-kasse  { background: #C8952A; border: none; color: #fff !important; }
@media (min-width: 769px) {
  .km-sheet { left: auto; right: 24px; bottom: 24px; width: 380px; border-radius: 20px; }
}

/* ── 7. Feste Kaufleiste auf der Produktseite ────────────── */
.km-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000;
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.97); backdrop-filter: blur(8px);
  border-top: 1px solid #F0EDE6; box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  transform: translateY(110%); transition: transform .25s ease;
}
.km-sticky.sichtbar { transform: translateY(0); }
.km-sticky-info { flex: 1; min-width: 0; }
.km-sticky-name { font: 600 14px 'Inter', sans-serif; color: #1a1a1a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.km-sticky-preis { font-family: 'Playfair Display', serif; font-size: 20px; color: #C8952A; }
.km-sticky .km-btn { min-height: 50px; }
@media (min-width: 769px) { .km-sticky { display: none !important; } }

/* ── 8. Grid-Ausbrecher reparieren (Checkout, Warenkorb) ─── */
@media (max-width: 1024px) {
  .co-main, .cart-layout, .produkt-layout, .produkt-detail, .checkout-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .co-main > *, .cart-layout > *, .produkt-layout > *, .produkt-detail > * { min-width: 0; }
}

/* ── 9. Warenkorb-Zeilen kompakt ─────────────────────────── */
@media (max-width: 768px) {
  .cart-row {
    grid-template-columns: minmax(0,1fr) auto !important;
    grid-template-areas: "name entf" "menge summe";
    gap: 12px 12px !important; align-items: center; padding: 16px !important;
  }
  .cart-row > :nth-child(1) { grid-area: name; min-width: 0; }
  .cart-row > :nth-child(2) { display: none; }
  .cart-row > :nth-child(3) { grid-area: menge; }
  .cart-row > :nth-child(4) { grid-area: summe; font-size: 1.05rem; font-weight: 600; justify-self: end; }
  .cart-row > :nth-child(5) { grid-area: entf; justify-self: end; }
  .c-remove { width: 40px; height: 40px; font-size: 22px; border-radius: 50%; }
  .cqty-btn { width: 40px !important; height: 40px !important; font-size: 18px; }
  .cqty-num { width: 44px !important; text-align: center; }
  .cart-actions { flex-wrap: wrap; gap: 12px; padding: 16px !important; }
  .cart-summary { padding: 22px 18px !important; }
}

/* ── 10. Kleinkram am Handy ──────────────────────────────── */
@media (max-width: 768px) {
  /* Shop-Filter: wischbare Leiste statt Umbruch */
  .filter-tabs {
    flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; justify-content: flex-start !important; max-width: 100%;
    border-radius: 100px !important;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab { flex: 0 0 auto; min-height: 40px; white-space: nowrap; }

  /* Großbestellung: Sortenliste passt in die Breite */
  .gb-sorte { gap: 8px !important; }
  .gb-sorte-check { min-width: 0; }
  .gb-sorte-menge { width: 72px !important; }
  .gb-sorte-einheit { width: auto !important; }

  /* Checkout-Kopf */
  .co-header { padding: 0 12px !important; gap: 8px; }
  .co-back { white-space: nowrap; min-height: 44px; }
  .co-back span { font-size: 14px; }

  /* Produktseite: Mengen-Knöpfe groß genug */
  .pd-kauf .qty-ctrl .cqty-btn { width: 44px !important; height: 44px !important; }
  .pd-kauf #addBtn { width: 100%; min-height: 52px; }
  .pd-kauf { align-items: stretch !important; gap: 14px !important; }
  .size-btns button, .size-btn { min-height: 44px; }

  /* Footer-Links leichter zu treffen */
  footer a { display: inline-block; padding: 6px 0; }
}

/* ── 11. Startseite: Sortiment als Wisch-Leiste ──────────── */
@media (max-width: 560px) {
  #prodGrid.prod-grid {
    display: flex !important; gap: 14px !important;
    overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    margin: 0 -18px; padding: 4px 18px 18px; scrollbar-width: none;
  }
  #prodGrid.prod-grid::-webkit-scrollbar { display: none; }
  #prodGrid .product-card, #prodGrid .prod-card {
    flex: 0 0 82%; scroll-snap-align: center; height: auto !important;
  }
  .km-wisch-hinweis { text-align: center; font: 13px 'Inter', sans-serif; color: #888178; margin-top: 2px; }
  .km-punkte { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
  .km-punkte i { width: 7px; height: 7px; border-radius: 50%; background: #E8E0D0; transition: all .2s; }
  .km-punkte i.aktiv { background: #C8952A; width: 18px; border-radius: 4px; }
}
@media (min-width: 561px) { .km-wisch-hinweis, .km-punkte { display: none; } }

/* ── 12. Nachbesserungen aus Testrunde 2 ─────────────────── */
@media (max-width: 480px) {
  .btn { white-space: normal !important; max-width: 100%; text-align: center; line-height: 1.3; }
  .btn-lg { padding-left: 22px !important; padding-right: 22px !important; }
}
@media (max-width: 768px) {
  .co-header .lang-switch button { min-height: 40px; min-width: 36px; padding: 8px 6px !important; font-size: 13px !important; }
  .co-header .lang-switch { margin-right: 0 !important; }
  .clear-btn { padding: 12px 0 !important; }
}
@media (max-width: 768px) { .btn { min-height: 44px; } }
.coupon-row { display: flex; gap: 8px; }
.coupon-row .coupon-input, .coupon-row input { flex: 1 1 auto; min-width: 0; width: auto !important; }
.coupon-row .coupon-btn, .coupon-row button, .coupon-row .btn { flex: 0 0 auto; }
@media (max-width: 768px) {
  .coupon-wrap { padding: 16px !important; }
  /* Shop-Filter: zeigen, dass man wischen kann */
  .filter-tabs { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 28px !important; }
  #bug-report-btn { width: 34px; height: 34px; left: 8px !important; bottom: 8px !important; }
  #bug-report-btn::before { font-size: 16px; }
  body:has(.km-sheet.offen) #bug-report-btn { display: none !important; }
}
@media (max-width: 768px) {
  .gb-sorte-check span { min-width: 0; hyphens: auto; -webkit-hyphens: auto; }
  .gb-sorte-einheit { display: none !important; }
  .gb-sorte-menge { width: 64px !important; }
}
