/* ============================================
   Sierra Window & Property Services — Quote App
   ============================================ */

:root {
  --navy: #1d3866;
  --blue: #28a9e1;
  --blue-light: #e8f4fd;
  --blue-hover: #1e94c9;
  --white: #ffffff;
  --gray-50: #f8f9fb;
  --gray-100: #f0f2f5;
  --gray-200: #e2e5ea;
  --gray-300: #c8cdd5;
  --gray-400: #9ba3b0;
  --gray-500: #6b7585;
  --gray-600: #4a5568;
  --gray-700: #2d3748;
  --gray-800: #1a202c;
  --green: #22c55e;
  --green-light: #dcfce7;
  --red: #ef4444;
  --header-h: 64px;
  --footer-h: 80px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1), 0 8px 32px rgba(0,0,0,0.06);
}

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

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--gray-700);
  background: var(--gray-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ APP SHELL ============ */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  height: -webkit-fill-available;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Header */
.header {
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.header__logo {
  height: 36px;
  width: auto;
}

.header__step {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Content area */
.content {
  flex: 1 1 0%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  min-height: 0;
}

.content__inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 40px;
  min-height: 100%;
}

/* Footer */
.footer {
  flex: 0 0 var(--footer-h);
  height: var(--footer-h);
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  /* Safety for iOS */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.footer__inner {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Progress bar */
.progress {
  flex: 1;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--blue);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Footer buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--blue);
  color: var(--white);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn--primary:hover:not(:disabled) {
  background: var(--blue-hover);
  box-shadow: 0 4px 12px rgba(40,169,225,0.35);
}

.btn--primary:active:not(:disabled) {
  background: var(--blue-hover);
}

.btn--secondary {
  background: transparent;
  color: var(--gray-500);
  padding: 12px 16px;
  transition: background 0.15s ease;
}

.btn--secondary:hover:not(:disabled) {
  color: var(--navy);
  background: var(--gray-100);
}

.btn--large {
  padding: 16px 40px;
  font-size: 17px;
  border-radius: var(--radius);
}

.btn--full {
  width: 100%;
}

/* ============ STEP TRANSITIONS ============ */

.step {
  display: none;
  animation: fadeSlideIn 0.35s ease forwards;
}

.step.active {
  display: block;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ STEP COMMON ============ */

.step__title {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
  line-height: 1.2;
}

.step__subtitle {
  font-size: 15px;
  color: var(--gray-500);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ============ STEP 1: WELCOME ============ */

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100dvh - var(--header-h) - var(--footer-h) - 64px);
}

.welcome__logo {
  width: 180px;
  margin-bottom: 32px;
}

.welcome__title {
  font-size: 32px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
  line-height: 1.2;
}

.welcome__text {
  font-size: 16px;
  color: var(--gray-500);
  max-width: 440px;
  margin-bottom: 8px;
  line-height: 1.6;
}

.welcome__time {
  font-size: 13px;
  color: var(--gray-400);
  margin-bottom: 36px;
}

/* ============ STEP 2: PROPERTY TYPE ============ */

.card-grid {
  display: grid;
  gap: 12px;
}

.card-grid--3 {
  grid-template-columns: 1fr;
}

.type-card {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.type-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
}

.type-card.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.type-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.type-card.selected .type-card__icon {
  background: var(--blue);
}

.type-card__content {
  flex: 1;
}

.type-card__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}

.type-card__desc {
  font-size: 13px;
  color: var(--gray-500);
}

/* ============ STEP 3: PROPERTY DETAILS ============ */

.form-group {
  margin-bottom: 24px;
}

.form-group__label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}

.form-group__hint {
  font-weight: 400;
  color: var(--gray-400);
  font-size: 13px;
}

/* Option pills for single select */
.option-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-pill {
  padding: 10px 18px;
  border: 2px solid var(--gray-200);
  border-radius: 40px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  background: var(--white);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.15s ease;
}

.option-pill:hover {
  border-color: var(--blue);
  color: var(--navy);
}

.option-pill.selected {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

/* Checkbox pills for multi-select */
.check-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-pill {
  padding: 10px 18px;
  border: 2px solid var(--gray-200);
  border-radius: 40px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  background: var(--white);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.15s ease;
}

.check-pill:hover {
  border-color: var(--blue);
}

.check-pill.selected {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--navy);
}

/* Toggle (Yes/No) */
.toggle-group {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.15s ease;
}

.toggle-btn:hover {
  border-color: var(--blue);
}

.toggle-btn.selected {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

/* Textarea */
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--gray-700);
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s ease;
  background: var(--white);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--blue);
}

/* ============ STEP 4: LOADING ============ */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--header-h) - var(--footer-h) - 64px);
  text-align: center;
}

.loading__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading__text {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}

.loading__subtext {
  font-size: 14px;
  color: var(--gray-400);
}

/* ============ STEP 4: RECOMMENDATIONS ============ */

.service-card {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.service-card:hover {
  box-shadow: var(--shadow);
}

.service-card.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.service-card.not-recommended {
  opacity: 0.6;
  border-style: dashed;
}

.service-card.not-recommended.selected {
  opacity: 1;
  border-style: solid;
}

.service-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.service-card__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
}

.service-card__toggle {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--gray-300);
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.service-card__toggle::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.service-card.selected .service-card__toggle {
  background: var(--blue);
}

.service-card.selected .service-card__toggle::after {
  transform: translateX(18px);
}

.service-card__reason {
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.55;
  margin-bottom: 10px;
}

.service-card__price {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
}

.recommended-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green);
  background: var(--green-light);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
}

.other-services-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 500;
}

.other-services-divider::before,
.other-services-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* ============ STEP 5: QUOTE SUMMARY ============ */

.quote-summary {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.quote-summary__header {
  background: var(--navy);
  color: var(--white);
  padding: 24px;
  text-align: center;
}

.quote-summary__header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.quote-summary__header p {
  font-size: 14px;
  opacity: 0.7;
}

.quote-item {
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.quote-item:last-child {
  border-bottom: none;
}

.quote-item__info {
  flex: 1;
}

.quote-item__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}

.quote-item__desc {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.5;
}

.quote-item__price {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
}

.quote-total {
  padding: 20px 24px;
  background: var(--gray-50);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid var(--gray-200);
}

.quote-total__label {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
}

.quote-total__amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}

.quote-note {
  text-align: center;
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 16px;
  font-style: italic;
}

/* ============ STEP 6: CONTACT ============ */

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  color: var(--gray-700);
  transition: border-color 0.15s ease;
  background: var(--white);
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue);
}

.form-input.error {
  border-color: var(--red);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.time-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.time-pill {
  padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  color: var(--gray-600);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 0.15s ease;
}

.time-pill:hover {
  border-color: var(--blue);
}

.time-pill.selected {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}

/* ============ STEP 7: CONFIRMATION ============ */

.confirmation {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: calc(100dvh - var(--header-h) - var(--footer-h) - 64px);
  justify-content: center;
}

.confirmation__check {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  to { transform: scale(1); opacity: 1; }
}

.confirmation__check svg {
  width: 36px;
  height: 36px;
  color: var(--green);
}

.confirmation__title {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.confirmation__text {
  font-size: 15px;
  color: var(--gray-500);
  max-width: 440px;
  margin-bottom: 32px;
  line-height: 1.6;
}

.confirmation__summary {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  box-shadow: var(--shadow);
}

.confirmation__summary h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
}

.confirmation__summary-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  color: var(--gray-600);
}

/* ============ ERROR STATE ============ */

.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--red);
  margin-bottom: 16px;
  display: none;
}

.error-msg.visible {
  display: block;
}

/* ============ RESPONSIVE ============ */

@media (min-width: 640px) {
  .content__inner {
    padding: 48px 32px 56px;
  }

  .card-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .type-card {
    flex-direction: column;
    text-align: center;
    padding: 28px 20px;
  }

  .step__title {
    font-size: 30px;
  }

  .welcome__title {
    font-size: 38px;
  }

  .welcome__logo {
    width: 220px;
  }

  .service-card {
    padding: 24px;
  }
}

@media (min-width: 768px) {
  :root {
    --header-h: 72px;
  }

  .header {
    padding: 0 32px;
  }

  .header__logo {
    height: 42px;
  }

  .footer {
    padding: 0 32px;
  }
}

/* ============ UTILITY ============ */

.hidden { display: none !important; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
