/* ================================================================
   REPOSE CAFE — Allergen Icons v4
   /wp-content/plugins/woocommerce-food/css/repose-allergens.css
   ================================================================ */

/* ── Base container ─────────────────────────────────────────────── */
.rp-allergens {
  margin: 5px 0;             /* 5px top, 5px bottom (Issue #2) */
  padding: 5px 8px;          /* 5px top/bottom breathing room  */
  background: rgba(248,245,240,0.92);
  border: 1px solid rgba(7,59,58,0.08);
  border-radius: 8px;
  font-family: inherit;
  box-sizing: border-box;
}

/* ── Title ───────────────────────────────────────────────────────── */
.rp-allergens-title {
  font-size: 9px;
  font-weight: 700;
  color: #482728;
  text-align: center;
  margin: 0 0 4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Icons row — always one line ────────────────────────────────── */
.rp-allergens-icons {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
}

/* ── Single icon ─────────────────────────────────────────────────── */
.rp-allergen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  cursor: default;
}

.rp-allergen img {
  width: 28px; height: 28px;
  object-fit: contain; border-radius: 50%; display: block;
  transition: filter 0.22s ease, opacity 0.22s ease, transform 0.18s ease;
}

.rp-allergen--active img   { filter: none; opacity: 1; }
.rp-allergen--active:hover img { transform: scale(1.12); }
.rp-allergen--inactive img { filter: grayscale(1); opacity: 0.2; }

/* ── Label ───────────────────────────────────────────────────────── */
.rp-allergen-label {
  font-size: 7px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.2px; line-height: 1; text-align: center;
  white-space: nowrap; overflow: hidden; max-width: 100%;
  transition: color 0.18s ease;
}
.rp-allergen--active   .rp-allergen-label { color: #029A87; }
.rp-allergen--inactive .rp-allergen-label { color: #ccc; }

/* ── Tooltip ─────────────────────────────────────────────────────── */
.rp-allergen--active { position: relative; }
.rp-allergen--active::after {
  content: attr(title);
  position: absolute; bottom: calc(100% + 5px); left: 50%;
  transform: translateX(-50%);
  background: #073B3A; color: #fff; font-size: 9px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity 0.15s ease; z-index: 20;
}
.rp-allergen--active:hover::after { opacity: 1; }

/* ================================================================
   CONTEXT SIZING
   ================================================================ */

/* 3-col */
.ex-fdlist.column-3 .rp-allergen img { width: 32px; height: 32px; }

/* 4-col & 5-col — micro, no labels */
.ex-fdlist.column-4 .rp-allergens,
.ex-fdlist.column-5 .rp-allergens { padding: 4px 5px; }
.ex-fdlist.column-4 .rp-allergens-title,
.ex-fdlist.column-5 .rp-allergens-title { font-size: 8px; margin-bottom: 3px; }
.ex-fdlist.column-4 .rp-allergen img,
.ex-fdlist.column-5 .rp-allergen img { width: 20px; height: 20px; }
.ex-fdlist.column-4 .rp-allergen-label,
.ex-fdlist.column-5 .rp-allergen-label { display: none; }
.ex-fdlist.column-4 .rp-allergens-icons,
.ex-fdlist.column-5 .rp-allergens-icons { gap: 1px; }

/* LIST — compact inline bar, no title, no labels */
.ctlist .rp-allergens {
  padding: 4px 6px; border-radius: 6px;
  display: flex; align-items: center; gap: 5px;
  margin: 6px 0 0;
}
.ctlist .rp-allergens-title { display: none; }
.ctlist .rp-allergens-icons { gap: 3px; justify-content: flex-start; flex-wrap: nowrap; }
.ctlist .rp-allergen { flex: none; gap: 0; }
.ctlist .rp-allergen img { width: 18px; height: 18px; }
.ctlist .rp-allergen-label { display: none; }

/* TABLE — same compact bar */
.exfd-table-1 .rp-allergens, .exfd-table-2 .rp-allergens {
  padding: 3px 5px; border-radius: 5px;
  display: flex; align-items: center; gap: 4px; margin: 6px 0 0;
}
.exfd-table-1 .rp-allergens-title, .exfd-table-2 .rp-allergens-title { display: none; }
.exfd-table-1 .rp-allergens-icons, .exfd-table-2 .rp-allergens-icons { gap: 2px; justify-content: flex-start; flex-wrap: nowrap; }
.exfd-table-1 .rp-allergen, .exfd-table-2 .rp-allergen { flex: none; gap: 0; }
.exfd-table-1 .rp-allergen img, .exfd-table-2 .rp-allergen img { width: 18px; height: 18px; }
.exfd-table-1 .rp-allergen-label, .exfd-table-2 .rp-allergen-label { display: none; }

/* MODAL — full-size display */
.ex_modal .rp-allergens { margin: 14px 0 6px; padding: 12px 14px 10px; border-radius: 12px; display: block; }
.ex_modal .rp-allergens-title { display: block; font-size: 11px; white-space: normal; overflow: visible; margin-bottom: 10px; }
.ex_modal .rp-allergens-icons { justify-content: center; gap: 10px; flex-wrap: wrap; }
.ex_modal .rp-allergen { flex: none; gap: 4px; }
.ex_modal .rp-allergen img { width: 46px; height: 46px; }
.ex_modal .rp-allergen-label { display: block; font-size: 9px; }

/* ── RTL ─────────────────────────────────────────────────────────── */
[dir="rtl"] .rp-allergens { direction: rtl; }
[dir="rtl"] .ctlist .rp-allergens-icons,
[dir="rtl"] .exfd-table-1 .rp-allergens-icons,
[dir="rtl"] .exfd-table-2 .rp-allergens-icons { justify-content: flex-end; }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media screen and (max-width: 600px) {
  .rp-allergen img { width: 20px; height: 20px; }
  .rp-allergen-label { display: none; }
  .rp-allergens-title { font-size: 8px; }
}
