/* Barkat Swatches & Add-ons. Colours and sizes come from CSS variables set in the plugin settings. */
:root {
  --bks-border: #d9d4ca; --bks-border-w: 1px; --bks-radius: 10px; --bks-bg: #fff; --bks-text: #1f1a17;
  --bks-hover: #b9a78a; --bks-sel-border: #9b0000; --bks-sel-bg: #fff5f2; --bks-sel-text: #9b0000;
  --bks-accent: #9b0000; --bks-price: #6f6262; --bks-pad: 9px 14px; --bks-dot: 34px; --bks-font: 14px; --bks-cols: 2;
}

/* The WooCommerce select stays in the page (hidden) so everything that listens to it still works. */
.bks-wrap select[data-bks] { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip: rect(0 0 0 0); }
.bks-wrap { position: relative; }

/* Variation table laid out as label above swatches. */
table.variations.bks-table, table.variations.bks-table tbody, table.variations.bks-table tr, table.variations.bks-table th, table.variations.bks-table td { display: block; width: 100%; border: 0; padding: 0; background: none; }
table.variations.bks-table tr { margin: 0 0 16px; }
/* Same layout before the script runs (and in editor previews). */
table.variations:has(.bks-wrap), table.variations:has(.bks-wrap) tbody, table.variations:has(.bks-wrap) tr, table.variations:has(.bks-wrap) th, table.variations:has(.bks-wrap) td { display: block; width: 100%; border: 0; padding: 0; background: none; }
table.variations:has(.bks-wrap) tr { margin: 0 0 16px; }
table.variations:has(.bks-wrap) th.label { margin: 0 0 8px; text-align: left; }
table.variations.bks-table th.label, table.variations.bks-table td.label { margin: 0 0 8px; text-align: left; }
table.variations.bks-table th.label label { font-weight: 700; }
table.variations.bks-table .reset_variations { display: inline-block; margin-top: 8px; font-size: 13px; }
.bks-chosen { font-weight: 400; color: var(--bks-price); }

/* ---------- shared swatch look ---------- */
.bks-swatches, .bks-group__opts { display: flex; flex-wrap: wrap; gap: 8px; }
.bks-layout-stacked { flex-direction: column; }
.bks-layout-grid { display: grid; grid-template-columns: repeat(var(--bks-cols), minmax(0, 1fr)); }

.bks-swatch, .bks-opt {
  position: relative; display: inline-flex; align-items: center; gap: 10px; margin: 0;
  padding: var(--bks-pad); min-height: 40px; box-sizing: border-box;
  font: inherit; font-size: var(--bks-font); line-height: 1.25; text-align: left; text-transform: none; letter-spacing: normal;
  color: var(--bks-text); background: var(--bks-bg);
  border: var(--bks-border-w) solid var(--bks-border); border-radius: var(--bks-radius);
  box-shadow: none; cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s, color .15s;
  -webkit-appearance: none; appearance: none;
}
.bks-swatch:hover, .bks-opt:hover { border-color: var(--bks-hover); background: var(--bks-bg); color: var(--bks-text); }
.bks-swatch:focus-visible, .bks-opt:focus-within { outline: 2px solid var(--bks-accent); outline-offset: 2px; }
.bks-swatch.is-selected, .bks-opt.is-selected, .bks-opt:has(input:checked) {
  border-color: var(--bks-sel-border); background: var(--bks-sel-bg); color: var(--bks-sel-text);
  box-shadow: 0 0 0 1px var(--bks-sel-border) inset;
}
.bks-layout-stacked .bks-swatch, .bks-layout-stacked .bks-opt, .bks-layout-grid .bks-swatch, .bks-layout-grid .bks-opt { width: 100%; }

.bks-text { display: inline-flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bks-layout-inline .bks-text { flex-direction: row; align-items: baseline; gap: 8px; }
.bks-name { font-weight: 600; }
.bks-price { font-size: .88em; color: var(--bks-price); font-weight: 500; white-space: nowrap; }
.bks-layout-stacked .bks-text, .bks-layout-grid .bks-text { flex-direction: row; justify-content: space-between; align-items: baseline; }
.bks-price:empty { display: none; }
.is-selected .bks-price { color: inherit; opacity: .85; }

/* radio dot */
.bks-radio, .bks-check { flex: none; width: 18px; height: 18px; border: 2px solid var(--bks-border); background: #fff; box-sizing: border-box; display: inline-grid; place-items: center; transition: border-color .15s, background .15s; }
.bks-radio { border-radius: 50%; }
.bks-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bks-accent); transform: scale(0); transition: transform .15s; }
.is-selected .bks-radio, .bks-opt:has(input:checked) .bks-radio { border-color: var(--bks-accent); }
.is-selected .bks-radio::after, .bks-opt:has(input:checked) .bks-radio::after { transform: scale(1); }
/* checkbox tick */
.bks-check { border-radius: 4px; }
.bks-check::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); margin-top: -2px; transition: transform .15s; }
.is-selected .bks-check, .bks-opt:has(input:checked) .bks-check { background: var(--bks-accent); border-color: var(--bks-accent); }
.is-selected .bks-check::after, .bks-opt:has(input:checked) .bks-check::after { transform: rotate(45deg) scale(1); }

/* colour and image */
.bks-type-color .bks-swatch, .bks-type-image .bks-swatch { flex-direction: column; gap: 6px; padding: 6px; min-width: calc(var(--bks-sw-w, var(--bks-dot)) + 14px); text-align: center; }
.bks-type-color .bks-text, .bks-type-image .bks-text { flex-direction: column; align-items: center; gap: 0; }
.bks-dot { display: block; width: var(--bks-sw-w, var(--bks-dot)); height: var(--bks-sw-h, var(--bks-dot)); border-radius: var(--bks-dot-r, 50%); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.bks-img { display: block; width: var(--bks-img-w, calc(var(--bks-dot) * 1.6)); height: var(--bks-img-h, calc(var(--bks-dot) * 1.6)); border-radius: var(--bks-img-r, calc(var(--bks-radius) * .7)); overflow: hidden; }
.bks-img img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0 !important; }
.bks-type-color .bks-name, .bks-type-image .bks-name { font-weight: 500; font-size: .9em; }
.bks-type-color .bks-swatch.is-selected, .bks-type-image .bks-swatch.is-selected { box-shadow: 0 0 0 2px var(--bks-sel-border) inset; }

/* unavailable */
.bks-swatch.is-disabled { cursor: not-allowed; opacity: .45; }
[data-unavailable="cross"] .bks-swatch.is-disabled { background-image: linear-gradient(to top right, transparent calc(50% - 1px), rgba(155,0,0,.55) 50%, transparent calc(50% + 1px)); }
[data-unavailable="hide"] .bks-swatch.is-disabled, [data-unavailable="hide"] .bks-swatch.is-unattached { display: none; }
.bks-swatch.is-unattached { opacity: .55; }

.screen-reader-text.bks-name { position: absolute !important; clip: rect(1px,1px,1px,1px); width: 1px; height: 1px; overflow: hidden; }

/* ---------- add-ons ---------- */
.bks-addons { margin: 4px 0 18px; clear: both; width: 100%; }
.bks-group { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.bks-group__title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; width: 100%; padding: 0; margin: 0 0 8px; font-weight: 700; font-size: 1em; }
.bks-group__rule { font-weight: 400; font-size: .85em; color: var(--bks-price); }
.bks-group__req { margin-left: auto; font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 99px; background: var(--bks-sel-bg); color: var(--bks-sel-text); }
.bks-group__desc { margin: -4px 0 8px; font-size: .9em; color: var(--bks-price); }
.bks-group__err { margin: 6px 0 0; color: #b42318; font-size: .88em; font-weight: 600; }
.bks-group.has-error .bks-opt, .bks-group.has-error select { border-color: #b42318; }
.bks-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.bks-opt.is-disabled { opacity: .45; cursor: not-allowed; }
.bks-opt--button .bks-text { flex-direction: row; gap: 8px; }
.bks-addon-select { width: 100%; min-height: 44px; padding: 0 12px; border: var(--bks-border-w) solid var(--bks-border); border-radius: var(--bks-radius); background: var(--bks-bg); color: var(--bks-text); font: inherit; }
.bks-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-top: 4px; border-radius: var(--bks-radius); background: var(--bks-sel-bg); color: var(--bks-text); }
.bks-total__amount { font-size: 1.15em; color: var(--bks-sel-text); }
.bks-total.is-empty { display: none; }

/* ---------- shapes (Colour / image shape) ---------- */
.bks-shape-circle .bks-type-color .bks-swatch, .bks-shape-circle .bks-type-image .bks-swatch { border-radius: 999px; }
.bks-shape-circle .bks-type-color .bks-swatch:has(.bks-name.screen-reader-text), .bks-shape-circle .bks-type-image .bks-swatch:has(.bks-name.screen-reader-text) { border-radius: 50%; }
.bks-shape-square .bks-type-color .bks-swatch, .bks-shape-square .bks-type-image .bks-swatch { border-radius: 0; }
/* inset: a gap between the colour / picture and its border */
.bks-inset .bks-dot, .bks-inset .bks-img { box-shadow: 0 0 0 3px var(--bks-bg), 0 0 0 4px var(--bks-border); margin: 4px; }
.bks-inset .bks-type-color .bks-swatch, .bks-inset .bks-type-image .bks-swatch { border-color: transparent; box-shadow: none; background: transparent; }
.bks-inset .bks-swatch.is-selected .bks-dot, .bks-inset .bks-swatch.is-selected .bks-img { box-shadow: 0 0 0 3px var(--bks-bg), 0 0 0 5px var(--bks-sel-border); }

/* ---------- tooltips ---------- */
.bks-tip { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: #1f1a17; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .15s, transform .15s, visibility .15s; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.bks-tip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #1f1a17; }
.bks-tip.has-img { padding: 6px; }
.bks-tip img { display: block; width: 110px; height: 110px; object-fit: cover; border-radius: 5px; margin: 0 !important; }
.bks-swatch:hover .bks-tip, .bks-swatch:focus-visible .bks-tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
@media (hover: none) { .bks-tip { display: none; } }

/* ---------- unavailable: blurred and crossed out ---------- */
[data-unavailable="blurcross"] .bks-swatch.is-disabled { filter: blur(.6px); opacity: .5; background-image: linear-gradient(to top right, transparent calc(50% - 1px), rgba(155,0,0,.65) 50%, transparent calc(50% + 1px)); }
.bks-soldout { font-weight: 600; }

/* ---------- shop / category pages ---------- */
.bks-loop { margin: 8px 0 10px; text-align: left; position: relative; z-index: 2; }
.bks-loop table.variations, .bks-loop table.variations tbody, .bks-loop table.variations tr, .bks-loop table.variations th, .bks-loop table.variations td { display: block; width: 100%; border: 0; padding: 0; margin: 0; background: none; }
.bks-loop table.variations tr, .bks-loop table.variations.bks-table tr { margin: 0 0 6px; }
.bks-loop table.variations.bks-table th.label { margin: 0 0 4px; }
.bks-loop .reset_variations[style*="hidden"] { display: none !important; }
.bks-loop table.variations th.label { margin: 0 0 4px; font-size: 12px; font-weight: 600; }
.bks-loop .bks-swatches { gap: 5px; }
.bks-loop .bks-swatch { min-height: 30px; padding: 4px 9px; font-size: 12px; gap: 6px; }
.bks-loop .bks-type-color .bks-swatch, .bks-loop .bks-type-image .bks-swatch { padding: 3px; min-width: 0; }
.bks-loop .bks-dot { width: calc(var(--bks-sw-w, var(--bks-dot)) * .72); height: calc(var(--bks-sw-h, var(--bks-dot)) * .72); }
.bks-loop .bks-img { width: calc(var(--bks-img-w, 48px) * .6); height: calc(var(--bks-img-h, 48px) * .6); }
.bks-loop .bks-price { display: none; }
.bks-loop .bks-chosen { display: none; }
.bks-loop .reset_variations { display: inline-block; margin: 4px 0 0; font-size: 12px; }
.bks-loop .single_variation { display: none !important; }
.bks-loop .variations_button { margin-top: 8px; }
.bks-loop .bks-loop-add { width: auto; }
.bks-loop .bks-loop-add.disabled { opacity: .55; cursor: not-allowed; }
.bks-align-center, .bks-align-center .bks-swatches { text-align: center; justify-content: center; }
.bks-align-right, .bks-align-right .bks-swatches { text-align: right; justify-content: flex-end; }
.bks-swatch.is-extra { display: none; }
.bks-more { display: inline-flex; align-items: center; min-height: 30px; padding: 0 6px; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--bks-text); }
.bks-more.is-icon { width: 30px; justify-content: center; border: var(--bks-border-w) dashed var(--bks-border); border-radius: var(--bks-radius); font-size: 16px; }
.bks-hide-view + .added_to_cart, .bks-hide-view .added_to_cart { display: none !important; }
.bks-catalog .bks-swatch { cursor: pointer; }

/* ---------- theme guard ----------
 * Some themes (e.g. Twenty Twenty-One) style every <button> with very specific selectors.
 * :is(#bks-guard, *) gives these rules ID-level weight without changing what they match. */
.bks-swatches button.bks-swatch:is(#bks-guard, *) { background: var(--bks-bg); color: var(--bks-text); border: var(--bks-border-w) solid var(--bks-border); border-radius: var(--bks-radius); text-decoration: none; font-weight: inherit; }
.bks-swatches button.bks-swatch:is(#bks-guard, *):hover { border-color: var(--bks-hover); background: var(--bks-bg); color: var(--bks-text); }
.bks-swatches button.bks-swatch.is-selected:is(#bks-guard, *) { border-color: var(--bks-sel-border); background: var(--bks-sel-bg); color: var(--bks-sel-text); }
.bks-inset .bks-type-color button.bks-swatch:is(#bks-guard, *), .bks-inset .bks-type-image button.bks-swatch:is(#bks-guard, *) { border-color: transparent; background: transparent; }
.bks-swatches button.bks-swatch:is(#bks-guard, *):focus-visible { outline: 2px solid var(--bks-accent); outline-offset: 2px; }

/* Mix and match (pick N, repeats allowed): same option look, with a counter */
.bks-mix { display: grid; gap: 8px; }
.bks-mixrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: var(--bks-pad); min-height: 40px; box-sizing: border-box;
  font-size: var(--bks-font); color: var(--bks-text); background: var(--bks-bg);
  border: var(--bks-border-w) solid var(--bks-border); border-radius: var(--bks-radius); transition: border-color .15s, background-color .15s;
}
.bks-mixrow.is-selected { border-color: var(--bks-sel-border); background: var(--bks-sel-bg); color: var(--bks-sel-text); box-shadow: 0 0 0 1px var(--bks-sel-border) inset; }
.bks-step { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.bks-step__btn {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1px solid var(--bks-border); background: var(--bks-bg); color: var(--bks-text);
  font-size: 18px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.bks-step__btn:hover:not(:disabled) { border-color: var(--bks-hover); }
.bks-step__btn:disabled { opacity: .35; cursor: not-allowed; }
.bks-step__n { width: 2.2em; padding: 0; border: 0; background: transparent; text-align: center; font: inherit; font-weight: 700; color: inherit; -moz-appearance: textfield; appearance: textfield; }
.bks-step__n::-webkit-outer-spin-button, .bks-step__n::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bks-mixprog { margin: 0 0 8px; font-size: .9em; color: var(--bks-text); opacity: .8; }
.bks-mixprog__n { font-weight: 800; }
.bks-mixprog.is-done { color: #1a7f37; opacity: 1; }
