/* tk_productservices — the service picker on the product card and in the cart.
 *
 * A segmented pair of buttons, not a checkbox: "decline" has to be as visible
 * as "accept", or customers read the service as compulsory. Product page and
 * cart share one look on purpose — the control a customer used on the product
 * card should be recognisable in the basket.
 *
 * Built on the theme's --tk-* tokens with literal fallbacks, so the block still
 * reads correctly on a stock Classic theme. */

.tkps {
  width: 100%;
  flex-basis: 100%;
  margin: 0 0 16px;
  padding: 15px 0;
  border-bottom: 1px solid var(--tk-line, #eeeae5);
  /* Drops to its own full-width row inside the theme's add-to-cart flex box. */
  order: 99;
  transition: opacity .2s ease;
}

.tkps--cart {
  margin: 12px 0 0;
  padding: 12px 0 0;
  border-bottom: 0;
  border-top: 1px solid var(--tk-line, #eeeae5);
}

.tkps.is-busy {
  opacity: .6;
  pointer-events: none;
}

.tkps-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.tkps-item:last-of-type {
  margin-bottom: 0;
}

.tkps-item--blocked {
  opacity: .6;
}

.tkps-item__info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.tkps-item__title {
  color: var(--tk-ink, #2b2320);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

.tkps-item__note {
  margin-top: 2px;
  color: var(--tk-muted, #9a938d);
  font-size: 12px;
  line-height: 1.3;
}

.tkps-switch {
  display: inline-flex;
  flex-shrink: 0;
  gap: 8px;
}

.tkps-btn {
  appearance: none;
  padding: 8px 12px;
  border: 1px solid var(--tk-line, #d9d3cd);
  border-radius: 8px;
  background: #fff;
  color: var(--tk-ink, #2b2320);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, opacity .2s;
}

.tkps-btn:hover:not([disabled]) {
  border-color: var(--tk-ink, #422f28);
}

.tkps-btn.is-active {
  border-color: var(--tk-ink, #422f28);
  background: var(--tk-ink, #422f28);
  color: #fff;
}

.tkps-btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

/* The running total under the product-page widget. Shown only once something
   is selected — before that it would just restate the price above it. */
.tkps-summary {
  display: none;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--tk-off, #f7f4f1);
  color: var(--tk-ink, #2b2320);
  font-size: 14px;
}

.tkps-summary.is-visible {
  display: block;
}

.tkps-summary__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
}

.tkps-summary__note {
  margin-top: 10px;
  color: var(--tk-muted, #9a938d);
  font-size: 12px;
  line-height: 1.4;
}

.tkps-busy {
  display: block;
  margin-top: 8px;
  color: var(--tk-muted, #9a938d);
  font-size: 13px;
}

/* The "of which" line under a cart line's unit price. Also rendered inside the
   order confirmation email, so it must survive with no CSS at all. */
.tkps-breakdown {
  display: grid;
  gap: 2px;
  margin: 4px 0 0;
}

.tkps-breakdown__row {
  color: var(--tk-muted, #9a938d);
  font-size: 13px;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .tkps-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .tkps-switch {
    width: 100%;
  }

  .tkps-btn {
    flex: 1;
    text-align: center;
  }

  .tkps-item__note {
    font-size: 12px;
  }
}

/* ---------------------------------------------------------------------------
   The "we removed a service" banner. Carries .alert.alert-warning as well, so
   on a Bootstrap theme it inherits the shop's own notification look and these
   rules only fill the gaps.
   --------------------------------------------------------------------------- */
.tkps-notice {
  position: relative;
  margin: 0 0 16px;
  padding: 14px 44px 14px 16px;
  border: 1px solid var(--tk-warning-border, #e6c200);
  border-left-width: 4px;
  border-radius: 4px;
  background: var(--tk-warning-bg, #fff8e1);
  color: var(--tk-warning-text, #5c4700);
  font-size: 14px;
  line-height: 1.45;
}

.tkps-notice__line {
  margin: 0;
}

.tkps-notice__line + .tkps-notice__line {
  margin-top: 6px;
}

.tkps-notice__close {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.65;
}

.tkps-notice__close:hover,
.tkps-notice__close:focus {
  opacity: 1;
}

/* Test mode badge. Only an allowlisted visitor can see a widget while the mode
   is on, so this is the merchant reminding himself. */
.tkps-testmode {
  margin: 0 0 10px;
  padding: 6px 10px;
  border: 1px dashed var(--tk-warning-border, #e6c200);
  border-radius: 4px;
  background: var(--tk-warning-bg, #fff8e1);
  color: var(--tk-warning-text, #5c4700);
  font-size: 12px;
  line-height: 1.35;
}

/* Fallback placement failed: the widgets stay in the cart footer, each headed
   with its product's name. Not the intended look — see the README for the
   one-line hook that puts them back on their own cart lines — but a labelled
   picker beats an anonymous one. */
.tkps-orphans .js-tkps-fallback-item + .js-tkps-fallback-item {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--tk-border, #e6e1dc);
}

.tkps-orphan__title {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 15px;
}
