/**
 * DataFirefly Cart Cross-Sell - front office
 * Works with Classic (1.7.8, 8) and Hummingbird (9): no theme-specific selector.
 *
 * @author    DataFirefly <contact@datafirefly.com>
 * @copyright 2024-2026 DataFirefly
 * @license   Commercial
 */
.dfccs {
  --dfccs-gap: 16px;
  --dfccs-ink: #1d2433;
  --dfccs-text: #3b4352;
  --dfccs-muted: #6b7385;
  --dfccs-line: #e6e8ee;
  --dfccs-soft: #f5f6f9;
  --dfccs-surface: #fff;
  --dfccs-sale: #d1343f;
  --dfccs-offer: #0d7d4d;
  --dfccs-offer-bg: #e7f6ee;
  --dfccs-new: #1d2433;
  --dfccs-focus: #2563eb;
  --dfccs-pv: var(--dfccs-per-view, 4);
  position: relative;
  clear: both;
  margin: 1.5rem 0;
  padding: 1.25rem;
  color: var(--dfccs-text);
  background: var(--dfccs-surface);
  border: 1px solid var(--dfccs-line);
  border-radius: calc(var(--dfccs-radius, 12px) + 4px);
  font-size: 14px;
  line-height: 1.45;
  text-align: start;
}
.dfccs *, .dfccs *::before, .dfccs *::after { box-sizing: border-box; }
.dfccs [hidden] { display: none !important; }
.dfccs-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.dfccs a { text-decoration: none; }
.dfccs :focus-visible { outline: 2px solid var(--dfccs-accent, var(--dfccs-focus)); outline-offset: 2px; }

/* Head */
.dfccs-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 .9rem; }
.dfccs .dfccs-title {
  display: flex; align-items: center; gap: .5rem; margin: 0; padding: 0;
  font-size: 1.2rem; line-height: 1.3; font-weight: 700; letter-spacing: -.01em;
  text-transform: none; color: var(--dfccs-ink); border: 0;
}
.dfccs-title-icon { color: var(--dfccs-accent, var(--dfccs-offer)); flex: 0 0 auto; }
.dfccs-nav { display: flex; gap: .4rem; flex: 0 0 auto; }
.dfccs-arrow, .dfccs-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--dfccs-line); border-radius: 999px; background: #fff; color: var(--dfccs-ink);
  cursor: pointer; transition: background .15s, border-color .15s, opacity .15s;
}
.dfccs-arrow:hover:not(:disabled), .dfccs-toggle:hover { background: var(--dfccs-soft); border-color: #cfd4de; }
.dfccs-arrow:disabled { opacity: .35; cursor: default; }
.dfccs-toggle .dfccs-icon-play { display: none; }
.dfccs-toggle[aria-pressed="true"] .dfccs-icon-play { display: block; }
.dfccs-toggle[aria-pressed="true"] .dfccs-icon-pause { display: none; }

/* Track: carousel (scroll-snap, touch and keyboard native), grid, list */
.dfccs-viewport { position: relative; }
.dfccs-track { display: grid; gap: var(--dfccs-gap); margin: 0; padding: 0; list-style: none; }
.dfccs--carousel .dfccs-track {
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--dfccs-pv) - 1) * var(--dfccs-gap)) / var(--dfccs-pv));
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; padding: 2px 2px 6px; margin: -2px -2px 0;
}
.dfccs--carousel .dfccs-track::-webkit-scrollbar { display: none; }
.dfccs--carousel .dfccs-item { scroll-snap-align: start; }
.dfccs--grid .dfccs-track { grid-template-columns: repeat(var(--dfccs-pv), minmax(0, 1fr)); }
.dfccs-item { min-width: 0; display: flex; }
.dfccs-item > .dfccs-card { width: 100%; }

.dfccs-progress { height: 3px; margin-top: .75rem; background: var(--dfccs-line); border-radius: 3px; overflow: hidden; }
.dfccs-progress-bar {
  display: block; height: 100%; width: var(--dfccs-progress-w, 25%); margin-inline-start: var(--dfccs-progress-x, 0%);
  background: var(--dfccs-accent, var(--dfccs-ink)); border-radius: 3px; transition: margin .2s, width .2s;
}

/* Card */
.dfccs-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; height: 100%;
  background: #fff; border: 1px solid var(--dfccs-line); border-radius: var(--dfccs-radius, 12px); overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.dfccs--shadow .dfccs-card { box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .06); }
.dfccs-card:hover { border-color: #d5d9e2; box-shadow: 0 8px 24px rgba(16, 24, 40, .1); }
.dfccs--flat .dfccs-card { box-shadow: none !important; }
.dfccs--minimal .dfccs-card { border-color: transparent; box-shadow: none !important; background: transparent; }
.dfccs--minimal .dfccs-media { border-radius: var(--dfccs-radius, 12px); }
.dfccs--elegant .dfccs-card { border-color: #ece8e1; }
.dfccs--elegant .dfccs-title { font-weight: 600; letter-spacing: .01em; }
.dfccs--elegant .dfccs-name { font-weight: 500; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .dfccs:not(.dfccs--list):not(.dfccs--modal) .dfccs-card:hover { transform: translateY(-2px); }
  .dfccs-card:hover .dfccs-img { transform: scale(1.03); }
}
.dfccs-media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--dfccs-soft); overflow: hidden; }
.dfccs-img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .35s ease; }
.dfccs-img.is-placeholder { opacity: .6; }
.dfccs-badges { position: absolute; inset-block-start: 10px; inset-inline-start: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.dfccs-badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--dfccs-sale); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 1.3; white-space: nowrap;
}
.dfccs-badge--offer { background: var(--dfccs-offer); }
.dfccs-badge--new { background: var(--dfccs-new); }
.dfccs-badge--inline { margin-inline-start: .35rem; font-size: 11px; padding: 2px 6px; }
.dfccs-body { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; padding: 12px 14px 14px; min-width: 0; }
.dfccs-brand { margin: 0; color: var(--dfccs-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.dfccs .dfccs-name {
  margin: 0; font-size: 14px; line-height: 1.35; font-weight: 600; text-transform: none; letter-spacing: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em;
}
.dfccs-name a { color: var(--dfccs-ink); }
.dfccs-name a:hover { color: var(--dfccs-accent, var(--dfccs-ink)); text-decoration: underline; }
.dfccs-rating { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 12px; color: var(--dfccs-muted); }
.dfccs-stars {
  --dfccs-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.3 18.2 21l-1.6-7 5.4-4.7-7.2-.6L12 2 9.2 8.7 2 9.3 7.4 14l-1.6 7z'/%3E%3C/svg%3E");
  position: relative; display: inline-block; width: 80px; height: 16px;
  background: #d9dce3; -webkit-mask: var(--dfccs-star) repeat-x left / 16px 16px; mask: var(--dfccs-star) repeat-x left / 16px 16px;
}
.dfccs-stars::before { content: ""; position: absolute; inset: 0; width: var(--dfccs-rating, 0%); background: #f5a524; }
.dfccs-prices { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 2px 0 0; }
.dfccs-price { font-size: 16px; font-weight: 700; color: var(--dfccs-ink); font-variant-numeric: tabular-nums; }
.dfccs-price.is-reduced { color: var(--dfccs-sale); }
.has-offer .dfccs-price { color: var(--dfccs-offer); }
.dfccs-regular { color: var(--dfccs-muted); font-size: 13px; }
.dfccs-offer-note {
  align-self: flex-start; margin: 0; padding: 2px 8px; border-radius: 6px;
  background: var(--dfccs-offer-bg); color: var(--dfccs-offer); font-size: 12px; font-weight: 600;
}
.dfccs-note { margin: 0; color: var(--dfccs-muted); font-size: 12px; }
.dfccs-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 6px; }
.dfccs-variant { display: block; margin: 0; }
.dfccs-select {
  width: 100%; height: 36px; padding: 0 30px 0 10px; border: 1px solid #d3d8e1; border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7385' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--dfccs-ink); font-size: 13px; line-height: 34px; -webkit-appearance: none; appearance: none; cursor: pointer;
}
[dir="rtl"] .dfccs-select { padding: 0 10px 0 30px; background-position: left 10px center; }
.dfccs-select:hover { border-color: #b9c0cc; }

/* Buttons: theme button classes, normalized */
.dfccs .dfccs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 40px;
  margin: 0; padding: 8px 12px; border-radius: max(6px, calc(var(--dfccs-radius, 12px) * .7));
  font-size: 14px; font-weight: 600; line-height: 1.2; text-transform: none; letter-spacing: 0; white-space: normal;
  box-shadow: none; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.dfccs .dfccs-btn:active { transform: scale(.98); }
.dfccs--accent .dfccs-btn.btn-primary { background-color: var(--dfccs-accent); border-color: var(--dfccs-accent); color: #fff; }
.dfccs--accent .dfccs-btn.btn-primary:hover { filter: brightness(.92); }
.dfccs .dfccs-btn--ghost { background: #fff; color: var(--dfccs-ink); border: 1px solid #cfd4de; }
.dfccs .dfccs-btn--ghost:hover { background: var(--dfccs-soft); color: var(--dfccs-ink); }
.dfccs .dfccs-btn--muted { background: var(--dfccs-soft); color: var(--dfccs-muted); border: 1px dashed #cfd4de; cursor: default; }
.dfccs-icon { flex: 0 0 auto; }
.dfccs .dfccs-btn.is-loading { pointer-events: none; opacity: .85; }
.dfccs .dfccs-btn.is-loading .dfccs-icon { animation: dfccs-spin .8s linear infinite; }
.dfccs .dfccs-btn.is-added, .dfccs .dfccs-btn.is-added:hover { background: var(--dfccs-offer) !important; border-color: var(--dfccs-offer) !important; color: #fff !important; }
.dfccs-card.is-unavailable .dfccs-img { opacity: .55; }
@keyframes dfccs-spin { to { transform: rotate(360deg); } }

/* Frequently bought together */
.dfccs-bundle { margin: 0 0 1.4rem; padding: 0 0 1.25rem; border-bottom: 1px solid var(--dfccs-line); }
.dfccs-bundle:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.dfccs-bundle-hint { margin: -.4rem 0 .8rem; color: var(--dfccs-muted); font-size: 13px; }
.dfccs-bundle-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.dfccs-bundle-item { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--dfccs-line); border-radius: var(--dfccs-radius, 12px); background: #fff; transition: border-color .15s, background .15s; }
.dfccs-bundle-item:has(.dfccs-bundle-input:checked) { border-color: var(--dfccs-accent, #9aa3b5); background: #fbfcfe; }
.dfccs-bundle-item.is-disabled { opacity: .6; }
.dfccs-bundle-check { display: flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; font-weight: 400; }
.dfccs-bundle-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dfccs-bundle-box {
  flex: 0 0 20px; width: 20px; height: 20px; border: 2px solid #b6bdca; border-radius: 6px; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, border-color .15s;
}
.dfccs-bundle-input:checked + .dfccs-bundle-box { background: var(--dfccs-accent, var(--dfccs-ink)); border-color: var(--dfccs-accent, var(--dfccs-ink)); }
.dfccs-bundle-input:checked + .dfccs-bundle-box::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.dfccs-bundle-input:focus-visible + .dfccs-bundle-box { outline: 2px solid var(--dfccs-accent, var(--dfccs-focus)); outline-offset: 2px; }
.dfccs-bundle-img { flex: 0 0 56px; width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: var(--dfccs-soft); }
.dfccs-bundle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dfccs-bundle-name { color: var(--dfccs-ink); font-weight: 600; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dfccs-bundle-text .dfccs-price { font-size: 14px; }
.dfccs-bundle-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .9rem; }
.dfccs-bundle-total { display: flex; align-items: baseline; gap: .4rem; margin: 0; color: var(--dfccs-muted); }
.dfccs-bundle-total strong { color: var(--dfccs-ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.dfccs .dfccs-bundle-add { width: auto; min-width: 220px; }

/* Compact list (summary column) */
.dfccs--list { padding: 1rem; }
.dfccs--list .dfccs-title { font-size: 1.05rem; }
.dfccs--list .dfccs-track { grid-template-columns: 1fr; gap: 10px; }
.dfccs--list .dfccs-card, .dfccs--modal .dfccs-card { flex-direction: row; align-items: stretch; }
.dfccs--list .dfccs-media, .dfccs--modal .dfccs-media { flex: 0 0 84px; width: 84px; aspect-ratio: auto; }
.dfccs--list .dfccs-badges, .dfccs--modal .dfccs-badges { inset-block-start: 6px; inset-inline-start: 6px; }
.dfccs--list .dfccs-badge, .dfccs--modal .dfccs-badge { font-size: 10.5px; padding: 2px 6px; }
.dfccs--list .dfccs-body, .dfccs--modal .dfccs-body { padding: 10px 12px; gap: 4px; }
.dfccs--list .dfccs-name, .dfccs--modal .dfccs-name { font-size: 13px; min-height: 0; }
.dfccs--list .dfccs-price, .dfccs--modal .dfccs-price { font-size: 14px; }
.dfccs--list .dfccs-actions, .dfccs--modal .dfccs-actions { flex-direction: row; flex-wrap: wrap; padding-top: 4px; }
.dfccs--list .dfccs-variant, .dfccs--modal .dfccs-variant { flex: 1 1 120px; }
.dfccs--list .dfccs-btn, .dfccs--modal .dfccs-btn { width: auto; flex: 1 1 auto; min-height: 34px; padding: 6px 10px; font-size: 13px; }
.dfccs--list .dfccs-offer-note, .dfccs--modal .dfccs-offer-note { font-size: 11px; }

/* Add-to-cart modal */
.dfccs--modal { margin: 1rem 0 0; padding: 1rem; border-radius: 12px; background: var(--dfccs-soft); border-color: transparent; }
.dfccs--modal .dfccs-title { font-size: 1rem; }
.dfccs--modal .dfccs-head { margin-bottom: .6rem; }
.dfccs--modal .dfccs-track { grid-template-columns: 1fr; gap: 8px; }
.dfccs--modal .dfccs-card { border-color: var(--dfccs-line); box-shadow: none; }
.dfccs--modal .dfccs-media { flex-basis: 72px; width: 72px; }
.modal-footer .dfccs--modal { width: 100%; margin: .75rem 0 0; text-align: start; }

/* Empty cart */
.dfccs--src-empty { margin-top: 2rem; }

/* Skeleton while the block refreshes after a cart change */
.dfccs.is-refreshing .dfccs-card, .dfccs.is-refreshing .dfccs-bundle-item { pointer-events: none; }
.dfccs.is-refreshing .dfccs-card > *, .dfccs.is-refreshing .dfccs-bundle-item > * { visibility: hidden; }
.dfccs.is-refreshing .dfccs-card, .dfccs.is-refreshing .dfccs-bundle-item {
  background: linear-gradient(90deg, #eef0f4 25%, #f7f8fa 37%, #eef0f4 63%) 0 0 / 400% 100%;
  border-color: transparent; animation: dfccs-shimmer 1.2s ease-in-out infinite;
}
@keyframes dfccs-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Toast */
.dfccs-toast {
  position: fixed; z-index: 2000; inset-inline: 0; bottom: 20px; margin: 0 auto; width: max-content; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px;
  background: #1d2433; color: #fff; font-size: 14px; line-height: 1.35; box-shadow: 0 12px 32px rgba(16, 24, 40, .28);
  opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; pointer-events: none;
}
.dfccs-toast.is-visible { opacity: 1; transform: none; }
.dfccs-toast.is-error { background: #9b1c23; }
.dfccs-toast svg { flex: 0 0 auto; }

/* Back office preview */
.dfccs--preview { margin: 0; }
.dfccs--preview .dfccs-btn, .dfccs--preview a { pointer-events: none; }

/* Responsive */
@media (max-width: 1199px) {
  .dfccs { --dfccs-pv: min(var(--dfccs-per-view, 4), 3); }
}
@media (max-width: 767px) {
  .dfccs { --dfccs-gap: 12px; --dfccs-pv: var(--dfccs-per-view-m, 2); padding: 1rem; margin: 1.25rem 0; }
  /* Let the next card peek out: the carousel scrolls. */
  .dfccs--carousel .dfccs-track { grid-auto-columns: calc((100% - var(--dfccs-pv) * var(--dfccs-gap)) / (var(--dfccs-pv) + .3)); }
  .dfccs .dfccs-title { font-size: 1.05rem; }
  .dfccs-arrow { display: none; }
  .dfccs-body { padding: 10px; }
  .dfccs .dfccs-name { font-size: 13px; }
  .dfccs-price { font-size: 15px; }
  .dfccs .dfccs-btn { min-height: 40px; font-size: 13px; padding: 6px 8px; }
  .dfccs .dfccs-bundle-add { width: 100%; }
  .dfccs-bundle-foot { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  .dfccs *, .dfccs *::before { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.dfccs--modal .dfccs-brand, .dfccs--list .dfccs-brand { display: none; }
/* Narrow cards: the cart icon goes away so that the label stays on one line. */
.dfccs-card { container-type: inline-size; }
@container (max-width: 210px) {
  .dfccs-card .dfccs-icon-cart { display: none; }
  .dfccs .dfccs-card .dfccs-btn { padding-left: 6px; padding-right: 6px; }
}
