/* ═══════════════════════════════════════════════════
   Approach 4 — Visual Card Configurator
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-ui: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
}

body {
  font-family: var(--font-ui);
  background: #F9F8F5;
}

/* ─── PAGE ─── */
.cards-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.cards-page__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-primary-dark);
  margin-bottom: 0.25rem;
}

.cards-page__subtitle {
  color: var(--color-text-light);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

/* ─── MAIN LAYOUT ─── */
.cards-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* ─── LEFT: SELECTION ZONE ─── */
.selection-zone {
  background: #fff;
  border: 2px solid #ECEAE4;
  border-radius: 14px;
  padding: 1.5rem;
  position: sticky;
  top: 80px;
}

.selection-zone__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 0.25rem;
}

.selection-zone__subtitle {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

.selection-zone__slots {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.selection-slot {
  padding: 0.65rem 0.75rem;
  border: 2px dashed #E0DDD5;
  border-radius: 8px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.2s ease;
  position: relative;
}

.selection-slot.drag-over {
  border-color: var(--color-secondary);
  background: rgba(197, 153, 58, 0.04);
  border-style: solid;
}

.selection-slot.filled {
  border-style: solid;
  border-color: var(--color-secondary);
  background: rgba(197, 153, 58, 0.04);
}

.selection-slot__category {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  position: absolute;
  top: -8px;
  left: 8px;
  background: #fff;
  padding: 0 4px;
}

.selection-slot.filled .selection-slot__category {
  color: var(--color-secondary-dark);
}

.selection-slot__icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--color-bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.selection-slot.filled .selection-slot__icon {
  background: var(--color-secondary);
  color: #fff;
}

.selection-slot__text {
  flex: 1;
  min-width: 0;
}

.selection-slot__empty {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.selection-slot__value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-slot__clear {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ECEAE4;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  transition: all 0.15s ease;
}

.selection-slot.filled .selection-slot__clear {
  display: flex;
}

.selection-slot__clear:hover {
  background: var(--color-error);
  color: #fff;
}

/* Price reveal area */
.selection-zone__result {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 2px solid #ECEAE4;
  text-align: center;
}

.selection-zone__result-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.selection-zone__result-price {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.selection-zone__result-price .sep {
  color: var(--color-text-muted);
  font-size: 0.6em;
  margin: 0 0.15em;
}

.selection-zone__result-incomplete {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.selection-zone__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.selection-zone__btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.selection-zone__btn--details {
  background: var(--color-bg-dark);
  color: var(--color-text);
}

.selection-zone__btn--details:hover {
  background: #E0DDD5;
}

.selection-zone__btn--copy {
  background: var(--color-secondary);
  color: #fff;
}

.selection-zone__btn--copy:hover {
  background: var(--color-secondary-dark);
}

/* ─── RIGHT: CARD STRIPS ─── */
.card-strips {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card-strip {
  background: #fff;
  border: 1px solid #ECEAE4;
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.card-strip__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-strip__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.card-strip__hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.card-strip__scroll {
  display: flex;
  gap: 0.625rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.card-strip__scroll::-webkit-scrollbar {
  height: 4px;
}

.card-strip__scroll::-webkit-scrollbar-thumb {
  background: #E0DDD5;
  border-radius: 2px;
}

/* ─── OPTION CARDS ─── */
.opt-card {
  flex-shrink: 0;
  width: 170px;
  padding: 1rem;
  border: 2px solid #ECEAE4;
  border-radius: 10px;
  cursor: grab;
  transition: all 0.2s ease;
  scroll-snap-align: start;
  position: relative;
  user-select: none;
}

.opt-card:hover {
  border-color: var(--color-secondary-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.opt-card.selected {
  border-color: var(--color-secondary);
  background: rgba(197, 153, 58, 0.05);
  box-shadow: 0 0 0 3px rgba(197, 153, 58, 0.12);
}

.opt-card.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.opt-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.6rem;
  font-size: 1rem;
  color: #fff;
}

.opt-card[data-category="surfacePrep"] .opt-card__icon {
  background: linear-gradient(135deg, #2E6B4A 0%, #4A9970 100%);
}

.opt-card[data-category="edgeComplexity"] .opt-card__icon {
  background: linear-gradient(135deg, #6B3B2D 0%, #995E4A 100%);
}

.opt-card[data-category="location"] .opt-card__icon {
  background: linear-gradient(135deg, #2D5A6B 0%, #4A8599 100%);
}

.opt-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.opt-card__desc {
  font-size: 0.75rem;
  color: var(--color-text-light);
  line-height: 1.35;
}

.opt-card__check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-secondary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: bold;
  display: none;
  align-items: center;
  justify-content: center;
}

.opt-card.selected .opt-card__check {
  display: flex;
}

/* ─── ADD-ON TOGGLES (inside card strip) ─── */
.cards-addon-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cards-addon-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 2px solid #ECEAE4;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cards-addon-toggle:hover {
  border-color: var(--color-secondary-light);
  background: #FDFCFA;
}

.cards-addon-toggle.checked {
  border-color: var(--color-secondary);
  background: rgba(197, 153, 58, 0.04);
}

.cards-addon-toggle input[type="checkbox"] {
  display: none;
}

.cards-addon-toggle__check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid #D0CDC5;
  border-radius: 4px;
  margin-top: 1px;
  position: relative;
  transition: all 0.2s ease;
}

.cards-addon-toggle.checked .cards-addon-toggle__check {
  border-color: var(--color-secondary);
  background: var(--color-secondary);
}

.cards-addon-toggle.checked .cards-addon-toggle__check::after {
  content: '\2713';
  position: absolute;
  top: -2px;
  left: 1px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.cards-addon-toggle__text {
  flex: 1;
  min-width: 0;
}

.cards-addon-toggle__title {
  display: block;
  font-weight: 600;
  color: var(--color-primary-dark);
  font-size: 0.85rem;
  line-height: 1.3;
}

.cards-addon-toggle__desc {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 1px;
  line-height: 1.35;
}

.cards-addon-toggle__cost {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-secondary-dark);
  padding: 0.15rem 0.4rem;
  background: rgba(197, 153, 58, 0.08);
  border-radius: 4px;
  margin-top: 1px;
  white-space: nowrap;
}

/* ─── SQUARE FOOTAGE STRIP (special) ─── */
.sqft-strip {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.sqft-slider-wrap {
  flex: 1;
  min-width: 200px;
}

.sqft-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #E8E6E0;
  border-radius: 3px;
  outline: none;
}

.sqft-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-secondary);
  cursor: grab;
  box-shadow: 0 2px 6px rgba(197, 153, 58, 0.3);
}

.sqft-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-secondary);
  cursor: grab;
  border: none;
}

.sqft-display {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.sqft-display__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  min-width: 60px;
  text-align: right;
}

.sqft-display__unit {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.sqft-input-field {
  width: 100px;
  padding: 0.5rem 0.6rem;
  border: 2px solid #E8E6E0;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  font-family: var(--font-display);
  color: var(--color-primary-dark);
}

.sqft-input-field:focus {
  outline: none;
  border-color: var(--color-secondary);
}

/* Visual area box */
.sqft-visual {
  width: 80px;
  height: 80px;
  border: 2px solid var(--color-secondary);
  border-radius: 4px;
  background: rgba(197, 153, 58, 0.06);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--color-secondary-dark);
  font-weight: 500;
  flex-shrink: 0;
}

/* ─── BREAKDOWN MODAL ─── */
.breakdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}

.breakdown-overlay.visible {
  display: flex;
}

.breakdown-modal {
  background: #fff;
  border-radius: 14px;
  padding: 2rem;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.breakdown-modal__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-primary-dark);
  margin-bottom: 1rem;
}

.breakdown-modal__row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #F0EEE9;
  font-size: 0.88rem;
}

.breakdown-modal__row:last-of-type {
  border-bottom: none;
}

.breakdown-modal__label {
  color: var(--color-text-light);
}

.breakdown-modal__amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.breakdown-modal__disclaimer {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 1rem;
  line-height: 1.4;
}

.breakdown-modal__close {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.6rem;
  border: 1px solid #E0DDD5;
  border-radius: 8px;
  background: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
}

.breakdown-modal__close:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 860px) {
  .cards-layout {
    grid-template-columns: 1fr;
  }

  .selection-zone {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .selection-zone__title,
  .selection-zone__subtitle {
    grid-column: 1 / -1;
  }

  .selection-zone__result {
    grid-column: 1 / -1;
  }

  .selection-zone__actions {
    grid-column: 1 / -1;
  }

  .opt-card {
    width: 150px;
  }
}

@media (max-width: 480px) {
  .cards-page {
    padding: 1rem;
  }

  .selection-zone {
    grid-template-columns: 1fr;
  }

  .sqft-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .sqft-display {
    justify-content: center;
  }

  .opt-card {
    width: 140px;
  }
}
