/* Guided wizard UX for shop/calculator — progressive disclosure, one step at a time */

.shop-calculator-page {
  padding-top: 16px;
  padding-bottom: 48px;
}

.shop-calculator-wrap {
  max-width: 1100px;
}

.shop-wizard-header {
  margin-bottom: 28px;
  padding: 28px 28px 24px;
  background: linear-gradient(165deg, var(--paper-warm) 0%, #fff 55%);
  border: 1px solid var(--mint-line);
  border-radius: 16px;
}

.shop-stepper {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  margin-bottom: 24px;
}

.shop-stepper-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s;
}

.shop-stepper-step:disabled {
  cursor: default;
}

.shop-stepper-step:disabled .shop-stepper-label {
  opacity: 0.45;
}

.shop-stepper-bar {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--mint-line);
  transition: background 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.shop-stepper-step.is-active .shop-stepper-bar,
.shop-stepper-step.is-done .shop-stepper-bar {
  background: linear-gradient(90deg, var(--mint-deep), var(--mint));
}

.shop-stepper-label {
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.shop-stepper-step.is-active .shop-stepper-label {
  color: var(--ink);
  font-weight: 600;
}

.shop-stepper-step.is-done:not(:disabled) .shop-stepper-label {
  color: var(--ink);
}

.shop-wizard-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #7FAFAF;
  text-align: center;
}

.shop-wizard-title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 1.45;
}

.shop-wizard-desc {
  margin: 0 auto;
  max-width: 520px;
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.8;
}

.shop-breadcrumb--compact {
  margin-bottom: 16px;
  font-size: 12px;
}

/* Steps 1–2: full width, hide price sidebar (catalog grids = shop.css shop-fit) */
.shop-page.shop-step-catalog .shop-body,
.shop-page.shop-step-styles .shop-body {
  grid-template-columns: 1fr;
  max-width: none;
  margin: 0;
}

.shop-page.shop-step-catalog .shop-price-panel,
.shop-page.shop-step-styles .shop-price-panel {
  display: none;
}

.shop-page.shop-step-catalog .mobile-buy-bar,
.shop-page.shop-step-styles .mobile-buy-bar {
  display: none !important;
}

.shop-config-notices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 18px;
}

/* shadcn-style Alert (vanilla) */
.ui-alert {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: start;
  column-gap: 8px;
  row-gap: 2px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.ui-alert.ui-alert--dismissed {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

.ui-alert__icon {
  width: 16px;
  height: 1lh;
  min-height: 16px;
  grid-column: 1;
  grid-row: 1 / -1;
  align-self: start;
}

.ui-alert__title {
  grid-column: 2;
  margin: 0;
  font-weight: 500;
}

.ui-alert__description {
  grid-column: 2;
  margin: 0;
  color: var(--ink-soft);
}

.ui-alert--default {
  background: transparent;
  border-color: rgba(95, 113, 117, 0.25);
  color: var(--ink);
}

.ui-alert--default .ui-alert__icon {
  color: var(--ink-soft);
}

.ui-alert__confirm {
  grid-column: 3;
  grid-row: 1 / -1;
  align-self: center;
  justify-self: end;
  flex-shrink: 0;
  padding: 5px 14px;
  border: 1px solid rgba(95, 113, 117, 0.35);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.ui-alert__confirm:hover {
  background: rgba(95, 113, 117, 0.1);
  border-color: rgba(95, 113, 117, 0.5);
}

.ui-alert__confirm--warning {
  border-color: rgba(245, 158, 11, 0.4);
  color: #b45309;
}

.ui-alert__confirm--warning:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.55);
}

.ui-alert--warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.05);
  color: #b45309;
}

.ui-alert--warning .ui-alert__icon,
.ui-alert--warning .ui-alert__title {
  color: #d97706;
}

.ui-alert--warning .ui-alert__description {
  color: #92400e;
}

.shop-section-hint {
  margin: 0 0 18px;
  padding: 12px 16px;
  background: var(--mint-soft);
  border-left: 3px solid var(--mint-deep);
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.shop-section-hint--action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(90deg, var(--mint-soft) 0%, #fff 100%);
  border: 1px solid var(--mint-line);
  border-left: 4px solid var(--mint-deep);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(94, 207, 207, 0.12);
}

.shop-hint-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mint-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.shop-section-title--sub {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--ink-soft);
}

.catalog-filters-bar {
  margin-bottom: 20px;
}

.catalog-filters-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 12px;
  padding: 12px 14px;
  border: 1px solid var(--mint-line);
  border-radius: 12px;
  background: linear-gradient(165deg, var(--paper-warm, #faf8f5) 0%, #fff 65%);
}

.catalog-filters-wrap {
  flex: 1 1 220px;
  margin-bottom: 0;
  min-width: 0;
}

.catalog-filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--mint-line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.catalog-filters-toggle::-webkit-details-marker {
  display: none;
}

.catalog-filters-toggle::marker {
  content: '';
}

.catalog-filters-toggle::after {
  content: '';
  width: 0.42em;
  height: 0.42em;
  margin-top: -0.15em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.catalog-filters-toggle:hover {
  border-color: var(--mint-deep);
  color: var(--ink);
}

.catalog-filters-toggle:focus-visible {
  outline: 2px solid var(--mint-deep);
  outline-offset: 2px;
}

.catalog-filters-wrap[open] .catalog-filters-toggle {
  border-color: var(--mint-deep);
  background: var(--mint-soft);
  color: var(--ink);
}

.catalog-filters-wrap[open] .catalog-filters-toggle::after {
  margin-top: 0.15em;
  transform: rotate(-135deg);
}

.catalog-carat-filter {
  flex: 0 1 168px;
  align-self: flex-start;
  min-width: 128px;
}

.catalog-ms-filter {
  position: relative;
  flex: 0 1 168px;
  align-self: flex-start;
  min-width: 128px;
}

.catalog-ms-filter.catalog-carat-filter {
  flex: 0 1 168px;
  min-width: 128px;
}

.catalog-filters .catalog-ms-filter {
  flex: 0 1 auto;
  min-width: 0;
}

.catalog-ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--color-border, #d8d0c8);
  border-radius: 8px;
  background: var(--color-surface, #fff);
  color: var(--color-text, inherit);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.catalog-ms-trigger::after {
  content: '';
  width: 0.42em;
  height: 0.42em;
  margin-top: -0.15em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
  opacity: 0.7;
}

.catalog-ms-trigger:hover,
.catalog-ms-filter--active .catalog-ms-trigger {
  border-color: var(--mint-deep, #6b9080);
}

.catalog-ms-trigger:focus-visible {
  outline: 2px solid var(--mint-deep, #6b9080);
  outline-offset: 2px;
}

.catalog-ms-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.catalog-ms-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 100%;
  max-height: min(280px, 52vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--mint-line, #d8d0c8);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(43, 35, 32, 0.12);
}

.catalog-ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
}

.catalog-ms-option:hover {
  background: var(--mint-soft, #eef5f1);
}

.catalog-ms-option input {
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--mint-deep, #6b9080);
}

.catalog-ms-option-text {
  flex: 1 1 auto;
  min-width: 0;
}

.catalog-filters-wrap:not([open]) .catalog-filters {
  display: none;
}

.catalog-filters-wrap[open] .catalog-filters {
  margin-top: 12px;
}

@media (max-width: 520px) {
  .catalog-filters-toolbar {
    padding: 10px 12px;
  }

  .catalog-filters-wrap,
  .catalog-carat-filter,
  .catalog-ms-filter.catalog-carat-filter {
    flex: 1 1 100%;
    width: 100%;
  }

  .catalog-filters-toggle {
    width: 100%;
    justify-content: space-between;
  }
}

/* Step 3 layout */
.shop-page.shop-step-product .shop-body {
  grid-template-columns: 1fr 300px;
  gap: 32px;
}

.product-layout--wizard {
  gap: 24px;
}

.product-info-tabs--collapsed .product-tab-nav {
  display: none;
}

.product-about-details {
  margin-bottom: 20px;
  border: 1px solid var(--mint-line);
  border-radius: 10px;
  background: #fff;
}

.product-about-details summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.product-about-details .product-tab-panels {
  padding: 0 16px 16px;
}

/* Step 3 config — flat layout, all options visible (imprint shop style) */
.shop-page.shop-step-product .product-buy-col {
  overflow-y: visible;
  padding-right: 0;
}

/* Sticky summary sits below site-chrome (topbar + 76px nav) */
.shop-page.shop-wizard {
  --shop-summary-sticky-top: calc(76px + 2.25rem + 10px);
  --shop-summary-sticky-max-height: calc(100dvh - var(--shop-summary-sticky-top) - 12px);
}

/* Price panel — cleaner, sticks while scrolling (beats shop-fit static override) */
.shop-price-panel--wizard {
  position: sticky;
  top: var(--shop-summary-sticky-top);
  align-self: start;
  max-height: var(--shop-summary-sticky-max-height);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--mint-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.shop-price-panel-head {
  margin-bottom: 8px;
}

.shop-price-panel-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.shop-price-panel--wizard .hero-price-disclaimer {
  font-size: 11px;
  line-height: 1.6;
  margin-top: 8px;
}

.shop-action-row--primary {
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.shop-action-row--primary .shop-cta {
  width: 100%;
  justify-content: center;
  padding: 14px 20px;
  font-size: 15px;
}

.shop-secondary-actions--compact {
  margin-top: 12px;
  justify-content: center;
  gap: 16px;
}

.shop-secondary-actions--compact button {
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}


@media (max-width: 900px) {
  .shop-stepper {
    gap: 10px;
  }

  .shop-stepper-label {
    font-size: 12px;
  }

  .shop-wizard-header {
    padding: 20px 16px 18px;
  }

  .shop-page.shop-step-product .shop-body {
    grid-template-columns: 1fr;
  }

  .shop-price-panel--wizard {
    position: static;
  }

  .product-layout--wizard {
    grid-template-columns: 1fr;
  }

  .product-gallery-col {
    max-width: 320px;
    margin: 0 auto;
  }
}

/* Wizard: release viewport-lock so price breakdown is never clipped */
.shop-page.shop-wizard.shop-fit {
  height: auto;
  min-height: 0;
  overflow: visible;
}

/* shop-fit unlocks page height; restore square preview (else flex + aspect-ratio:auto → 0) */
.shop-page.shop-wizard.shop-fit .product-preview {
  flex: none;
  aspect-ratio: 1;
  height: auto;
  max-height: min(calc(100vh - 56px), 480px);
}

.shop-page.shop-wizard .shop-body {
  align-items: start;
}

@media (min-width: 901px) {
  body.app-shell:has(.shop-page.shop-wizard.shop-fit) {
    overflow: auto;
  }

  .shop-page.shop-wizard.shop-fit .shop-price-panel,
  .shop-page.shop-wizard.shop-fit .shop-price-panel--wizard {
    position: sticky;
    top: var(--shop-summary-sticky-top);
    align-self: start;
    max-height: var(--shop-summary-sticky-max-height);
    overflow-y: auto;
  }
}

.shop-page.shop-wizard .shop-main {
  overflow: visible;
}

.shop-page.shop-wizard .shop-section:not(.hidden) {
  overflow: visible;
  height: auto;
}

@media (min-width: 901px) {
  .shop-page.shop-wizard .shop-price-panel,
  .shop-page.shop-wizard .shop-price-panel--wizard {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .shop-page.shop-wizard .price-breakdown-details {
    flex: none;
    min-height: auto;
    overflow: visible;
  }

  .shop-page.shop-wizard .price-breakdown-panel {
    flex: none;
    min-height: auto;
    max-height: none;
    overflow: visible;
  }
}

/* Wizard: always show full breakdown (克拉、金工價格) */
.shop-page.shop-wizard .price-breakdown-details:not([open]) .price-breakdown-panel {
  display: block !important;
}

/* Pendant-only renders are 573x451. Match the responsive frame to the
   source ratio so contain does not expose a false empty band above it. */
@media (max-width: 1100px) {
  .shop-page.shop-wizard .product-preview.is-pendant-only {
    aspect-ratio: 573 / 451;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .shop-page.shop-wizard .shop-price-panel .shop-secondary-actions {
    display: none;
  }

  .shop-page.shop-wizard .breakdown-rows .summary-row {
    grid-template-columns: minmax(6.5em, max-content) 1em minmax(0, 1fr);
    line-height: 1.45;
  }

  .shop-page.shop-wizard .breakdown-rows .summary-row .val {
    min-width: 0;
    justify-self: start;
    text-align: left;
    overflow-wrap: anywhere;
  }
}

@media (min-width: 901px) {
  .shop-page.shop-wizard.shop-step-catalog .shop-body,
  .shop-page.shop-wizard.shop-step-styles .shop-body {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
  }

  .shop-page.shop-wizard.shop-step-catalog .shop-price-panel,
  .shop-page.shop-wizard.shop-step-styles .shop-price-panel {
    display: flex;
  }
}

/* Calculator: highlight missing options after order click */
.shop-field-invalid {
  --shop-invalid-color: #dc2626;
  border-radius: 12px;
  outline: 2px solid var(--shop-invalid-color);
  outline-offset: 3px;
  background-color: rgba(220, 38, 38, 0.05);
  transition: outline-color 0.2s ease, background-color 0.2s ease;
}

.shop-field-invalid .variant-label,
.shop-field-invalid .shop-section-title {
  color: var(--shop-invalid-color);
}

.shop-field-invalid .ring-size-select,
.shop-field-invalid .stone-count-input {
  border-color: var(--shop-invalid-color);
  box-shadow: 0 0 0 1px var(--shop-invalid-color);
}

.shop-field-invalid--flash {
  animation: shop-field-invalid-flash 0.55s ease-in-out 2;
}

@keyframes shop-field-invalid-flash {
  0%,
  100% {
    outline-color: #dc2626;
    background-color: rgba(220, 38, 38, 0.05);
  }

  50% {
    outline-color: #ef4444;
    background-color: rgba(220, 38, 38, 0.14);
  }
}

/* Hero total: count animation + up/down color cue */
.hero-price-amount {
  transition: color 0.45s ease, transform 0.35s ease;
}

.hero-price-amount.hero-price-tick--up {
  color: #b91c1c;
  transform: translateY(-3px);
}

.hero-price-amount.hero-price-tick--down {
  color: #047857;
  transform: translateY(2px);
}

/* Fancy color step: title + min-carat reminder on one header row */
.fancy-color-label-row {
  align-items: center;
  flex-wrap: nowrap;
  margin-bottom: 10px;
  gap: 8px;
}

.fancy-color-label-row .variant-label {
  margin-bottom: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.fancy-color-label-row .diamond-shape-hint--inline {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  padding: 0;
  font-size: 0.6875rem;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  text-align: right;
  color: var(--color-text-muted, #8a8178);
  background: none;
  border: none;
  border-radius: 0;
}

/* Fancy min-carat warning — clear red (overrides muted inline tip) */
.fancy-color-label-row .shop-fancy-min-note,
.shop-fancy-min-note {
  color: #c62828;
  font-weight: 600;
}

@media (max-width: 360px) {
  .fancy-color-label-row {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .fancy-color-label-row .diamond-shape-hint--inline {
    flex-basis: 100%;
    white-space: normal;
    text-align: left;
  }
}
