/* ═══════════════════════════════════════════════════════════════════
   WhasaaS — Onboarding Register CSS
   Mobile-First, Spectacular Dark Mode Theme with Glassmorphism
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --color-bg-deep:      #0A0E1A;      /* Night Blue background */
  --color-primary:      #00A884;      /* WhatsApp Green */
  --color-primary-glow: rgba(0, 168, 132, 0.15);
  --color-accent:       #7C3AED;      /* Violet accent */
  --color-accent-glow:  rgba(124, 58, 237, 0.25);
  
  --color-card-bg:      rgba(255, 255, 255, 0.03); /* Glassmorphism */
  --color-card-border:  rgba(255, 255, 255, 0.08);
  --color-card-hover:   rgba(255, 255, 255, 0.06);

  --color-text-primary:  #F8FAFC;
  --color-text-secondary:#94A3B8;
  --color-text-muted:    #64748B;
  
  --color-input-bg:     rgba(15, 23, 42, 0.6);
  --color-input-border: rgba(255, 255, 255, 0.1);
  --color-input-focus:  #7C3AED;

  --color-success:      #10B981;
  --color-warning:      #F59E0B;
  --color-danger:       #EF4444;

  --radius-sm:          8px;
  --radius-md:          12px;
  --radius-lg:          18px;
  --radius-xl:          24px;
  
  --shadow-premium:     0 25px 50px -12px rgba(0, 0, 0, 0.7);
  --transition-smooth:  all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display:       'Outfit', sans-serif;
  --font-body:          'Plus Jakarta Sans', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--color-bg-deep);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  padding: 1rem;
}

/* Background gradients decoration */
.bg-glow-1 {
  position: fixed;
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

.bg-glow-2 {
  position: fixed;
  bottom: -10%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 168, 132, 0.1) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

/* Layout containers */
.register-container {
  width: 100%;
  max-width: 560px;
  margin-top: 2rem;
  margin-bottom: 3rem;
  z-index: 2;
  animation: registerFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Headings */
.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.75rem;
  color: white;
  margin-bottom: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.3);
}

.logo-area h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #ffffff, #94A3B8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Progress bar / Wizard Steps */
.wizard-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 2.5rem;
  padding: 0 1rem;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 1;
}

.wizard-progress {
  position: absolute;
  top: 16px;
  left: 0;
  height: 4px;
  background: linear-gradient(to right, var(--color-primary), var(--color-accent));
  z-index: 2;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-indicator {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40px;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #1E293B;
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  transition: var(--transition-smooth);
}

.step-indicator.active .step-circle {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
  box-shadow: 0 0 15px var(--color-accent-glow);
  transform: scale(1.1);
}

.step-indicator.completed .step-circle {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: 0 0 12px var(--color-primary-glow);
}

.step-label {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
  transition: var(--transition-smooth);
}

.step-indicator.active .step-label {
  color: white;
}

.step-indicator.completed .step-label {
  color: var(--color-primary);
}

/* Glassmorphism Card */
.glass-card {
  background-color: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-premium);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 2.25rem 2rem;
  position: relative;
  overflow: hidden;
}

/* Fields & inputs */
.step-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  color: white;
}

.step-desc {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
  line-height: 1.5;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.form-input-container {
  position: relative;
}

.form-input-container .input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
  transition: var(--transition-smooth);
}

/* Prevent iOS zooming by forcing font size >= 16px */
.form-control {
  width: 100%;
  background-color: var(--color-input-bg);
  border: 1.5px solid var(--color-input-border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  color: white;
  font-size: 16px;
  font-family: var(--font-body);
  outline: none;
  transition: var(--transition-smooth);
  height: 48px; /* Safe minimum touch height */
}

.form-control::placeholder {
  color: var(--color-text-muted);
}

.form-control:focus {
  border-color: var(--color-accent);
  background-color: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.form-control:focus ~ .input-icon {
  color: var(--color-accent);
}

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

/* Google OAuth Button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  height: 48px;
  background-color: white;
  border: none;
  border-radius: var(--radius-md);
  color: #1E293B;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: var(--transition-smooth);
}

.btn-google:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  background-color: #F8FAFC;
}

.btn-google svg {
  width: 20px;
  height: 20px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--color-card-border);
}

/* Terms checkbox */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.checkbox-group input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--color-input-border);
  background-color: var(--color-input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.checkbox-group:hover input ~ .checkmark {
  border-color: var(--color-accent);
}

.checkbox-group input:checked ~ .checkmark {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

.checkmark::after {
  content: '';
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  display: none;
}

.checkbox-group input:checked ~ .checkmark::after {
  display: block;
}

.checkbox-label a {
  color: var(--color-accent);
  text-decoration: none;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

/* Submit CTAs */
.btn-submit {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 8px 20px -4px rgba(124, 58, 237, 0.4);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -4px rgba(124, 58, 237, 0.5);
  background: linear-gradient(135deg, var(--color-primary) 20%, var(--color-accent) 100%);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Step 2 — OTP inputs */
.otp-container {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.otp-box {
  width: 100%;
  max-width: 58px;
  height: 58px;
  background-color: var(--color-input-bg);
  border: 2px solid var(--color-input-border);
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  text-align: center;
  outline: none;
  transition: var(--transition-smooth);
}

.otp-box:focus {
  border-color: var(--color-accent);
  background-color: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.cooldown-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 1rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-accent);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.btn-link:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* Step 3 — Plans selection */
.plan-toggle-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  background-color: rgba(15, 23, 42, 0.4);
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-card-border);
  max-width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.toggle-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
  padding: 0.25rem 0.75rem;
}

.toggle-label.active {
  color: white;
  background-color: var(--color-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.2);
}

.discount-badge {
  background-color: var(--color-success);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.plans-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.plan-card {
  background-color: rgba(30, 41, 59, 0.4);
  border: 2px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.plan-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background-color: rgba(30, 41, 59, 0.6);
  transform: translateY(-2px);
}

.plan-card.selected {
  border-color: var(--color-accent);
  background-color: rgba(124, 58, 237, 0.05);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.1);
}

.popular-badge {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-header {
  margin-bottom: 1rem;
}

.plan-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.25rem;
}

.plan-price-box {
  display: flex;
  align-items: baseline;
  margin: 0.75rem 0;
}

.plan-currency {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.plan-price {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.plan-period {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-left: 0.25rem;
}

.plan-features {
  list-style: none;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--color-card-border);
  padding-top: 1rem;
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.plan-features li svg {
  color: var(--color-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.plans-action-area {
  margin-top: 2rem;
}

/* Step 4 — Connect WhatsApp QR */
.qr-card-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-box-wrapper {
  position: relative;
  width: 240px;
  height: 240px;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.qr-image {
  width: 220px;
  height: 220px;
  border-radius: var(--radius-sm);
  display: block;
}

.qr-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(10, 14, 26, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  gap: 0.75rem;
  backdrop-filter: blur(4px);
  transition: var(--transition-smooth);
}

.qr-overlay .spinner {
  display: block;
  width: 32px;
  height: 32px;
  border-width: 3px;
  border-top-color: var(--color-accent);
}

.qr-overlay-text {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.qr-instructions {
  text-align: left;
  background-color: rgba(30, 41, 59, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.qr-instructions ol {
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qr-instructions ol li strong {
  color: white;
}

.test-message-box {
  width: 100%;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-card-border);
  text-align: left;
  display: none; /* Shows up only when connected */
  animation: registerFadeIn 0.4s ease;
}

.test-message-box.active {
  display: block;
}

.skip-step-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  margin-top: 1rem;
  transition: var(--transition-smooth);
}

.skip-step-btn:hover {
  color: white;
  text-decoration: underline;
}

/* Onboarding recovery recovery-card */
.recovery-card {
  display: none;
  animation: registerFadeIn 0.5s ease;
}

.recovery-card.active {
  display: block;
}

.main-register-card {
  display: block;
}

.main-register-card.hidden {
  display: none;
}

/* Success screen (Complete) */
.success-screen {
  text-align: center;
  padding: 1rem 0;
}

.success-icon-wrap {
  width: 80px;
  height: 80px;
  background-color: rgba(16, 185, 129, 0.1);
  border: 2px solid var(--color-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--color-success);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.2);
  animation: successPulse 2s infinite;
}

@keyframes successPulse {
  0% { transform: scale(1); box-shadow: 0 0 25px rgba(16, 185, 129, 0.2); }
  50% { transform: scale(1.05); box-shadow: 0 0 35px rgba(16, 185, 129, 0.4); }
  100% { transform: scale(1); box-shadow: 0 0 25px rgba(16, 185, 129, 0.2); }
}

.success-icon-wrap svg {
  width: 44px;
  height: 44px;
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  pointer-events: none;
}

/* Flash alerts */
.flash-message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: registerFadeIn 0.3s ease;
}

.flash-danger {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
}

.flash-success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #6EE7B7;
}

/* Footer links */
.register-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.register-footer a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.register-footer a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ─── Country Code + Phone Input Row ─────────────────────────────── */
.phone-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.country-select {
  width: auto;
  min-width: 180px;
  max-width: 220px;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.4;
}

.country-select:focus {
  border-color: var(--color-accent);
  background-color: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

/* Responsive queries */
@media (max-width: 600px) {
  body {
    padding: 0.5rem;
  }
  
  .register-container {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
  }
  
  .glass-card {
    padding: 1.5rem 1.25rem;
    border-radius: var(--radius-lg);
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .phone-input-row {
    flex-direction: column;
  }

  .country-select {
    min-width: 100%;
    max-width: 100%;
  }
  
  .wizard-steps {
    margin-bottom: 1.5rem;
  }
  
  .step-label {
    display: none; /* Hide step names on mobile screens */
  }
  
  .step-circle {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
  
  .wizard-steps::before, .wizard-progress {
    top: 14px;
  }
}

@media (min-width: 601px) {
  .plans-grid {
    grid-template-columns: 1fr 1fr;
  }
  .plans-grid.three-plans {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
