/* ============================================================
 * FDDB Mobile Redesign – Produkt-Detailseite
 * Scope: body.fddb-mobile .fddb-m-product
 * Referenz: design_handoff_fddb_redesign/product-mobile.jsx (390 px)
 * ============================================================ */

/* Globaler Fix: style.css setzt body auf height:100% + flex column. Bei langer
   Mobile-Produktseite wird der Content sonst auf Viewport-Hoehe gekappt
   und die Seite scrollt nicht. Body darf wachsen. */
body.fddb-mobile {
  height: auto;
  min-height: 100vh;
}

body.fddb-mobile {
  --fddb-primary: #006495;
  --fddb-blue-50: #eef5fa;
  --fddb-blue-100: #d6e8f5;
  --fddb-blue-200: #bbdcf6;
  --fddb-on-surface: #121212;
  --fddb-on-surface-variant: #4d5e6f;
  --fddb-on-surface-low: #7e8d9a;
  --fddb-outline-variant: #c1c7ce;
  --fddb-surface-container-low: #f0f7fc;
  --fddb-surface-container: #ebf3f9;
}

body.fddb-mobile .fddb-mobile-content {
  background: #fff;
  padding: 12px 12px 96px 12px; /* unten Platz für Sticky-CTA */
  font-size: 14px;
  line-height: 1.45;
  color: var(--fddb-on-surface);
}

/* Reset: alte Inline-Margins/h3/h4/Tabellen rauspatchen, sobald innerhalb von .fddb-m-product */
body.fddb-mobile .fddb-m-product {
  display: flex; flex-direction: column; gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}
body.fddb-mobile .fddb-m-product h1,
body.fddb-mobile .fddb-m-product h2,
body.fddb-mobile .fddb-m-product h3,
body.fddb-mobile .fddb-m-product h4 { margin: 0; padding: 0; }

/* ----------------------------- Hero ----------------------------- */
body.fddb-mobile .fddb-m-hero {
  display: flex; flex-direction: column; gap: 10px;
  align-items: center;
  text-align: center;
  padding: 0;
}
body.fddb-mobile .fddb-m-hero__media {
  width: 100%;
  max-width: 480px;
  align-self: center;
  border-radius: 16px;
  overflow: hidden;
  background: var(--fddb-blue-50);
  border: 1px solid var(--fddb-outline-variant);
}
body.fddb-mobile .fddb-m-hero__media img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 4 / 3; object-fit: cover;
}
body.fddb-mobile .fddb-m-hero__caption {
  margin: 6px 4px 0; font-size: 11px; color: var(--fddb-on-surface-low);
}
body.fddb-mobile .fddb-m-hero__caption a {
  color: var(--fddb-on-surface-low); text-decoration: underline;
}

body.fddb-mobile .fddb-m-hero__group {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  background: var(--fddb-blue-50);
  border: 1px solid var(--fddb-blue-200);
  color: var(--fddb-primary) !important;
  text-decoration: none !important;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px;
  align-self: center;
}

body.fddb-mobile .fddb-m-hero__title {
  font-size: 22px; font-weight: 700; line-height: 1.2;
  color: var(--fddb-on-surface);
}
body.fddb-mobile .fddb-m-hero__meta {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; color: var(--fddb-on-surface-variant);
}
body.fddb-mobile .fddb-m-hero__producer { font-weight: 500; }
body.fddb-mobile a.fddb-m-hero__rating {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
body.fddb-mobile .fddb-m-hero__rating .fddb-m-rating-count {
  font-size: 12px; color: var(--fddb-on-surface-low);
}

/* ------------------------- Quickstats --------------------------- */
body.fddb-mobile .fddb-m-quickstats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
body.fddb-mobile .fddb-m-quickstat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 8px;
  border: 1px solid var(--fddb-outline-variant);
  border-radius: 12px;
  background: #fff;
  text-align: left;
}
body.fddb-mobile .fddb-m-quickstat--kcal {
  background: var(--fddb-blue-50);
  border-color: var(--fddb-blue-200);
}
body.fddb-mobile .fddb-m-quickstat__icon {
  width: 16px; height: 16px;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
  background-color: var(--fddb-on-surface-variant);
}
body.fddb-mobile .fddb-m-quickstat--kcal .fddb-m-quickstat__icon { background-color: var(--fddb-primary); }
body.fddb-mobile .fddb-m-quickstat__icon--kcal    { -webkit-mask-image: url('/static/icon/redesign/nutrition-calorie.svg');  mask-image: url('/static/icon/redesign/nutrition-calorie.svg'); }
body.fddb-mobile .fddb-m-quickstat__icon--protein { -webkit-mask-image: url('/static/icon/redesign/nutrition-protein.svg');  mask-image: url('/static/icon/redesign/nutrition-protein.svg'); }
body.fddb-mobile .fddb-m-quickstat__icon--carbs   { -webkit-mask-image: url('/static/icon/redesign/nutrition-fcarbs.svg');   mask-image: url('/static/icon/redesign/nutrition-fcarbs.svg'); }
body.fddb-mobile .fddb-m-quickstat__icon--fat     { -webkit-mask-image: url('/static/icon/redesign/nutrition-fat.svg');      mask-image: url('/static/icon/redesign/nutrition-fat.svg'); }

body.fddb-mobile .fddb-m-quickstat__value {
  font-size: 15px; font-weight: 700; color: var(--fddb-on-surface);
  line-height: 1.1;
}
body.fddb-mobile .fddb-m-quickstat--kcal .fddb-m-quickstat__value { color: var(--fddb-primary); }
body.fddb-mobile .fddb-m-quickstat__label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.3px; text-transform: uppercase;
  color: var(--fddb-on-surface-low);
}

/* ----------------------------- Card ----------------------------- */
body.fddb-mobile .fddb-m-card {
  background: #fff;
  border: 1px solid var(--fddb-outline-variant);
  border-radius: 14px;
  padding: 14px;
}
body.fddb-mobile .fddb-m-card__title {
  font-size: 13px; font-weight: 600;
  color: var(--fddb-on-surface-variant);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin: 0 0 10px 0;
}
body.fddb-mobile .fddb-m-card__footer {
  margin-top: 10px;
  font-size: 11px; color: var(--fddb-on-surface-low);
}
body.fddb-mobile .fddb-m-card a { color: var(--fddb-primary); }

/* About: Teaser + reines CSS-Toggle (Checkbox-Hack), voller Text im DOM */
body.fddb-mobile .fddb-m-about__text {
  font-size: 14px; color: var(--fddb-on-surface);
  margin: 0;
}
body.fddb-mobile .fddb-m-about__cb {
  position: absolute; opacity: 0; pointer-events: none;
  width: 0; height: 0;
}
body.fddb-mobile .fddb-m-about__rest { display: none; }
body.fddb-mobile .fddb-m-about__cb:checked ~ .fddb-m-about__text .fddb-m-about__rest {
  display: inline;
}
body.fddb-mobile .fddb-m-about__toggle {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--fddb-primary);
  cursor: pointer;
  user-select: none;
}
body.fddb-mobile .fddb-m-about__toggle::before { content: "Mehr anzeigen"; }
body.fddb-mobile .fddb-m-about__toggle::after {
  content: ""; width: 14px; height: 14px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 6l4 4 4-4' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 6l4 4 4-4' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / contain no-repeat;
  transition: transform 0.2s ease;
}
body.fddb-mobile .fddb-m-about__cb:checked ~ .fddb-m-about__toggle::before { content: "Weniger anzeigen"; }
body.fddb-mobile .fddb-m-about__cb:checked ~ .fddb-m-about__toggle::after { transform: rotate(180deg); }

/* Collapsible (details/summary) */
body.fddb-mobile .fddb-m-collapse { width: 100%; }
body.fddb-mobile .fddb-m-collapse > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0;
  user-select: none;
}
body.fddb-mobile .fddb-m-collapse > summary::-webkit-details-marker { display: none; }
body.fddb-mobile .fddb-m-collapse > summary .fddb-m-card__title { margin: 0; }
body.fddb-mobile .fddb-m-collapse__chevron {
  width: 16px; height: 16px;
  background-color: var(--fddb-on-surface-variant);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 6l4 4 4-4' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 6l4 4 4-4' stroke='black' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / contain no-repeat;
  transition: transform 0.2s ease;
}
body.fddb-mobile .fddb-m-collapse[open] > summary .fddb-m-collapse__chevron {
  transform: rotate(180deg);
}
body.fddb-mobile .fddb-m-collapse__body { padding-top: 10px; }

/* Token-Chips: tokenitemdisplayer_v2 rendert pro Token ein eigenes <table>.
   Wir laden sie als Inline-Pills nebeneinander (flex-wrap) – ohne Card-Wrapper. */
body.fddb-mobile .fddb-m-card.fddb-m-tokens {
  background: transparent;
  border: 0;
  padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
body.fddb-mobile .fddb-m-tokens > div { margin: 0 !important; }
body.fddb-mobile .fddb-m-tokens table {
  width: auto !important;
  margin: 0 !important;
  border-collapse: collapse;
  background: var(--fddb-blue-50);
  border: 1px solid var(--fddb-blue-200);
  border-radius: 999px;
}
body.fddb-mobile .fddb-m-tokens tr,
body.fddb-mobile .fddb-m-tokens td {
  background: transparent !important;
  border: 0 !important;
}
/* Sprite-Icon-Spalte ausblenden, damit Tokens dem Header-Chip entsprechen */
body.fddb-mobile .fddb-m-tokens td:first-child { display: none !important; }
body.fddb-mobile .fddb-m-tokens td {
  padding: 4px 10px !important;
  vertical-align: middle !important;
  line-height: 1;
}
body.fddb-mobile .fddb-m-tokens td a {
  color: var(--fddb-primary) !important;
  text-decoration: none !important;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Nährwerte-Liste – Zebra statt Borders, randlos in der Card */
body.fddb-mobile .fddb-m-card.fddb-m-nutrition { padding: 6px; }
body.fddb-mobile .fddb-m-nutrition .fddb-m-card__title { padding: 8px 8px 4px; }
body.fddb-mobile .fddb-m-nutrition__list {
  display: flex; flex-direction: column;
  list-style: none; margin: 0; padding: 0;
}
body.fddb-mobile .fddb-m-nutrition__list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}
body.fddb-mobile .fddb-m-nutrition__list li:nth-child(odd) {
  background: var(--fddb-surface-container-low);
}
body.fddb-mobile .fddb-m-nutrition__list .fddb-m-nutrition__label {
  color: var(--fddb-on-surface-variant); font-weight: 500;
}
body.fddb-mobile .fddb-m-nutrition__list .fddb-m-nutrition__value {
  color: var(--fddb-on-surface); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
body.fddb-mobile .fddb-m-nutrition__list li.is-primary .fddb-m-nutrition__value {
  color: var(--fddb-primary);
}

/* Vitamine/Mineralstoffe – Zebra-Rows, keine Borders */
body.fddb-mobile .fddb-m-card.fddb-m-card--datarows { padding: 6px; }
body.fddb-mobile .fddb-m-card--datarows .fddb-m-card__title { padding: 8px 8px 4px; }
body.fddb-mobile .fddb-m-card--datarows table {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
}
body.fddb-mobile .fddb-m-card--datarows tr {
  background: transparent !important;
}
body.fddb-mobile .fddb-m-card--datarows tr:nth-child(odd) td {
  background: var(--fddb-surface-container-low);
}
body.fddb-mobile .fddb-m-card--datarows tr:nth-child(odd) td:first-child {
  border-top-left-radius: 8px; border-bottom-left-radius: 8px;
}
body.fddb-mobile .fddb-m-card--datarows tr:nth-child(odd) td:last-child {
  border-top-right-radius: 8px; border-bottom-right-radius: 8px;
}
body.fddb-mobile .fddb-m-card--datarows td {
  padding: 10px 12px !important;
  border: 0 !important;
  font-size: 13px;
  color: var(--fddb-on-surface-variant);
  vertical-align: middle;
  width: auto !important;
}
body.fddb-mobile .fddb-m-card--datarows td span,
body.fddb-mobile .fddb-m-card--datarows td a {
  font-weight: 500 !important;
  color: var(--fddb-on-surface-variant) !important;
  text-decoration: none;
}
body.fddb-mobile .fddb-m-card--datarows td:last-child {
  text-align: right;
  color: var(--fddb-on-surface);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Show-more-Button */
body.fddb-mobile .fddb-m-card--datarows > div[id^="showall"] {
  margin: 12px 0 0 0 !important; font-size: 13px !important;
}
body.fddb-mobile .fddb-m-card--datarows > div[id^="showall"] > div {
  background: transparent !important;
  border: 1px solid var(--fddb-outline-variant) !important;
  border-radius: 999px !important;
  width: 100% !important; margin: 0 !important;
}
body.fddb-mobile .fddb-m-card--datarows > div[id^="showall"] > div > div { margin: 8px !important; }
body.fddb-mobile .fddb-m-card--datarows > div[id^="showall"] span {
  color: var(--fddb-primary) !important; font-weight: 600;
}

/* Portionen */
body.fddb-mobile .fddb-m-servings { display: flex; flex-direction: column; gap: 8px; }
body.fddb-mobile .fddb-m-serving {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--fddb-outline-variant);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
body.fddb-mobile .fddb-m-serving:hover { background: var(--fddb-surface-container-low); }
body.fddb-mobile .fddb-m-serving__name {
  font-size: 14px; font-weight: 600; color: var(--fddb-on-surface);
  display: block; margin-bottom: 4px;
}
body.fddb-mobile .fddb-m-serving__values {
  font-size: 12px; color: var(--fddb-on-surface-variant);
}
body.fddb-mobile .fddb-m-serving__values strong {
  color: var(--fddb-primary); font-weight: 700;
}
body.fddb-mobile .fddb-m-serving__action {
  display: inline-block; margin-top: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--fddb-primary); text-decoration: none;
}

/* Eigene Portion */
body.fddb-mobile .fddb-m-ownserving { display: flex; flex-direction: column; gap: 8px; }
body.fddb-mobile .fddb-m-ownserving input[type="text"] {
  width: 100%; box-sizing: border-box;
  height: 44px; padding: 0 12px;
  font-size: 16px;
  border: 1px solid var(--fddb-outline-variant);
  border-radius: 10px;
  background: #fff;
}
body.fddb-mobile .fddb-m-ownserving input[type="text"]:focus {
  outline: none; border-color: var(--fddb-primary);
}
body.fddb-mobile .fddb-m-ownserving input[type="submit"] {
  width: 100%; height: 44px;
  font-size: 14px; font-weight: 600;
  background: var(--fddb-primary); color: #fff;
  border: 0; border-radius: 10px; cursor: pointer;
}

/* Buttons */
body.fddb-mobile .fddb-m-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 44px; padding: 0 16px;
  font-size: 14px; font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  box-sizing: border-box;
}
body.fddb-mobile .fddb-m-btn--primary {
  background: var(--fddb-primary); color: #fff !important;
  border: 1px solid var(--fddb-primary);
}
body.fddb-mobile .fddb-m-btn--outline {
  background: #fff; color: var(--fddb-primary) !important;
  border: 1px solid var(--fddb-outline-variant);
}

/* Sterne (gleiche Tokens wie Desktop, leicht vergrößert für Touch) */
body.fddb-mobile .fddb-stars { display: inline-flex; gap: 2px; align-items: center; line-height: 1; }
body.fddb-mobile .fddb-star {
  display: inline-block; width: 18px; height: 18px;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center;  mask-position: center;
  -webkit-mask-size: contain;     mask-size: contain;
  background-color: var(--fddb-primary);
}
body.fddb-mobile .fddb-star--full  { -webkit-mask-image: url('/static/icon/redesign/star-fill.svg'); mask-image: url('/static/icon/redesign/star-fill.svg'); }
body.fddb-mobile .fddb-star--half  { -webkit-mask-image: url('/static/icon/redesign/star-half.svg'); mask-image: url('/static/icon/redesign/star-half.svg'); }
body.fddb-mobile .fddb-star--empty {
  -webkit-mask-image: url('/static/icon/redesign/star.svg');
  mask-image: url('/static/icon/redesign/star.svg');
  background-color: var(--fddb-on-surface-low);
}

/* Bewertungen-Card: Stars größer + Bewertungs-Link kompakt */
body.fddb-mobile .fddb-m-rating .fddb-stars { gap: 3px; }
body.fddb-mobile .fddb-m-rating .fddb-star  { width: 22px; height: 22px; }
body.fddb-mobile .fddb-m-rating .lightbutton2012 {
  background: transparent !important; border: 0 !important; box-shadow: none !important;
}
body.fddb-mobile .fddb-m-rating .lightbutton2012 a {
  color: var(--fddb-primary) !important;
  font-size: 13px !important; text-decoration: underline;
}

/* Sticky CTA */
body.fddb-mobile .fddb-m-sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 50;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) 12px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-top: 1px solid var(--fddb-outline-variant);
}

/* Section-Title (für Cards-Header außerhalb von .fddb-m-card) */
body.fddb-mobile .fddb-m-section__title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--fddb-on-surface-variant);
  margin: 4px 4px 6px;
}

/* Redirect-Teaser (top alert) entlang der neuen Optik */
body.fddb-mobile .fddb-m-product .fddb-alert--info {
  background: var(--fddb-blue-50);
  border: 1px solid var(--fddb-blue-200);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--fddb-on-surface-variant);
}
body.fddb-mobile .fddb-m-product .fddb-alert--info a { color: var(--fddb-primary); }
