/* ============================================================
   Business OS Requirements Survey — Stylesheet
   Premium, mobile-first, glassmorphism design
   ============================================================ */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  --primary:          #1a1f36;
  --primary-light:    #2d3561;
  --accent:           #4f6ef7;
  --accent-light:     #7b93fa;
  --accent-gradient:  linear-gradient(135deg, #4f6ef7, #7b93fa);
  --bg:               #f0f2f8;
  --card-bg:          rgba(255, 255, 255, 0.95);
  --text:             #333;
  --text-light:       #666;
  --border:           #e0e4ef;
  --success:          #22c55e;
  --error:            #ef4444;
  --shadow:           0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg:        0 16px 48px rgba(0, 0, 0, 0.12);
  --radius:           16px;
  --radius-sm:        10px;
  --transition:       0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Body ---------- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle dot‑grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(79, 110, 247, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Progress Bar (fixed top) ---------- */
.progress-bar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--border);
  z-index: 1000;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 0 4px 4px 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 80px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
  animation: shimmer 2s infinite;
}

.progress-text {
  position: fixed;
  top: 10px;
  right: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--card-bg);
  padding: 4px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 1001;
  transition: opacity var(--transition);
}

/* ---------- Container ---------- */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  position: relative;
  z-index: 1;
}

/* ---------- Banner / Header ---------- */
.survey-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 40%, var(--accent) 100%);
  padding: 60px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-top: 4px; /* progress bar clearance */
}

.survey-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(79, 110, 247, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(123, 147, 250, 0.25) 0%, transparent 50%);
  pointer-events: none;
}

.survey-banner::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 40px;
  background: var(--bg);
  border-radius: 40px 40px 0 0;
}

.survey-banner .banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.survey-banner .banner-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.survey-banner h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  position: relative;
  margin-bottom: 8px;
}

.survey-banner .subtitle {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
  font-weight: 400;
  position: relative;
}

/* ---------- Form Card (Glassmorphism) ---------- */
.form-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  margin: -20px auto 40px;
  position: relative;
  max-width: 720px;
}

/* ---------- Global Error Banner ---------- */
.error-banner {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 28px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.error-banner .error-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--error);
}

.error-banner ul {
  list-style: none;
  font-size: 0.875rem;
  color: #b91c1c;
}

.error-banner ul li + li {
  margin-top: 4px;
}

/* ---------- Form Sections ---------- */
.form-section {
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
  position: relative;
  opacity: 0;
  transform: translateY(24px);
  animation: fadeInUp 0.6s ease forwards;
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Staggered entrance */
.form-section:nth-child(1) { animation-delay: 0.05s; }
.form-section:nth-child(2) { animation-delay: 0.12s; }
.form-section:nth-child(3) { animation-delay: 0.19s; }
.form-section:nth-child(4) { animation-delay: 0.26s; }
.form-section:nth-child(5) { animation-delay: 0.33s; }

/* Gradient divider */
.form-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
}

.form-section:last-of-type::after {
  display: none;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.3);
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.section-title .my {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-light);
  margin-top: 2px;
}

/* ---------- Form Group ---------- */
.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-group:last-child {
  margin-bottom: 0;
}

/* Labels */
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

.form-label .label-my {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-light);
  margin-top: 2px;
}

/* ---------- Input Fields ---------- */
.form-input {
  width: 100%;
  padding: 14px 0 12px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder {
  color: #bbb;
  font-weight: 300;
}

.form-input:focus {
  border-bottom-color: var(--accent);
  box-shadow: 0 2px 0 0 var(--accent);
}

.form-input:hover:not(:focus) {
  border-bottom-color: #c0c7dc;
}

/* Error state */
.form-group.has-error .form-input {
  border-bottom-color: var(--error);
}

.form-group.has-error .form-input:focus {
  box-shadow: 0 2px 0 0 var(--error);
}

.field-error {
  display: block;
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 6px;
  font-weight: 500;
}

/* ---------- Radio Group ---------- */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.radio-item {
  position: relative;
}

.radio-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-item label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 48px;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
  user-select: none;
}

.radio-item label:hover {
  border-color: var(--accent-light);
  background: rgba(79, 110, 247, 0.03);
}

.radio-item input[type="radio"]:checked + label {
  border-color: var(--accent);
  background: rgba(79, 110, 247, 0.06);
  box-shadow: 0 0 0 1px var(--accent);
}

/* Custom radio circle */
.radio-item label::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all var(--transition);
  background: #fff;
}

.radio-item input[type="radio"]:checked + label::before {
  border-color: var(--accent);
  border-width: 6px;
  background: #fff;
}

.radio-item label .label-my {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 400;
  display: block;
  margin-top: 1px;
}

.radio-label-text {
  display: flex;
  flex-direction: column;
}

/* ---------- Checkbox Group ---------- */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.checkbox-item {
  position: relative;
}

.checkbox-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-item label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 48px;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
  user-select: none;
}

.checkbox-item label:hover {
  border-color: var(--accent-light);
  background: rgba(79, 110, 247, 0.03);
}

.checkbox-item input[type="checkbox"]:checked + label {
  border-color: var(--accent);
  background: rgba(79, 110, 247, 0.06);
  box-shadow: 0 0 0 1px var(--accent);
}

/* Custom checkbox square */
.checkbox-item label::before {
  content: '';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all var(--transition);
  background: #fff;
}

.checkbox-item input[type="checkbox"]:checked + label::before {
  background: var(--accent);
  border-color: var(--accent);
  /* Checkmark via CSS */
  content: '';
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
  animation: checkPop 0.25s ease;
}

.checkbox-item label .label-my {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 400;
  display: block;
  margin-top: 1px;
}

.checkbox-label-text {
  display: flex;
  flex-direction: column;
}

/* ---------- Other Textarea ---------- */
.other-field-wrapper {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease;
  opacity: 0;
  margin-top: 0;
}

.other-field-wrapper.visible {
  max-height: 200px;
  opacity: 1;
  margin-top: 12px;
}

.other-textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: #f8f9fc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.other-textarea::placeholder {
  color: #bbb;
}

.other-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
  background: #fff;
}

/* ---------- Submit Button ---------- */
.submit-wrapper {
  margin-top: 40px;
  text-align: center;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  padding: 16px 32px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-gradient);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(79, 110, 247, 0.35);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(79, 110, 247, 0.45);
}

.btn-submit:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(79, 110, 247, 0.3);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Shimmer overlay on hover */
.btn-submit::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.5s ease;
}

.btn-submit:hover::after {
  left: 100%;
}

/* Loading state */
.btn-submit.loading .btn-text {
  opacity: 0;
}

.btn-submit.loading .btn-spinner {
  display: block;
}

.btn-spinner {
  display: none;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  position: absolute;
}

/* ---------- Thank-You Page ---------- */
.thankyou-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 40px 16px;
}

.thankyou-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 56px 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  animation: fadeInUp 0.6s ease;
}

.thankyou-checkmark {
  width: 88px;
  height: 88px;
  margin: 0 auto 28px;
}

.thankyou-checkmark svg {
  width: 100%;
  height: 100%;
}

.thankyou-checkmark .circle {
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: circleStroke 0.6s ease 0.2s forwards;
  transform-origin: center;
}

.thankyou-checkmark .check {
  fill: none;
  stroke: var(--success);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: checkStroke 0.4s ease 0.7s forwards;
}

.thankyou-card h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}

.thankyou-card p {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 8px;
  line-height: 1.7;
}

.thankyou-card .my-text {
  font-size: 0.88rem;
  color: #999;
  margin-bottom: 32px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(79, 110, 247, 0.08);
  border: 1.5px solid rgba(79, 110, 247, 0.2);
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: rgba(79, 110, 247, 0.14);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ---------- Keyframe Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes checkPop {
  0%   { transform: scale(0.7); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

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

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes circleStroke {
  to { stroke-dashoffset: 0; }
}

@keyframes checkStroke {
  to { stroke-dashoffset: 0; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(79, 110, 247, 0.35); }
  50%      { box-shadow: 0 4px 24px rgba(79, 110, 247, 0.55); }
}

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Responsive ---------- */

/* Tablet */
@media (max-width: 768px) {
  .form-card {
    padding: 28px 24px;
    margin: -16px 12px 32px;
    border-radius: 14px;
  }

  .survey-banner {
    padding: 48px 20px 40px;
  }

  .section-header {
    margin-bottom: 22px;
  }

  .submit-wrapper {
    margin-top: 32px;
  }

  .btn-submit {
    max-width: 100%;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .form-card {
    padding: 20px 16px;
    margin: -12px 8px 24px;
    border-radius: 12px;
  }

  .survey-banner {
    padding: 40px 16px 36px;
  }

  .survey-banner h1 {
    font-size: 1.35rem;
  }

  .survey-banner .banner-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .section-number {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
    border-radius: 10px;
  }

  .section-title {
    font-size: 1.02rem;
  }

  .radio-item label,
  .checkbox-item label {
    padding: 10px 14px;
    font-size: 0.85rem;
    gap: 12px;
  }

  .form-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
  }

  .progress-text {
    font-size: 11px;
    top: 8px;
    right: 12px;
    padding: 3px 10px;
  }

  .thankyou-card {
    padding: 40px 24px;
  }

  .thankyou-checkmark {
    width: 72px;
    height: 72px;
  }

  .thankyou-card h2 {
    font-size: 1.4rem;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
