/* ════════════════════════════════════════════════════════
   variant-picker.css — Universal Product Variant Selector
   Design inspired by 21st.dev Radio Group Card (ruixen.ui)
   ════════════════════════════════════════════════════════ */

/* ─── Base: every variant group ─── */
.vp-group {
  margin-bottom: 20px;
}
.vp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.vp-head-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.vp-head-selected {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(124,58,237,.18);
  transition: all .3s;
}

/* ─── Grid layout (default) ─── */
.vp-grid {
  display: grid;
  gap: 10px;
}
.vp-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.vp-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.vp-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.vp-grid.cols-auto { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ─── Row layout (flex horizontal) ─── */
.vp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ─── Card option (the hero style — from 21st.dev Radio Group Card) ─── */
.vp-opt {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--card2);
  cursor: pointer;
  transition: all .35s cubic-bezier(.22,1,.36,1);
  user-select: none;
  overflow: hidden;
  text-align: start;
  font-family: inherit;
  font-size: inherit;
  width: 100%;
}
.vp-opt::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%);
  opacity: 0;
  transition: opacity .4s;
  pointer-events: none;
}
.vp-opt:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -18px var(--glow);
}
.vp-opt:hover::before { opacity: 1; }
.vp-opt.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 16px 40px -20px var(--glow);
  animation: vpPulse 2.5s ease-in-out infinite;
}
.vp-opt.active::before { opacity: 1; }

.vp-opt-glow {
  position: absolute;
  top: -50%;
  inset-inline-end: -20%;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 70%);
  filter: blur(16px);
  opacity: 0;
  transition: opacity .5s;
  pointer-events: none;
}
.vp-opt.active .vp-opt-glow { opacity: 1; }

/* Icon */
.vp-opt-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
  transition: all .35s;
  background: var(--surface);
  border: 1px solid var(--border);
}
.vp-opt.active .vp-opt-icon {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  box-shadow: 0 8px 20px -10px var(--glow);
}
.vp-opt-icon svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: all .35s;
}
.vp-opt.active .vp-opt-icon svg { color: #fff; }

/* Body */
.vp-opt-body { flex: 1; min-width: 0; }
.vp-opt-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.vp-opt-badge {
  font-size: 8px;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  padding: 1px 7px;
  border-radius: 99px;
  letter-spacing: .3px;
}
.vp-opt.active .vp-opt-badge { background: rgba(255,255,255,.2); }
.vp-opt-desc {
  font-size: 11px;
  color: var(--muted2);
  font-weight: 500;
  margin-top: 3px;
  line-height: 1.45;
}

/* Tail (price + indicator) */
.vp-opt-tail {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  align-self: center;
}
.vp-opt-price {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-text);
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--accent-soft);
  transition: all .35s;
  white-space: nowrap;
}
.vp-opt.active .vp-opt-price {
  background: rgba(255,255,255,.15);
  color: #fff;
  box-shadow: 0 4px 14px -8px var(--glow);
}

/* Glowing indicator dot (from 21st.dev) */
.vp-indicator {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all .35s;
  position: relative;
}
.vp-opt.active .vp-indicator {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 20px -6px var(--glow);
}
.vp-indicator svg {
  opacity: 0;
  transition: opacity .25s;
  transform: scale(.7);
}
.vp-opt.active .vp-indicator svg { opacity: 1; transform: scale(1); }

/* Glowing green dot (alternative indicator — closer to 21st.dev) */
.vp-dot {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
}
.vp-dot-ping {
  position: absolute;
  display: inline-flex;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ok);
  opacity: 0;
  animation: vpPing 1.5s cubic-bezier(0,0,.2,1) infinite;
}
.vp-opt.active .vp-dot-ping { opacity: .75; }
.vp-dot-core {
  position: relative;
  display: inline-flex;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px 3px rgba(52,211,153,.5);
  opacity: 0;
  transition: opacity .3s;
}
.vp-opt.active .vp-dot-core { opacity: 1; }

@keyframes vpPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--glow), 0 0 0 0 var(--glow2); }
  50% { box-shadow: 0 0 0 6px rgba(124,58,237,.15), 0 0 0 12px rgba(217,70,239,.08); }
}
@keyframes vpPing {
  75%, 100% { transform: scale(2.5); opacity: 0; }
}
@keyframes badgePop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ─── Chip option (compact) ─── */
.vp-opt.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  user-select: none;
  position: relative;
  overflow: hidden;
  width: auto;
  flex: 1;
  min-width: 100px;
  justify-content: center;
}
.vp-opt.chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity .25s;
  border-radius: inherit;
}
.vp-opt.chip:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}
.vp-opt.chip:hover::before { opacity: 0; }
.vp-opt.chip.active {
  border-color: var(--accent);
  color: #fff;
}
.vp-opt.chip.active::before { opacity: 1; }
.vp-opt.chip > *,
.vp-opt.chip .vp-opt-title { position: relative; z-index: 1; font-size: 13px; }
.vp-opt.chip .vp-opt-desc {
  position: relative; z-index: 1;
  font-size: 10.5px;
  opacity: .7;
  font-weight: 500;
  margin: 0;
}
.vp-opt.chip .vp-opt-price {
  position: relative; z-index: 1;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.vp-opt.chip.active .vp-opt-price {
  background: rgba(255,255,255,.2);
  color: #fff;
}
.vp-opt.chip .vp-indicator { display: none; }
.vp-opt.chip .vp-opt-glow { display: none; }
.vp-opt.chip .vp-opt-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.vp-opt.chip .vp-opt-icon svg {
  width: 14px;
  height: 14px;
}
.vp-opt.chip .vp-opt-body {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Tab option (pill/segmented) ─── */
.vp-opt.tab {
  flex: 1;
  padding: 14px 8px 12px;
  border-radius: 11px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all .35s cubic-bezier(.22,1,.36,1);
  text-align: center;
  user-select: none;
  min-width: 0;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.vp-opt.tab:hover { transform: translateY(-1px); }
.vp-opt-tab-bg {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: var(--card2);
  border: 1px solid var(--border);
  transition: all .35s cubic-bezier(.22,1,.36,1);
  opacity: 0;
  pointer-events: none;
}
.vp-opt.tab:hover .vp-opt-tab-bg { opacity: 1; }
.vp-opt.tab.active .vp-opt-tab-bg {
  opacity: 1;
  border-color: var(--accent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--card)), var(--card));
  box-shadow: 0 0 0 1px var(--accent), 0 8px 24px -18px var(--glow);
}
.vp-opt.tab .vp-opt-title {
  display: block;
  font-size: 17px;
  font-weight: 900;
  color: var(--muted);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color .3s;
  position: relative;
  justify-content: center;
}
.vp-opt.tab.active .vp-opt-title { color: var(--text); }
.vp-opt.tab .vp-opt-desc {
  display: block;
  font-size: 9px;
  font-weight: 650;
  color: var(--muted2);
  margin: 3px 0 6px;
  transition: color .3s;
  position: relative;
}
.vp-opt.tab .vp-opt-price {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--accent-text);
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  transition: all .35s;
  position: relative;
}
.vp-opt.tab.active .vp-opt-price {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 3px 12px -8px var(--glow);
}
.vp-opt.tab .vp-opt-badge {
  position: absolute;
  top: -8px;
  inset-inline-end: -4px;
  z-index: 2;
  font-size: 6.5px;
  font-weight: 850;
  color: #fff;
  background: var(--rose, #f43f5e);
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  box-shadow: 0 2px 8px -4px var(--rose, #f43f5e);
  animation: badgePop .4s cubic-bezier(.34,1.56,.64,1);
}
.vp-opt.tab .vp-indicator { display: none; }
.vp-opt.tab .vp-opt-glow { display: none; }
.vp-opt.tab .vp-opt-icon { display: none; }
.vp-opt.tab .vp-opt-tail { display: none; }
.vp-opt.tab-ring {
  position: absolute;
  inset: -2px;
  border-radius: 13px;
  border: 2px solid var(--accent);
  opacity: 0;
  transition: opacity .35s;
  pointer-events: none;
}
.vp-opt.tab.active .vp-opt-tab-ring { opacity: 1; }

/* ─── Tab row (segmented control background) ─── */
.vp-tab-row {
  isolation: isolate;
  display: flex;
  gap: 6px;
  position: relative;
  background: var(--bg2);
  border-radius: 14px;
  padding: 4px;
}

/* ─── Popular tag (for tab layout) ─── */
.vp-pop-text {
  position: absolute;
  top: -8px;
  inset-inline-end: -4px;
  z-index: 2;
  font-size: 6.5px;
  font-weight: 850;
  color: #fff;
  background: var(--rose, #f43f5e);
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  box-shadow: 0 2px 8px -4px var(--rose, #f43f5e);
  animation: badgePop .4s cubic-bezier(.34,1.56,.64,1);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .vp-grid.cols-2,
  .vp-grid.cols-3,
  .vp-grid.cols-4 { grid-template-columns: 1fr; }

  .vp-opt { padding: 12px 14px; border-radius: 14px; gap: 10px; }
  .vp-opt-icon { width: 36px; height: 36px; }
  .vp-opt-icon svg { width: 17px; height: 17px; }
  .vp-opt-title { font-size: 13px; }
  .vp-opt-desc { font-size: 10px; }
  .vp-opt-price { font-size: 11px; padding: 2px 10px; }
  .vp-indicator { width: 18px; height: 18px; }

  .vp-opt.chip { padding: 8px 14px; font-size: 12.5px; }

  .vp-opt.tab { padding: 8px 4px; border-radius: 9px; }
  .vp-opt.tab .vp-opt-title { font-size: 13px; }
  .vp-opt.tab .vp-opt-desc { font-size: 7.5px; margin: 1px 0 2px; }
  .vp-opt.tab .vp-opt-price { font-size: 7.5px; padding: 1px 4px; }

  .vp-tab-row { flex-wrap: wrap; gap: 4px; }
  .vp-tab-row .vp-opt.tab { min-width: calc(50% - 3px); flex: 1 1 calc(50% - 3px); }
}

@media (max-width: 480px) {
  .vp-opt.tab { padding: 7px 3px; }
  .vp-opt.tab .vp-opt-title { font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   PICKER REBUILD ADDITIONS
   The picker is now radio-driven: one selector per product attribute,
   labels resolved to Persian term names, and the whole thing lives
   inside the real WooCommerce add-to-cart form so field plugins work.
   ══════════════════════════════════════════════════════════════ */

/* The radio itself is never shown — .vp-opt is its label. */
.vp-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.vp-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* .vp-opt is a <label> now, so it needs the affordances a <button> had. */
label.vp-opt {
  cursor: pointer;
  user-select: none;
  width: 100%;
  text-align: start;
}
label.vp-opt:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Keyboard focus should look the same as hover. */
.vp-input:focus-visible + .vp-opt-glow ~ .vp-opt-body { text-decoration: none; }

/* Combination not purchasable with the current selection. */
.vp-opt.vp-disabled {
  opacity: .42;
  cursor: not-allowed;
  filter: grayscale(.5);
}
.vp-opt.vp-disabled:hover { transform: none; border-color: var(--border); }

/* Layouts */
.vp-grid.vp-layout-row  { grid-template-columns: 1fr; }
.vp-grid.vp-layout-chip { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.vp-layout-chip .vp-opt-desc { display: none; }
.vp-layout-chip .vp-opt      { padding: 12px 14px; gap: 10px; }
.vp-layout-chip .vp-opt-icon { width: 30px; height: 30px; }

/* Stacked selectors need separation without doubling the panel padding. */
.vp-groups .vp-group + .vp-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.vp-unavailable {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: #f59e0b;
  display: flex;
  align-items: center;
  gap: 7px;
}
/* An author display beats the UA stylesheet's rule for [hidden], so without
   this the "combination unavailable" warning stayed on screen permanently. */
.vp-unavailable[hidden] { display: none; }
.vp-unavailable::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pp-buy-btn.is-disabled,
.pp-buy-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: saturate(.4);
}

/* ─── Extra fields injected by field plugins ───
   Advanced Product Fields (and anything else hooking the add-to-cart form)
   renders its own markup here. These rules only normalise spacing and
   inherit the theme tokens; they deliberately do not restyle plugin
   internals, so new field types keep working without further CSS. */
.pp-extra-fields:empty { display: none; }
.pp-extra-fields {
  margin: 0 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pp-extra-fields label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
}
.pp-extra-fields input[type="text"],
.pp-extra-fields input[type="email"],
.pp-extra-fields input[type="number"],
.pp-extra-fields input[type="tel"],
.pp-extra-fields input[type="date"],
.pp-extra-fields input[type="url"],
.pp-extra-fields select,
.pp-extra-fields textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
.pp-extra-fields input:focus,
.pp-extra-fields select:focus,
.pp-extra-fields textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pp-extra-fields textarea { min-height: 96px; resize: vertical; }
.pp-extra-fields input[type="checkbox"],
.pp-extra-fields input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  margin-inline-end: 8px;
}
.pp-extra-fields .description,
.pp-extra-fields small {
  display: block;
  font-size: 11.5px;
  line-height: 1.9;
  color: var(--muted2);
  margin-top: 6px;
}
/* Field plugins commonly mark required fields with an asterisk span. */
.pp-extra-fields .required,
.pp-extra-fields abbr[title="required"] {
  color: #f43f5e;
  text-decoration: none;
  margin-inline-start: 3px;
}

@media (max-width: 560px) {
  .vp-grid.vp-layout-chip { grid-template-columns: 1fr 1fr; }
}
/* ─── ISP / datacenter cross-link ───
   Shown on country IP products so a visitor who wanted the other type is not
   left with a dead end after the two were split into separate products. */
.akch-ip-crosslink {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: 14px;
  background: var(--accent-soft);
}
.akch-ip-crosslink-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  color: var(--accent-text);
}
.akch-ip-crosslink-icon svg { width: 100%; height: 100%; }
.akch-ip-crosslink-body {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.akch-ip-crosslink-body strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}
.akch-ip-crosslink-body span {
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--muted);
}
.akch-ip-crosslink-btn {
  flex-shrink: 0;
  align-self: center;
  padding: 9px 18px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.akch-ip-crosslink-btn:hover { filter: brightness(1.08); }

@media (max-width: 520px) {
  .akch-ip-crosslink-btn { width: 100%; text-align: center; }
}
/* ══════════════════════════════════════════════════════════════
   PRODUCT FIELD PLUGINS
   Advanced Product Fields renders its own `.wapf-*` markup into the
   add-to-cart form. Left alone it inherits browser defaults — square
   selects, a bare textarea, a plain totals table. These rules bring it
   into the theme without touching plugin internals, so field types added
   later (date, file, swatch, repeater) pick the styling up automatically.
   ══════════════════════════════════════════════════════════════ */

.wapf-field-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.wapf-field-group-heading {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 2px;
  padding: 0;
  border: 0;
}
.wapf-field-container { margin: 0; }

.wapf-field-label,
.wapf-field-label label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.wapf-field-label .wapf-required { color: #f43f5e; margin-inline-start: 3px; }

.wapf-field-description,
.wapf-field-container .description {
  font-size: 11.5px;
  line-height: 1.9;
  color: var(--muted2);
  margin-top: 7px;
}

/* Inputs */
.wapf-field-input input[type="text"],
.wapf-field-input input[type="email"],
.wapf-field-input input[type="url"],
.wapf-field-input input[type="number"],
.wapf-field-input input[type="date"],
.wapf-field-input input[type="tel"],
.wapf-field-input select,
.wapf-field-input textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
  -webkit-appearance: none;
  appearance: none;
}
.wapf-field-input textarea { min-height: 104px; resize: vertical; line-height: 1.9; }
.wapf-field-input input::placeholder,
.wapf-field-input textarea::placeholder { color: var(--muted2); opacity: .8; }
.wapf-field-input input:focus,
.wapf-field-input select:focus,
.wapf-field-input textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Native select arrow, on the correct side for RTL */
.wapf-field-input select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(0% + 18px) calc(50% + 2px), calc(0% + 23px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-start: 38px;
}

/* Checkbox / radio rows */
.wapf-field-input label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg2);
  margin: 0 0 8px;
  transition: border-color .18s, background .18s;
}
.wapf-field-input label:hover { border-color: var(--border2); color: var(--text); }
.wapf-field-input input[type="checkbox"],
.wapf-field-input input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* Swatches */
.wapf-swatch {
  border: 1px solid var(--border) !important;
  border-radius: 11px !important;
  overflow: hidden;
  transition: border-color .18s, transform .18s;
}
.wapf-swatch:hover { transform: translateY(-1px); }
.wapf-swatch.wapf-checked {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Price suffix the plugin appends to an option label */
.wapf-pricing-hint,
.wapf--price {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-text);
  margin-inline-start: 6px;
}

/* Totals block */
.wapf-product-totals,
.wapf--inner {
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.wapf--inner > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.wapf--inner > div:last-child {
  border-top: 1px dashed var(--border2);
  padding-top: 10px;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.wapf--inner .wapf-total {
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.wapf--inner > div:last-child .wapf-total { color: var(--accent-text); }

/* The plugin hides its wrapper until it has something to show; make sure an
   empty wrapper never leaves a stray bordered box behind. */
.pp-extra-fields:has(> .wapf-wrapper:empty) { display: none; }
.wapf-wrapper:empty { display: none; }
/* ─── Related products ───
   Was a hidden-scrollbar horizontal scroller: cards overflowed off-screen with no
   affordance, and the hover lift was clipped by the scroll container. */
.related-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding-bottom: 4px;
}
.related-products-grid .rp-card {
  min-width: 0;
  width: auto;
  max-width: none;
  flex-shrink: 1;
}
@media (max-width: 560px) {
  .related-products-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .related-products-grid .rp-card h3 { font-size: 13px; }
}
@media (max-width: 380px) {
  .related-products-grid { grid-template-columns: 1fr; }
}
/* The lift is fine in a grid, but scale caused sub-pixel blur on images. */
.related-products-grid .rp-card:hover { transform: translateY(-6px); }
/* ── Mobile: let short period options fit across ───────────────────────────────
 * The row layout collapsed to a single column under 640px, so یک ماهه / دو ماهه /
 * سه ماهه each took a full-width row — three tall rows for three two-word labels.
 * auto-fit at 90px puts three across a 375px phone and degrades sensibly if a
 * product ever offers more periods. */
@media (max-width: 640px) {
  .vp-grid.vp-layout-row {
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
  }
  .vp-grid.vp-layout-row > * { min-width: 0; }

  /* The grid alone was not enough: .vp-opt is a horizontal card (icon | body |
     price + indicator) needing ~211px of content width, so in a 95px column it
     wrapped into a 216px-tall block with the price clipped by .vp-opt's
     overflow. At this width the card has to become a vertical tile. */
  .vp-grid.vp-layout-row .vp-opt {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 7px;
    padding: 12px 8px;
    border-radius: 13px;
  }

  .vp-grid.vp-layout-row .vp-opt-icon { width: 30px; height: 30px; border-radius: 9px; }
  .vp-grid.vp-layout-row .vp-opt-icon svg { width: 15px; height: 15px; }

  /* flex:1 would stretch these vertically once the card is a column. */
  .vp-grid.vp-layout-row .vp-opt-body { flex: 0 0 auto; width: 100%; }
  .vp-grid.vp-layout-row .vp-opt-title {
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12.5px;
    line-height: 1.5;
  }

  /* Every option carries the same description, so at this width it is four
     wrapped lines per card that distinguish nothing. */
  .vp-grid.vp-layout-row .vp-opt-desc { display: none; }

  .vp-grid.vp-layout-row .vp-opt-tail {
    width: 100%;
    min-width: 0;
    justify-content: center;
    flex-shrink: 1;
    gap: 0;
  }
  /* nowrap is what pushed the price past the card edge; a price only ever breaks
     before تومان, never inside the digits, so wrapping is safe here. */
  .vp-grid.vp-layout-row .vp-opt-price {
    font-size: 9.5px;
    padding: 3px 6px;
    max-width: 100%;
    white-space: normal;
    line-height: 1.5;
  }

  /* The check dot costs 18px of a 95px card and only repeats what the active
     border and glow already say. */
  .vp-grid.vp-layout-row .vp-indicator { display: none; }
}
