/**
 * Cohort selector on the product page.
 *
 * Uses the theme's --lp-* custom properties with hard fallbacks, so the plugin
 * still looks reasonable if it is ever used with a different theme.
 */

.lp-cohort-selector {
  margin: 0 0 28px;
}

.lp-cs-head {
  margin-bottom: 16px;
}

.lp-cs-title {
  margin: 0 0 6px;
  color: var(--lp-green-900, #104734);
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.lp-cs-lead {
  max-width: 52ch;
  margin: 0;
  color: var(--lp-muted, #607068);
  font-size: 14px;
  line-height: 1.55;
}

/* --- Grid ---------------------------------------------------------------- */

.lp-cs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: 12px;
}

/* --- Card ---------------------------------------------------------------- */

.lp-cs-card {
  position: relative;
  display: block;
  cursor: pointer;
  border-radius: var(--lp-radius, 16px);
}

.lp-cs-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  margin: -1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.lp-cs-card-inner {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 16px 16px 14px;
  border: 1.5px solid var(--lp-border, #dde6de);
  border-radius: var(--lp-radius, 16px);
  background: var(--lp-white, #fff);
  box-shadow: var(--lp-shadow-sm, 0 8px 24px rgba(13, 59, 44, 0.06));
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background-color .18s ease;
}

.lp-cs-card:hover:not(.is-sold-out) .lp-cs-card-inner {
  border-color: var(--lp-green-700, #1d684f);
  transform: translateY(-2px);
  box-shadow: var(--lp-shadow, 0 20px 54px rgba(13, 59, 44, 0.10));
}

.lp-cs-card.is-active .lp-cs-card-inner {
  border-color: var(--lp-green-800, #14543f);
  background: var(--lp-green-050, #f5f9f5);
  box-shadow: 0 0 0 3px rgba(20, 84, 63, .12), var(--lp-shadow-sm, 0 8px 24px rgba(13, 59, 44, 0.06));
}

/* Keyboard focus has to be visible on the card, not on the hidden radio. */
.lp-cs-radio:focus-visible + .lp-cs-card-inner {
  outline: 3px solid var(--lp-gold, #f0b642);
  outline-offset: 2px;
}

.lp-cs-card.is-sold-out {
  cursor: not-allowed;
}

.lp-cs-card.is-sold-out .lp-cs-card-inner {
  background: #fbfbf8;
  box-shadow: none;
  opacity: .62;
}

/* --- Card head ----------------------------------------------------------- */

.lp-cs-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.lp-cs-level {
  display: inline-flex;
  min-width: 34px;
  height: 22px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--lp-green-100, #edf5ef);
  color: var(--lp-green-800, #14543f);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .02em;
}

.lp-cs-label {
  flex: 1;
  min-width: 0;
  color: var(--lp-ink, #17251f);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
}

/* Radio indicator, drawn as a circle that fills with a checkmark when active */
.lp-cs-check {
  position: relative;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1.5px solid var(--lp-border, #dde6de);
  border-radius: 50%;
  background: #fff;
  transition: border-color .18s ease, background-color .18s ease;
}

.lp-cs-card.is-active .lp-cs-check {
  border-color: var(--lp-green-800, #14543f);
  background: var(--lp-green-800, #14543f);
}

.lp-cs-card.is-active .lp-cs-check::after {
  position: absolute;
  top: 4px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(43deg);
}

.lp-cs-card.is-sold-out .lp-cs-check {
  display: none;
}

/* --- Detail rows --------------------------------------------------------- */

.lp-cs-rows {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
}

.lp-cs-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.lp-cs-row-label {
  flex: 0 0 42px;
  color: var(--lp-muted, #607068);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.lp-cs-row-value {
  flex: 1;
  min-width: 0;
  color: var(--lp-ink, #17251f);
  font-weight: 650;
}

.lp-cs-row--clock .lp-cs-row-value {
  font-variant-numeric: tabular-nums;
}

/* --- Card foot ----------------------------------------------------------- */

.lp-cs-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--lp-border, #dde6de);
}

.lp-cs-stock {
  color: var(--lp-muted, #607068);
  font-size: 12px;
  font-weight: 700;
}

.lp-cs-stock.is-low {
  color: #a8650f;
}

.lp-cs-stock.is-low::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--lp-gold, #f0b642);
  content: "";
  vertical-align: middle;
}

.lp-cs-stock.is-full {
  color: var(--lp-danger, #b7443e);
}

.lp-cs-price {
  color: var(--lp-green-900, #104734);
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
}

.lp-cs-price del {
  margin-right: 5px;
  color: var(--lp-muted, #607068);
  font-size: 12px;
  font-weight: 600;
  opacity: .8;
}

.lp-cs-price ins {
  background: none;
  text-decoration: none;
}

/* Screen-reader-only price labels WooCommerce injects. */
.lp-cs-price .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
}

/* --- Hints --------------------------------------------------------------- */

.lp-cs-hint {
  margin: 14px 0 0;
  color: var(--lp-muted, #607068);
  font-size: 13px;
  font-weight: 650;
}

.lp-cs-hint[hidden] {
  display: none;
}

.lp-cs-all-full {
  padding: 14px 16px;
  border: 1px solid #eadfc9;
  border-radius: var(--lp-radius-sm, 10px);
  margin: 14px 0 0;
  background: var(--lp-gold-soft, #fff2cf);
  color: #6a4a12;
  font-size: 13px;
  line-height: 1.5;
}

/* --- WooCommerce integration --------------------------------------------- */

/*
 * Only hidden once the JS has confirmed the cards are wired up, so the original
 * dropdown stays usable if the script fails to load.
 */
.variations_form.lp-has-cohort-cards .variations,
.variations_form.lp-has-cohort-cards .reset_variations {
  display: none;
}

.variations_form.lp-has-cohort-cards .single_variation_wrap {
  margin-top: 4px;
}

.variations_form.lp-has-cohort-cards .woocommerce-variation-price {
  display: none;
}

.variations_form.lp-has-cohort-cards .woocommerce-variation-add-to-cart {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 600px) {
  .lp-cs-grid {
    grid-template-columns: 1fr;
  }

  .lp-cs-title {
    font-size: 19px;
  }
}
