/* ============================================================
   Review Funnel — Mobile-First Stylesheet
   Brand colors are overridden at runtime via config.js
   ============================================================ */

/* ── Variables ── */
:root {
  --primary:       #4f46e5;
  --primary-dark:  #3730a3;
  --primary-light: #eef2ff;
  --text:          #111827;
  --text-muted:    #6b7280;
  --bg:            #f3f4f6;
  --card:          #ffffff;
  --border:        #e5e7eb;
  --star-empty:    #d1d5db;
  --star-filled:   #f59e0b;
  --success:       #10b981;
  --error:         #ef4444;
  --radius:        18px;
  --shadow:        0 4px 32px rgba(0, 0, 0, 0.10);
  --transition:    0.18s ease;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ── */
.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 48px;
  position: relative;
}

/* ── Steps ── */
.step {
  display: none;
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 36px;
  text-align: center;
  animation: fadeUp 0.28s ease both;
}

.step.active {
  display: block;
}

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

/* ── Logo ── */
.logo-wrap {
  margin-bottom: 28px;
  min-height: 0;
}

.logo-wrap img {
  max-height: 72px;
  max-width: 200px;
  object-fit: contain;
}

/* ── Typography ── */
h1 {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 32px;
}

.step-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 20px;
}

/* ── Stars ── */
.stars-wrap {
  margin: 4px 0 8px;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 54px;
  color: var(--star-empty);
  line-height: 1;
  padding: 6px 4px;
  border-radius: 10px;
  transition: color var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.star:hover,
.star.hovered {
  transform: scale(1.18);
}

.star.filled {
  color: var(--star-filled);
}

/* ── Forms ── */
.field-group {
  margin-bottom: 18px;
  text-align: left;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fafafa;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.55;
}

#generated-review {
  min-height: 160px;
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 16px;
  background: var(--primary-light);
  border-color: transparent;
  border-radius: 12px;
  text-align: left;
}

#generated-review:focus {
  background: #fff;
}

/* ── Services Grid ── */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.service-btn {
  background: #fafafa;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 1.3;
}

.service-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.service-btn.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.other-input {
  margin-top: 6px;
}

/* ── Reasons Grid ── */
.reasons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reason-btn {
  background: #fafafa;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 1.3;
  white-space: nowrap;
}

.reason-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.reason-btn.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.label-optional {
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Buttons ── */
.btn {
  display: block;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 13px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-bottom: 10px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.28);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.36);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-icon {
  margin-right: 6px;
}

/* ── Thank You check circle ── */
.check-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: #fff;
}

.check-circle svg {
  width: 38px;
  height: 38px;
}

/* ── Loading Overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 200;
}

.loading-overlay p {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.spinner {
  width: 46px;
  height: 46px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* ── Utility ── */
.hidden {
  display: none !important;
}

.error-msg {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 6px;
  text-align: center;
}

.copy-confirm {
  color: var(--success);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  margin-top: 2px;
  margin-bottom: 6px;
}

/* ── Mobile tweaks ── */
@media (max-width: 420px) {
  .step {
    padding: 36px 22px 40px;
    border-radius: 14px;
  }

  .star {
    font-size: 46px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }
}
