/* ═══════════════════════════════════════════════════════════════════
   Onboarding Page Styles
   Warm editorial design matching the landing page
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Grain Overlay ───────────────────────────────────────────────── */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px;
}

/* ─── Container ───────────────────────────────────────────────────── */
.onboard-container {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  position: relative;
  z-index: 1;
}

/* ─── Step Indicator ──────────────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.5rem;
}

.step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #d4d0c9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Mono", monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-m);
  background: var(--c-bg);
  transition: all 0.4s var(--ease-out);
  position: relative;
  z-index: 2;
}

.step-dot.active {
  border-color: var(--primary);
  color: var(--c-surface);
  background: var(--primary);
  box-shadow: 0 3px 12px rgba(var(--primary-rgb), 0.25);
}

.step-dot.done {
  border-color: var(--teal);
  color: var(--c-surface);
  background: var(--teal);
}

.step-line {
  width: 60px;
  height: 2px;
  background: #e8e3da;
  position: relative;
  overflow: hidden;
}

.step-line-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: var(--teal);
  transition: width 0.5s var(--ease-out);
}

.step-line-fill.filled {
  width: 100%;
}

/* ─── Step Panels ─────────────────────────────────────────────────── */
.step-panel {
  display: none;
  animation: fadeSlideIn 0.45s var(--ease-out) both;
}

.step-panel.active {
  display: block;
}

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

/* ─── Role Cards ──────────────────────────────────────────────────── */
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.role-card {
  background: var(--c-surface);
  border: 2px solid rgba(var(--ink-rgb), 0.08);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition:
    border-color 0.3s,
    transform 0.3s var(--ease-out),
    box-shadow 0.3s;
  font-family: inherit;
  color: inherit;
}

.role-card:hover {
  border-color: rgba(var(--ink-rgb), 0.16);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(var(--ink-rgb), 0.06);
}

.role-card.selected {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px rgba(var(--primary-rgb), 0.12),
    0 8px 28px rgba(var(--ink-rgb), 0.06);
  transform: translateY(-2px);
}

.role-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.role-icon svg {
  width: 26px;
  height: 26px;
}

.role-icon-artisan {
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
}

.role-icon-client {
  background: rgba(var(--teal-rgb), 0.08);
  color: var(--teal);
}

.role-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 0.25s,
    transform 0.25s var(--ease-spring);
}

.role-check svg {
  width: 12px;
  height: 12px;
  stroke: var(--c-surface);
}

.role-card.selected .role-check {
  opacity: 1;
  transform: scale(1);
}

/* ─── Buttons ─────────────────────────────────────────────────────── */
.btn-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0.85rem 2.25rem;
  background: var(--primary);
  /* background: linear-gradient(135deg, var(--primary), #E8713A); */
  color: var(--c-surface);
  font-size: 0.9375rem;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-spring),
    box-shadow 0.25s,
    opacity 0.25s;
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.25);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.text-accent {
  color: var(--primary);
  font-weight: 700;
}

.btn-next::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18),
    transparent 60%
  );
  pointer-events: none;
}

.btn-next:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 28px rgba(var(--primary-rgb), 0.35);
}

.btn-next:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ─── Social Auth ─────────────────────────────────────────────────── */
.social-auth {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-out),
    box-shadow 0.2s,
    border-color 0.2s;
}

.social-google {
  background: var(--c-surface);
  border: 1.5px solid rgba(var(--ink-rgb), 0.1);
  color: var(--ink);
}
.social-google:hover {
  border-color: rgba(var(--ink-rgb), 0.25);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.social-facebook {
  background: #1877f2;
  border: 1.5px solid #1877f2;
  color: var(--c-surface);
}
.social-facebook:hover {
  background: #166fe5;
  box-shadow: 0 4px 16px rgba(24, 119, 242, 0.25);
  transform: translateY(-1px);
}

/* ─── Divider ─────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(var(--ink-rgb), 0.08);
}

.divider span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-m);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ─── Form ────────────────────────────────────────────────────────── */
.signup-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-s);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid rgba(var(--ink-rgb), 0.1);
  border-radius: 12px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--c-surface);
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
  outline: none;
}

.form-group input::placeholder {
  color: #c4bfb8;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.08);
}

.form-group input.error {
  border-color: #e11d48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.08);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 3rem;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
  padding: 4px;
}

.pw-toggle:hover {
  opacity: 0.7;
}

.pw-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
}

.form-error {
  font-size: 0.8125rem;
  color: #e11d48;
  min-height: 1.25rem;
}

/* ─── Trade select styling ────────────────────────────────────────── */
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239E9890' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ─── Welcome Screen ──────────────────────────────────────────────── */
.welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(var(--teal-rgb), 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  animation: welcomePop 0.5s var(--ease-spring) both 0.15s;
}

.welcome-icon svg {
  width: 40px;
  height: 40px;
  stroke: var(--teal);
}

@keyframes welcomePop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.verify-note {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(var(--secondary-rgb), 0.08);
  border: 1px solid rgba(var(--secondary-rgb), 0.15);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--ink-s);
  line-height: 1.5;
  text-align: left;
  max-width: 400px;
  margin: 1rem auto 0;
}

.verify-note svg {
  flex-shrink: 0;
  margin-top: 2px;
  stroke: var(--secondary);
}

/* ─── Loading State ───────────────────────────────────────────────── */
.btn-next.loading {
  pointer-events: none;
}

.btn-next.loading::after {
  content: "";
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--c-surface);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ─── Back Button ─────────────────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-s);
  background: none;
  border: 1.5px solid rgba(var(--ink-rgb), 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s,
    background 0.2s;
  margin-bottom: 1rem;
}

.btn-back:hover {
  color: var(--ink);
  border-color: rgba(var(--ink-rgb), 0.25);
  background: rgba(var(--ink-rgb), 0.03);
}

/* ─── Verification Code ───────────────────────────────────────────── */
.verify-code-wrap {
  max-width: 360px;
  margin: 1.5rem auto 0;
}

.code-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.code-box {
  width: 48px;
  height: 56px;
  border: 2px solid rgba(var(--ink-rgb), 0.1);
  border-radius: 12px;
  text-align: center;
  font-family: "Space Mono", monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--c-surface);
  outline: none;
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
}

.code-box:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.code-box.filled {
  border-color: var(--teal);
  background: rgba(var(--teal-rgb), 0.04);
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .role-grid {
    grid-template-columns: 1fr;
  }

  .onboard-container {
    padding: 2rem 1rem;
  }

  .step-line {
    width: 40px;
  }

  /* Make grid layout form rows stack on mobile */
  .form-row[style*="grid"] {
    grid-template-columns: 1fr !important;
  }
}
