/* ═══════════════════════════════════════════════════════════════════════════
   LCH KIT BUILDER UI — Step cards + Popup thumbnail picker
   v1.1.3
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Hide native plugin layout IMMEDIATELY (no JS flash) ────────────────── */
/* Applied via stylesheet — before any JS fires — so the native layout        */
/* is never visible. Our JS reveals .lch-kit-builder after it builds the UI. */
.single-product.product-type-composite form.composite_form .composite_wrap,
.single-product.product-type-composite form.composite_form .composite_component,
.single-product.product-type-composite form.composite_form .component,
.single-product.product-type-composite form.composite_form .composite_navigation,
.single-product.product-type-composite form.composite_form .composite_pagination,
.single-product.product-type-composite form.composite_form .composite_price,
.single-product.product-type-composite form.composite_form .composite_availability,
.single-product.product-type-composite form.composite_form .composite_status,
.single-product.product-type-composite form.composite_form .composite_button,
.single-product.product-type-composite form.composite_form .composite_message {
  display: none !important;
}

/* ── Neutralize native related products section ─────────────────────────── */
.single-product.product-type-composite .related.products {
  display: none !important;
}

/* ── Our kit builder starts hidden; JS sets display:block when ready ─────── */
.lch-kit-builder {
  display: none;
}

/* ── Body scroll lock when modal open ───────────────────────────────────── */
body.lch-no-scroll { overflow: hidden; }

/* ═══════════════════════════════════════════════════════════════════════════
   KIT BUILDER SHELL
   ═══════════════════════════════════════════════════════════════════════════ */
.lch-kit-builder {
  width: 100%;
  font-family: 'Satoshi', 'Inter', sans-serif;
  color: var(--color-text, #e8e6e1);
  /* display set to flex by JS after build — starts as none (above) */
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.5rem;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.lch-kit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 1.2rem;
  background: rgba(204, 34, 0, .07);
  border: 1px solid rgba(204, 34, 0, .22);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.lch-kit-header__label {
  font-family: 'Clash Display', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-red, #CC2200);
}

.lch-kit-header__price-val {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-orange, #F07800);
  letter-spacing: .02em;
}

/* ── Steps list ──────────────────────────────────────────────────────────── */
.lch-kit-steps {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 0;
}

/* ── Single step card ────────────────────────────────────────────────────── */
.lch-kit-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: .85rem;
  padding: .85rem 1.1rem;
  background: #1a1a18 !important;
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: background .15s;
}

.lch-kit-step:last-child { border-bottom: none; }
.lch-kit-step:hover { background: rgba(255,255,255,.025); }

/* Number bubble */
.lch-kit-step__num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(240,120,0,.1);
  border: 1px solid rgba(240,120,0,.28);
  color: var(--color-orange, #F07800);
  font-family: 'Clash Display', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Body */
.lch-kit-step__body { min-width: 0; }

.lch-kit-step__head {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .4rem;
}

.lch-kit-step__title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(232,230,225,.5);
}

.lch-kit-step__badge {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .12rem .4rem;
  border-radius: 3px;
  background: rgba(240,120,0,.1);
  color: rgba(240,120,0,.65);
  border: 1px solid rgba(240,120,0,.18);
}

.lch-kit-step__badge--req {
  background: rgba(204,34,0,.1);
  color: rgba(255,80,60,.85);
  border-color: rgba(204,34,0,.22);
}


/* Qty badge in step header (pair indicator) */
.lch-kit-step__qty-badge {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .12rem .4rem;
  border-radius: 3px;
  background: rgba(255,204,0,.08);
  color: rgba(255,204,0,.8);
  border: 1px solid rgba(255,204,0,.2);
  white-space: nowrap;
}
/* Selection preview row */
.lch-kit-step__sel {
  display: flex;
  align-items: center;
  gap: .65rem;
  cursor: pointer;
}

.lch-kit-step__sel-img {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: #161614;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lch-kit-step__sel-img img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}

.lch-kit-step__sel-name {
  font-size: .85rem;
  color: var(--color-text, #e8e6e1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.lch-kit-step__sel-name--empty {
  color: rgba(232,230,225,.3);
  font-style: italic;
}

.lch-kit-step__sel-price {
  font-size: .75rem;
  color: var(--color-orange, #F07800);
  font-weight: 600;
  margin-top: .1rem;
}

/* Choose/Add/Change button */
.lch-kit-step__btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,.14);
  color: var(--color-text, #e8e6e1);
  border-radius: 5px;
  padding: .42rem .75rem;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
}

.lch-kit-step__btn:hover {
  border-color: var(--color-orange, #F07800);
  color: var(--color-orange, #F07800);
  background: rgba(240,120,0,.05);
}

/* ── Add-to-Cart block ───────────────────────────────────────────────────── */
.lch-kit-atc {
  border: 1px solid rgba(255,255,255,.08);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: var(--color-surface, #1a1a18);
  padding: 1rem 1.2rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.lch-kit-atc__msg {
  font-size: .75rem;
  color: rgba(232,230,225,.38);
  text-align: center;
}

.lch-kit-atc__btn {
  width: 100%;
  background: var(--color-red, #CC2200);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: .95rem 2rem;
  font-family: 'Clash Display', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, transform .1s, opacity .2s;
}

.lch-kit-atc__btn:hover:not(:disabled) {
  background: #e02600;
  transform: translateY(-1px);
}

.lch-kit-atc__btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.lch-kit-atc__note {
  font-size: .7rem;
  color: rgba(232,230,225,.28);
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.lch-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;          /* set via JS: flex */
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}

.lch-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 640px) {
  .lch-modal {
    align-items: center;
  }
}

.lch-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  cursor: pointer;
}

.lch-modal__panel {
  position: relative;
  z-index: 1;
  background: #1a1a18 !important;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -16px 48px rgba(0,0,0,.65);
  transform: translateY(20px);
  transition: transform .22s ease;
}

.lch-modal.is-open .lch-modal__panel {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .lch-modal__panel {
    border-radius: 14px;
    width: 90%;
    max-width: 840px;
    max-height: 80vh;
    transform: scale(.96);
    box-shadow: 0 24px 80px rgba(0,0,0,.75);
  }
  .lch-modal.is-open .lch-modal__panel {
    transform: scale(1);
  }
}

/* Modal header */
.lch-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.1rem 1.4rem .85rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.lch-modal__title {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text, #e8e6e1);
  line-height: 1.2;
}

.lch-modal__sub {
  font-size: .75rem;
  color: rgba(232,230,225,.4);
  margin-top: .2rem;
}

.lch-modal__close {
  background: transparent;
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(232,230,225,.5);
  cursor: pointer;
  padding: .35rem;
  border-radius: 5px;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 1rem;
}

.lch-modal__close:hover {
  color: var(--color-text, #e8e6e1);
  border-color: rgba(255,255,255,.25);
}

/* Modal scrollable grid */
.lch-modal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: .7rem;
  padding: 1rem 1.25rem 1.4rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

@media (min-width: 480px) {
  .lch-modal__grid {
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  }
}

/* ── Option card ─────────────────────────────────────────────────────────── */
.lch-modal__card {
  background: #0e0e0d !important;
  border: 2px solid rgba(255,255,255,.06);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, transform .12s, background .15s;
  user-select: none;
}

.lch-modal__card:hover {
  border-color: rgba(240,120,0,.55);
  transform: translateY(-2px);
  background: rgba(240,120,0,.04);
}

.lch-modal__card.is-sel {
  border-color: var(--color-orange, #F07800);
  background: rgba(240,120,0,.07);
}

/* Card image */
.lch-modal__card-img {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #161614;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lch-modal__card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}

.lch-modal__card:hover .lch-modal__card-img img {
  transform: scale(1.05);
}

.lch-modal__card-img--none { background: #111110; }

/* Card text */
.lch-modal__card-name {
  padding: .5rem .65rem .2rem;
  font-size: .92rem;
  font-weight: 600;
  color: var(--color-text, #e8e6e1);
  line-height: 1.35;
}

.lch-modal__card-hint {
  padding: 0 .65rem .2rem;
  font-size: .78rem;
  color: rgba(232,230,225,.38);
  line-height: 1.3;

.lch-modal__card-price {
  padding: 0 .65rem .7rem;
  font-size: .98rem;
  font-weight: 700;
  color: var(--color-orange, #F07800);
}

/* Checkmark badge */
.lch-modal__card-chk {
  position: absolute;
  top: .45rem;
  right: .45rem;
  width: 20px;
  height: 20px;
  background: var(--color-orange, #F07800);
  color: #000;
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}

/* ── Mobile tweaks ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .lch-kit-step { gap: .6rem; padding: .7rem .85rem; }
  .lch-kit-step__sel-name { max-width: 150px; font-size: .8rem; }
  .lch-kit-step__btn { padding: .38rem .6rem; font-size: .7rem; }
  .lch-modal__grid { grid-template-columns: repeat(2, 1fr); gap: .55rem; padding: .75rem .9rem 1rem; }
}

/* ── Force dark theme on all modal and builder elements ── */
#lch-modal, .lch-modal { background: transparent !important; }
#lch-modal-panel, .lch-modal__panel {
  background: #1a1a18 !important;
  color: #e8e6e1 !important;
}
.lch-modal__head { background: #1a1a18 !important; }
.lch-modal__grid { background: #1a1a18 !important; }
.lch-modal__card { background: #0e0e0d !important; color: #e8e6e1 !important; }
.lch-modal__card-name { color: #e8e6e1 !important; }
.lch-modal__card-hint { color: rgba(232,230,225,.42) !important; }
.lch-modal__card-price { color: #F07800 !important; }
.lch-modal__title { color: #e8e6e1 !important; }
.lch-modal__sub { color: rgba(232,230,225,.42) !important; }
.lch-kit-builder, #lch-kit-builder { background: transparent !important; color: #e8e6e1 !important; }

/* Qty breakdown row in modal card (e.g. "2 × $175 ea.") */
.lch-modal__card-qty {
  padding: 0 .65rem .1rem;
  font-size: .76rem;
  color: rgba(232,230,225,.42);
  line-height: 1.3;
}
.lch-kit-step { background: #1a1a18 !important; color: #e8e6e1 !important; }
.lch-kit-atc { background: #1a1a18 !important; }
.lch-kit-header { background: rgba(204,34,0,.07) !important; }

/* ── HARD KILL: all native plugin UI on composite pages ── */
.single-product.product-type-composite .composite_form .composite_wrap,
.single-product.product-type-composite .composite_form .composite_navigation,
.single-product.product-type-composite .composite_form .composite_pagination,
.single-product.product-type-composite .composite_form .component_wrap,
.single-product.product-type-composite .composite_form .component,
.single-product.product-type-composite .composite_form .step_title_wrapper,
.single-product.product-type-composite .composite_form .component_inner,
.single-product.product-type-composite .composite_form .composite_price,
.single-product.product-type-composite .composite_form .composite_availability,
.single-product.product-type-composite .composite_form .composite_message,
.single-product.product-type-composite .composite_form .composite_button,
.single-product.product-type-composite .composite_form > .composite_wrap,
.single-product.product-type-composite .composite_form > .component,
.single-product.product-type-composite .composite_form > .composite_navigation,
.single-product.product-type-composite .composite_form > .composite_price,
.single-product.product-type-composite .composite_form > .composite_availability,
.single-product.product-type-composite .composite_form > .composite_message,
.single-product.product-type-composite .composite_form > .composite_status,
.single-product.product-type-composite .composite_form > .composite_button {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
.single-product.product-type-composite .related.products { display: none !important; }
