/* Phase 03-A/03-C (v2 — 폭 일치 + 행 슬림화) — Common Purchase Selection.
   Golden Reference (NAVER_COMMON_PURCHASE_SELECTION_PHASE_03C 최종 작업지시서):
   - Selected Items 외곽 폭은 옵션 radio 목록 폭과 실측 일치(JS로 측정/정렬, see
     common-purchase-selection.js#alignRootWidthToRadioGroup).
   - 한 행은 72~80px 수준의 슬림한 두 줄 구조(옵션명/X, 수량/lineTotal).
   - 흰 배경 카드 컨테이너, 연회색(#f6f8fb) 행, 얇은 hairline 구분선.
   - 강조 red는 사이트 기존 세일가 색상(#e14a5c, 실측 재사용 — FINAL_REPORT
     §"red 토큰" 참고)을 그대로 사용, 신규 색상 도입 없음. */

.okgs-cps-root {
  margin: 8px 0 16px;
  border: 1px solid #d5dbe1;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-sizing: border-box;
}

.okgs-cps-root[hidden] {
  display: none !important;
}

/* NAVER_TYPE02_GOLDEN_1884_PARITY_FIX: forces WooCommerce's native quantity
   input (and add-to-cart/buy-now buttons) in `.woocommerce-variation-add-to-cart`
   (flex-wrap:wrap) onto their own row below the card, regardless of how much
   left-over horizontal space the card's own (picker-width-matched) size
   leaves on its line. See insertType02RowBreak() in common-purchase-selection.js. */
.okgs-cps-row-break {
  flex: 1 0 100%;
  width: 100%;
  height: 0;
  margin: 0;
  padding: 0;
}

/* NAVER_OPTION_UI_ORIGINAL_PARITY_PHASE_02B — base option section title above
   table.variations. Reuses add-on heading typography tokens; required * is a
   separate element (not embedded in the title string). */
.okgs-cps-base-options__heading-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 10px;
}

.okgs-cps-base-options__heading {
  font-size: 15px;
  font-weight: 600;
  color: #121212;
}

.okgs-cps-base-options__required {
  font-size: 15px;
  font-weight: 600;
  color: #e14a5c;
}

/* Select-mode TYPE_02 (6+ options, native visible <select>): stack attribute
   label above the value cell so long option titles do not shrink the Selected
   Item card width. Radio mode (1-5) keeps the side-by-side variations table. */
form.variations_form table.variations tr:has(
  select[name^="attribute_"]:not(.okgs-t02-select--visually-hidden)
) {
  display: block;
}

form.variations_form table.variations tr:has(
  select[name^="attribute_"]:not(.okgs-t02-select--visually-hidden)
) th.label,
form.variations_form table.variations tr:has(
  select[name^="attribute_"]:not(.okgs-t02-select--visually-hidden)
) td.value {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

form.variations_form table.variations tr:has(
  select[name^="attribute_"]:not(.okgs-t02-select--visually-hidden)
) th.label:not(.okgs-cps-visually-hidden) {
  padding-bottom: 6px;
}

/* NAVER_OPTION_UI_ORIGINAL_PARITY_PHASE_02A: Naver picker rows keep th.label in
   DOM for label[for] a11y but remove its layout gap once JS hides it. */
form.variations_form table.variations tr:has(.okgs-naver-select) th.label.okgs-cps-visually-hidden {
  padding: 0 !important;
  margin: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
}

form.variations_form table.variations tr:has(
  select[name^="attribute_"]:not(.okgs-t02-select--visually-hidden)
) select[name^="attribute_"] {
  width: 100%;
  max-width: 100%;
}

.okgs-cps-items {
  display: flex;
  flex-direction: column;
}

.okgs-cps-toast {
  padding: 10px 16px;
  background: #fff4f2;
  border-bottom: 1px solid #d5dbe1;
  color: #b3394a;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.okgs-cps-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  background: #f6f8fb;
  border-bottom: 1px solid #d5dbe1;
  box-sizing: border-box;
}

.okgs-cps-card:last-child {
  border-bottom: none;
}

.okgs-cps-card__row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.okgs-cps-card__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: #111;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* !important below overrides WoodMart's global button reset
   (:is(.btn, .button, button, [type="button"]) in theme base.css), which
   otherwise stamps every <button> with a #F3F3F3 background and
   min-height:42px — exactly the "big gray box" / bloated-row look this
   work order (§7, §4) forbids. */
.okgs-cps-card__remove {
  position: relative;
  flex: 0 0 auto;
  margin: 0;
  padding: 2px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #222 !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
  min-height: 0 !important;
  height: auto !important;
  text-transform: none !important;
  gap: 0 !important;
  cursor: pointer;
}

.okgs-cps-card__remove:hover {
  color: #000 !important;
}

/* Enlarge the tap target invisibly (absolute, out of flow) instead of
   growing the button's own box, which would re-inflate the row height. */
.okgs-cps-card__remove::before {
  content: "";
  position: absolute;
  inset: -10px;
}

.okgs-cps-card__row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.okgs-cps-qty {
  display: inline-flex;
  align-items: stretch;
  height: 34px;
  border: 1px solid #d3dae2;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  flex: 0 0 auto;
}

.okgs-cps-qty__btn {
  width: 40px;
  height: auto;
  min-height: 0 !important;
  border: none !important;
  border-left: 1px solid #d3dae2 !important;
  border-radius: 0 !important;
  background: #fff !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  color: #333 !important;
  text-transform: none !important;
  gap: 0 !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.okgs-cps-qty__btn--minus {
  border-left: none !important;
}

.okgs-cps-qty__btn:disabled {
  color: #cbd1d7 !important;
  background: #fff !important;
  cursor: default;
}

.okgs-cps-qty__value {
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #d3dae2;
  font-size: 15px;
  font-weight: 700;
  color: #111;
}

.okgs-cps-card__line-total {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  text-align: right;
  white-space: nowrap;
}

.okgs-cps-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 15px 16px;
  background: #fff;
}

.okgs-cps-summary__qty {
  font-size: 15px;
  font-weight: 700;
  color: #111;
}

.okgs-cps-summary__qty-value {
  color: #e14a5c;
  font-weight: 800;
}

.okgs-cps-summary__total-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.okgs-cps-summary__total-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
}

.okgs-cps-summary__info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border: 1px solid #b7bfc8;
  border-radius: 50%;
  font-size: 10px;
  font-style: normal;
  color: #9aa3ad;
  line-height: 1;
}

.okgs-cps-summary__total-value {
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  color: #e14a5c;
  white-space: nowrap;
}

.okgs-cps-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* NAVER_SELECT_DROPDOWN_VISUAL_PARITY_PHASE_01
   Every color/spacing/radius token below is a live measurement of Naver's
   own opened option dropdown (shopping.naver.com/logistics/products/5597975808
   — the exact source product behind our #2157), captured via computed-style
   probe, not an approximation:
     - header (closed): #fff bg, 1px solid #d3dadf border, 8px radius,
       #121212 text, 15px/700, padding 0 35px 0 15px, height 44px
     - header (open): border-color #949494 (top/sides) / #e8ecef (bottom
       seam into panel), radius flattens to 8px 8px 0 0
     - panel: #f8f9fd bg, 1px solid #949494 (sides+bottom only), 0 0 8px 8px
       radius, no shadow
     - row: 11px 15px padding, 14px/500, #000 text (#949494 when sold out/
       unavailable), 1px solid #f1f4f6 divider between rows
     - checkbox glyph: 20x20, 2px solid #e8ecef border, 4px radius
     - internal scroll: max-height ~303px (≈ Naver's own clipped height)
   Applies identically to every native attribute <select> this module
   enhances (TYPE_02 Select's one select, TYPE_03 select_2's two selects,
   any future tier) — one shared component, no per-TYPE styling. */
.okgs-naver-select {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}

.okgs-naver-select__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 44px;
  padding: 0 35px 0 15px;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #d3dadf;
  border-radius: 8px;
  color: #121212;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.okgs-naver-select--open .okgs-naver-select__toggle {
  border-color: #949494 #949494 #e8ecef #949494;
  border-radius: 8px 8px 0 0;
}

.okgs-naver-select__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.okgs-naver-select__chevron {
  position: absolute;
  right: 15px;
  top: 50%;
  margin-top: -8px;
  color: #121212;
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}

.okgs-naver-select--open .okgs-naver-select__chevron {
  transform: rotate(180deg);
}

.okgs-naver-select__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  background: #f8f9fd;
  border: 1px solid #949494;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: none;
  overflow: hidden;
}

.okgs-naver-select__list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 303px;
  overflow-y: auto;
}

.okgs-naver-select__row {
  border-top: 1px solid #f1f4f6;
}

.okgs-naver-select__row:first-child {
  border-top: none;
}

.okgs-naver-select__option {
  display: flex;
  align-items: center;
  padding: 11px 15px;
  color: #000;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.okgs-naver-select__option--disabled {
  color: #949494;
  cursor: default;
}

.okgs-naver-select__box {
  display: inline-block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0 5px 0 1px;
  border: 2px solid #e8ecef;
  border-radius: 4px;
  background: #fff;
  box-sizing: border-box;
}

/* Slim scrollbar: light track, mid-gray thumb, not overly thick (§5).
   Webkit-only; other engines fall back to their own default thin scrollbar
   with no functional impact. */
.okgs-naver-select__list::-webkit-scrollbar {
  width: 6px;
}

.okgs-naver-select__list::-webkit-scrollbar-track {
  background: transparent;
}

.okgs-naver-select__list::-webkit-scrollbar-thumb {
  background: #d3dadf;
  border-radius: 3px;
}

@media (max-width: 480px) {
  .okgs-cps-card {
    padding: 8px 12px;
    gap: 3px;
  }

  .okgs-cps-toast {
    padding: 9px 12px;
    font-size: 12px;
  }

  .okgs-cps-card__title {
    font-size: 14px;
  }

  .okgs-cps-qty {
    height: 34px;
  }

  .okgs-cps-qty__btn {
    width: 34px;
    font-size: 14px !important;
  }

  .okgs-cps-qty__value {
    width: 40px;
    font-size: 14px;
  }

  .okgs-cps-card__line-total {
    font-size: 15px;
  }

  .okgs-cps-summary {
    padding: 12px 12px;
    gap: 8px;
  }

  .okgs-cps-summary__total-value {
    font-size: 21px;
  }

  .okgs-naver-select__toggle {
    height: 42px;
    font-size: 14px;
    padding: 0 32px 0 12px;
  }

  .okgs-naver-select__chevron {
    right: 12px;
  }

  .okgs-naver-select__option {
    padding: 10px 12px;
    font-size: 13px;
  }

  .okgs-naver-select__box {
    width: 18px;
    height: 18px;
  }
}

/* OKGS_BUY_NOW_SPINNER_VISIBLE_PHASE_08 — WoodMart 8.5.5 mirrors
   woo-single-prod-el-add-to-cart.min.css cart spinner onto buy-now only. */
form.cart .wd-buy-now-btn {
  position: relative;
}

form.cart .wd-buy-now-btn:before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 1;
  border-radius: inherit;
  background-color: inherit;
  box-shadow: inherit;
  transition: opacity 0s ease;
}

form.cart .wd-buy-now-btn:after {
  position: absolute;
  top: calc(50% - 9px);
  inset-inline-start: calc(50% - 9px);
  opacity: 0;
  z-index: 2;
  transition: opacity 0s ease;
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(0, 0, 0, 0);
  border-left-color: currentColor;
  border-radius: 50%;
  vertical-align: middle;
  animation: wd-rotate 450ms infinite linear var(--wd-anim-state, paused);
}

form.cart .wd-buy-now-btn.loading:before {
  opacity: 1;
  transition: opacity 0.25s ease;
}

form.cart .wd-buy-now-btn.loading:after {
  opacity: 1;
  transition: opacity 0.25s ease;
  --wd-anim-state: running;
}

/* OKGS_OPTION_UI_INITIAL_FLASH_FIX_PHASE_06 — clip hide (not display:none) while
   body.okgs-cps-pending* is set from PHP allowlist TYPE_01/02/03/05 only. */

body.okgs-cps-pending.okgs-cps-pending--hide-qty form.cart .quantity,
body.okgs-cps-pending.okgs-cps-pending--hide-qty
  .woocommerce-variation-add-to-cart
  .quantity {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body.okgs-cps-pending.okgs-cps-pending--hide-native-select
  form.variations_form
  table.variations
  select[name^="attribute_"]:not(.okgs-cps-visually-hidden):not([data-okgs-naver-picker="1"]) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
