/* ==========================================================================
   Spa Configurator — Design-Token-Based Stylesheet
   Polarbad Lunar Picker redesign
   2-step configurator: Model Selection → Add-Ons Panel
   Covers 320px → 1920px viewport widths
   All transitions 200ms–450ms for 60fps rendering
   ========================================================================== */

/* ---------- Base reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   Design Tokens — CSS Custom Properties
   Requirements: 1.1, 1.2, 1.3, 1.4, 1.5
   ========================================================================== */

:host {
  /* Colors */
  --teal: #1d6b7a;
  --teal-dark: #155a67;
  --teal-light: #e8f2f4;
  --bg: #f5f4f1;
  --white: #ffffff;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --muted2: #999999;
  --border: #e0ddd8;

  /* Typography */
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --container-max-width: 1100px;
  --container-padding-top: 56px;
  --container-padding-x: 40px;
  --container-padding-bottom: 72px;
  --card-gap: 28px;
  --card-border-radius: 6px;
  --card-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

/* ==========================================================================
   ConfiguratorShell — Layout orchestrator
   Requirements: 14.1, 14.2, 14.4, 14.5
   ========================================================================== */

.configurator-shell {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: var(--container-padding-top) var(--container-padding-x) var(--container-padding-bottom);
  background: var(--bg);
  font-family: var(--sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Heading row: heading left, step indicator + back button right */
.configurator-shell__heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 36px;
}

.configurator-shell__heading-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Section heading */
.configurator-shell__heading {
  font-family: var(--serif);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 500;
  color: var(--teal);
  letter-spacing: 0.01em;
  line-height: 1;
}

/* Subtext below heading */
.configurator-shell__subtext {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
  margin-top: 8px;
}

/* Content area */
.configurator-shell__content {
  display: flex;
  flex-wrap: wrap;
  gap: var(--card-gap);
  transition: all 300ms ease;
}

/* Browsing mode: models take full width */
.configurator-shell--browsing .configurator-shell__models {
  width: 100%;
}

.configurator-shell--browsing .configurator-shell__addons {
  width: 0;
  overflow: hidden;
}

/* Selected mode: left column 340px fixed, right column fluid */
.configurator-shell--selected .configurator-shell__models {
  flex: 0 0 340px;
  max-width: 340px;
  transition: flex 300ms ease, max-width 300ms ease;
}

.configurator-shell--selected .configurator-shell__addons {
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible;
  transition: flex 300ms ease;
}

/* ==========================================================================
   Back Button — "Bytt modell"
   Requirements: 12.1, 12.2, 12.3
   ========================================================================== */

.configurator-shell__back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 16px;
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--sans);
  transition: border-color 0.2s, color 0.2s;
}

.configurator-shell__back-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.configurator-shell__back-button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ==========================================================================
   ModelCard — Horizontal layout with text left, image right
   Requirements: 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 5.1, 5.2, 5.3, 5.4
   ========================================================================== */

.model-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--white);
  border-radius: var(--card-border-radius);
  box-shadow: var(--card-shadow), 0 1px 4px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  cursor: pointer;
  border: none;
  text-align: left;
  width: 100%;
  font: inherit;
  font-family: var(--sans);
  color: var(--text);
  padding: 0;
  position: relative;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition: box-shadow 0.3s, transform 0.3s, opacity 300ms ease;
}

.model-card:hover {
  box-shadow: 0 8px 40px rgba(29, 107, 122, 0.15), 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-4px);
}

.model-card:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Hidden state — unselected cards when another card is selected */
.model-card--hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

/* Selected state — the chosen card (step 2) */
.model-card--selected {
  cursor: default;
  box-shadow: var(--card-shadow), 0 1px 4px rgba(0, 0, 0, 0.04);
  transform: none;
}

.model-card--selected:hover {
  box-shadow: var(--card-shadow), 0 1px 4px rgba(0, 0, 0, 0.04);
  transform: none;
}

/* Step 2 mode — no hover effects */
.model-card--step-addons {
  cursor: default;
}

.model-card--step-addons:hover {
  box-shadow: var(--card-shadow), 0 1px 4px rgba(0, 0, 0, 0.04);
  transform: none;
}

/* ---------- ModelCard top section: text left, image right ---------- */

.model-card__top {
  display: flex;
  align-items: flex-start;
  padding: 24px 24px 16px;
  gap: 16px;
}

.model-card__info {
  flex: 1;
}

.model-card__product-line {
  font-size: 11px;
  color: var(--muted2);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.model-card__name {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 12px;
}

.model-card__price {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.model-card__price-value {
  font-weight: 600;
  color: var(--teal);
  font-size: 14px;
}

/* ---------- ModelCard image ---------- */

.model-card__image-wrapper {
  width: 160px;
  height: 130px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.model-card__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.15));
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.model-card:hover .model-card__image {
  transform: scale(1.05);
}

.model-card--step-addons:hover .model-card__image,
.model-card--selected:hover .model-card__image {
  transform: scale(1);
}

/* ---------- ModelCard spec rows ---------- */

.model-card__specs {
  padding: 0 24px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.model-card__spec {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.model-card__spec:last-child {
  border-bottom: none;
}

.model-card__spec-value {
  font-weight: 700;
  font-size: 17px;
  min-width: 40px;
  color: var(--text);
  font-family: var(--sans);
}

.model-card__spec-label {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- ModelCard CTA area ---------- */

.model-card__cta {
  padding: 0 24px 24px;
}

/* ==========================================================================
   TagRibbon — Angled promotional label
   Requirements: 4.1, 4.2, 4.3
   ========================================================================== */

.tag-ribbon {
  position: absolute;
  top: 16px;
  right: -8px;
  z-index: 2;
  background: var(--teal);
  color: var(--white);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 16px 5px 12px;
  transform: rotate(2deg);
  transform-origin: right center;
  box-shadow: 0 2px 8px rgba(29, 107, 122, 0.35);
}

/* ==========================================================================
   StepIndicator — Progress circles with connecting line
   Requirements: 6.1, 6.2, 6.3, 6.4, 6.5, 6.6
   ========================================================================== */

.step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-indicator__line {
  width: 20px;
  height: 1px;
  background: var(--border);
}

.step-indicator__step {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-indicator__circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  transition: all 0.35s;
}

/* Active step */
.step-indicator__circle--active {
  background: var(--teal);
  color: var(--white);
  border: none;
}

/* Completed step */
.step-indicator__circle--completed {
  background: var(--teal-light);
  border: 1.5px solid var(--teal);
  color: var(--teal);
}

/* Inactive step */
.step-indicator__circle--inactive {
  background: var(--border);
  color: var(--muted);
  border: none;
}

.step-indicator__label {
  font-size: 12px;
  font-weight: 500;
  transition: color 0.35s;
}

.step-indicator__label--active {
  color: var(--teal);
}

.step-indicator__label--inactive {
  color: var(--muted2);
}

/* ==========================================================================
   ModelSelectionStep — Flex layout and state messages
   Requirements: 14.3, 13.1
   ========================================================================== */

.model-selection-step {
  padding: 0;
}

.model-selection-step__grid {
  display: flex;
  gap: var(--card-gap);
}

.model-selection-step__grid > * {
  flex: 1 1 0;
}

.model-selection-step__loading {
  text-align: center;
  padding: 48px 0;
  font-size: 16px;
  color: var(--muted);
}

.model-selection-step__error {
  text-align: center;
  padding: 48px 0;
  color: #c00;
}

.model-selection-step__retry-button {
  margin-top: 12px;
  padding: 8px 20px;
  border: 1px solid #c00;
  border-radius: 4px;
  background: var(--white);
  color: #c00;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--sans);
}

.model-selection-step__retry-button:hover {
  background: #fef0f0;
}

.model-selection-step__retry-button:focus-visible {
  outline: 2px solid #c00;
  outline-offset: 2px;
}

.model-selection-step__empty {
  text-align: center;
  padding: 48px 0;
  font-size: 16px;
  color: var(--muted);
}

/* ==========================================================================
   AddOnsPanel — White card wrapper with slide-in transition
   Requirements: 8.1, 8.2, 8.3, 13.3
   ========================================================================== */

.addons-panel {
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.45s 0.06s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.45s 0.06s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.addons-panel--visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.addons-panel__card {
  background: var(--white);
  border-radius: var(--card-border-radius);
  box-shadow: var(--card-shadow);
  padding: 24px 24px 20px;
}

.addons-panel__title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  color: var(--teal);
  margin-bottom: 4px;
}

.addons-panel__subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}

.addons-panel__empty {
  text-align: center;
  padding: 48px 0;
  font-size: 16px;
  color: var(--muted);
}

.addons-panel__list {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   AddOnCard — Row layout with custom checkbox
   Requirements: 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 8.10
   ========================================================================== */

.addon-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 4px;
  cursor: pointer;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  margin: 0 -4px;
  transition: background 0.15s;
  font: inherit;
  font-family: var(--sans);
  color: var(--text);
  text-align: left;
  width: calc(100% + 8px);
}

.addon-card:hover {
  background: rgba(29, 107, 122, 0.02);
  box-shadow: none;
}

.addon-card:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.addon-card--selected {
  background: transparent;
}

/* Custom checkbox */
.addon-card__checkbox {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 2px solid #ccc;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0;
  line-height: 0;
}

.addon-card--selected .addon-card__checkbox {
  border-color: var(--teal);
  background: var(--teal);
}

/* Addon card body */
.addon-card__body {
  flex: 1;
}

.addon-card__header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.addon-card__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: color 0.2s;
  margin: 0;
}

.addon-card--selected .addon-card__name {
  color: var(--teal);
}

.addon-card__price {
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  flex-shrink: 0;
  margin: 0;
  white-space: nowrap;
}

.addon-card__description {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
}

.addon-card__link {
  font-size: 13px;
  color: var(--teal);
  text-decoration: underline;
}

.addon-card__link:hover {
  color: var(--teal-dark);
}

/* ==========================================================================
   PriceSummaryCard — Price breakdown card
   Requirements: 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
   ========================================================================== */

.price-summary-card {
  background: var(--white);
  border-radius: var(--card-border-radius);
  box-shadow: var(--card-shadow);
  padding: 18px 20px;
  margin-top: 16px;
}

.price-summary-card__header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.price-summary-card__items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-summary-card__line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.price-summary-card__line-label {
  color: var(--muted);
}

.price-summary-card__line-value {
  font-weight: 500;
}

.price-summary-card__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

.price-summary-card__total-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.price-summary-card__total-value {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  color: var(--teal);
  transition: all 0.3s;
}

.price-summary-card__disclaimer {
  font-size: 10px;
  color: var(--muted2);
  line-height: 1.5;
  margin-top: 8px;
}

/* ==========================================================================
   SelectedAddonsStrip — Chip badges for selected add-ons
   Requirements: 9.1, 9.2, 9.3, 9.4
   ========================================================================== */

.selected-addons-strip {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.selected-addons-strip__label {
  font-size: 11px;
  color: var(--muted2);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selected-addons-strip__chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--teal-light);
  color: var(--teal);
  border: 1px solid rgba(29, 107, 122, 0.2);
  font-weight: 500;
}

/* ==========================================================================
   CTAButton — Teal call-to-action button
   Requirements: 11.1, 11.2, 11.3, 11.4
   ========================================================================== */

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--teal);
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 13px 20px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--sans);
  transition: background 0.2s;
}

.cta-button:hover {
  background: var(--teal-dark);
}

.cta-button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Smaller variant for model card CTA */
.cta-button--small {
  font-size: 12px;
  padding: 10px 18px;
}

/* Full-width variant for addons panel CTA */
.cta-button--full {
  width: 100%;
  margin-top: 24px;
}

/* ==========================================================================
   PriceDisplay — Legacy (replaced by PriceSummaryCard)
   ========================================================================== */

.price-display {
  display: none;
}

/* ==========================================================================
   Transition Animation Classes
   Requirements: 13.1, 13.2, 13.3, 13.4, 13.5
   ========================================================================== */

.fade-out {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Responsive Breakpoints
   Requirements: 15.1, 15.2, 15.3, 15.4, 15.5
   ========================================================================== */

/* ---------- Below 768px: stack cards vertically, reduce padding ---------- */
@media (max-width: 768px) {
  .configurator-shell {
    padding: 32px 16px 48px;
  }

  .configurator-shell__heading-row {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  /* Stack model cards vertically */
  .model-selection-step__grid {
    flex-direction: column;
  }

  /* Stack selected mode vertically */
  .configurator-shell--selected .configurator-shell__models {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .configurator-shell--selected .configurator-shell__addons {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .configurator-shell__content {
    flex-direction: column;
  }

  /* Prevent iOS zoom on focus */
  input,
  textarea {
    font-size: 16px;
  }
}

/* ---------- Below 480px: reduce image width ---------- */
@media (max-width: 480px) {
  .model-card__image-wrapper {
    width: 120px;
    height: 100px;
  }

  .model-card__top {
    padding: 16px 16px 12px;
  }

  .model-card__specs {
    padding: 0 16px 16px;
  }

  .model-card__cta {
    padding: 0 16px 16px;
  }

  .model-card__name {
    font-size: 18px;
  }

  .addons-panel__card {
    padding: 16px 16px 14px;
  }

  .price-summary-card {
    padding: 14px 16px;
  }
}

