:root {
  --primary: #1e3a8a;
  --primary-dark: #0f172a;
  --gradient: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  --gradient-hover: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  --gradient-2: linear-gradient(135deg, #047857 0%, #10b981 100%);
  --gradient-danger: linear-gradient(135deg, #991b1b 0%, #ef4444 100%);
  --shadow: 0 10px 30px rgba(30, 58, 138, 0.15);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.25);
  --radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  min-height: 100vh;
  color: #1e293b;
  overflow-x: hidden;
}

/* Animated Background Particles */
.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 50%;
  animation: floatUp linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-duration: 12s; animation-delay: 0s; width: 4px; height: 4px; }
.particle:nth-child(2) { left: 25%; animation-duration: 15s; animation-delay: 2s; width: 8px; height: 8px; }
.particle:nth-child(3) { left: 40%; animation-duration: 10s; animation-delay: 4s; }
.particle:nth-child(4) { left: 55%; animation-duration: 18s; animation-delay: 1s; width: 5px; height: 5px; }
.particle:nth-child(5) { left: 70%; animation-duration: 14s; animation-delay: 3s; width: 7px; height: 7px; }
.particle:nth-child(6) { left: 85%; animation-duration: 11s; animation-delay: 5s; }
.particle:nth-child(7) { left: 50%; animation-duration: 16s; animation-delay: 6s; width: 4px; height: 4px; }
.particle:nth-child(8) { left: 15%; animation-duration: 13s; animation-delay: 7s; width: 9px; height: 9px; }

@keyframes floatUp {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* App Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40vh; /* dynamic bottom padding for keyboard scroll-into-view */
  min-height: 100vh;
}

/* Header */
.app-header {
  text-align: center;
  padding: 30px 20px 20px;
  animation: fadeInDown 0.8s ease-out;
}

.app-logo {
  width: 70px;
  height: 70px;
  background: var(--gradient);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: var(--shadow);
  font-size: 32px;
  color: white;
  animation: pulse 2s ease-in-out infinite;
}

.app-header h1 {
  color: var(--primary-dark);
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.app-header p {
  color: #64748b;
  font-size: clamp(0.9rem, 4vw, 1rem);
}

/* Progress Bar */
.progress-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 24px 0 30px;
  padding: 0 10px;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(32px, 8vw, 42px);
  height: clamp(32px, 8vw, 42px);
  border-radius: 50%;
  background: #e2e8f0;
  color: #94a3b8;
  font-weight: 700;
  font-size: clamp(0.75rem, 3vw, 0.9rem);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
}

.step-indicator.active {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
  transform: scale(1.15);
}

.step-indicator.completed {
  background: var(--gradient-2);
  color: white;
  box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
}

.step-indicator.completed::after {
  content: '✓';
  position: absolute;
  font-size: 1rem;
}

.step-indicator.completed span {
  visibility: hidden;
}

.step-line {
  flex: 1;
  height: 3px;
  background: #e2e8f0;
  transition: background 0.5s ease;
  max-width: 55px;
}

.step-line.completed {
  background: var(--gradient-2);
}

.step-label {
  position: absolute;
  top: clamp(38px, 10vw, 50px);
  font-size: clamp(0.55rem, 2vw, 0.7rem);
  color: #94a3b8;
  white-space: nowrap;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

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

/* Card */
.form-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.form-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.card-header-bar {
  background: var(--gradient);
  padding: 20px 24px;
  color: white;
}

.card-header-bar h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-header-bar p {
  font-size: 0.8rem;
  opacity: 0.8;
}

.card-body-content {
  padding: 24px;
}

/* Step Transitions */
.step-transition {
  display: none; /* Hide by default, show via JS */
  animation: slideInFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@keyframes slideInFade {
  from {
    opacity: 0;
    transform: translateX(15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
  animation: fadeInUp 0.4s ease-out backwards;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: #444;
  margin-bottom: 8px;
}

.form-group label small {
  font-weight: 400;
  color: #999;
}

.form-input {
  width: 100%;
  padding: 16px 16px;
  min-height: 48px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: clamp(1rem, 4vw, 1.05rem);
  font-weight: 500;
  color: #1e293b;
  background: #f8fafc;
  transition: all 0.3s ease;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
}

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

select.form-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

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

/* Amount Display */
.amount-display {
  background: linear-gradient(135deg, #f8f9fc 0%, #eef1f8 100%);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-top: 8px;
}

.amount-display .label {
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.amount-display .value {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 16px 24px;
  border: none;
  border-radius: 14px;
  font-size: clamp(1rem, 4vw, 1.05rem);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  background: var(--gradient-hover);
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-glow);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid #e8ecf4;
  box-shadow: none;
}

.btn-secondary:hover {
  background: #f8f9fc;
  border-color: var(--primary);
}

.btn-success {
  background: var(--gradient-2);
  color: white;
  box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(17, 153, 142, 0.5);
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-row .btn {
  flex: 1;
}

.btn-row .btn-secondary {
  flex: 0.5;
}

/* Review Summary */
.review-section {
  margin-bottom: 20px;
}

.review-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}

.review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
  animation: fadeInUp 0.3s ease-out backwards;
}

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

.review-item .item-label {
  font-size: 0.85rem;
  color: #777;
}

.review-item .item-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #333;
}

.review-total {
  background: linear-gradient(135deg, #f8f9fc 0%, #eef1f8 100%);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}

.review-total .review-item {
  border: none;
  padding: 6px 0;
}

.review-total .item-value {
  font-size: 1.1rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Auth Fee Section */
.auth-fee-card {
  text-align: center;
  padding: 20px 0;
}

.auth-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff4e5 0%, #ffe0b2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
  animation: bounceIn 0.8s ease-out;
}

.auth-fee-card h3 {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 10px;
}

.auth-fee-card p {
  color: #777;
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.fee-badge {
  display: inline-block;
  padding: 10px 28px;
  background: var(--gradient);
  color: white;
  border-radius: 30px;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
  animation: pulse 2s ease-in-out infinite;
}

.info-list {
  text-align: left;
  margin: 20px 0;
}

.info-list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.83rem;
  color: #555;
}

.info-list-item .icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e8f5e9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Status Screen */
.status-screen {
  text-align: center;
  padding: 30px 0;
}

.status-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 48px;
}

.status-icon.success {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  animation: bounceIn 0.8s ease-out;
}

.status-screen h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: #333;
}

.status-screen p {
  color: #777;
  font-size: 0.9rem;
  line-height: 1.6;
}

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

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spinPulse {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.shimmer-text {
  background: linear-gradient(90deg, #667eea 25%, #a78bfa 50%, #667eea 75%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* Loan Slider */
.range-slider {
  width: 100%;
  margin: 10px 0;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, #e8ecf4 0%);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
  border: 3px solid white;
  transition: transform 0.2s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #aaa;
  margin-top: 4px;
}

/* Social Proof */
#social-proof {
  min-width: 300px;
  max-width: 340px;
  background: white;
  border: none;
  display: none;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: fixed;
  top: -2px;
  margin-top: -110px;
  left: 16px;
  z-index: 999;
}

#social-proof #title { font-weight: 700; color: var(--primary); font-size: 14px; margin-bottom: 4px; }
#social-proof #description { font-size: 13px; color: #393939; margin: 4px 0 6px; }
#social-proof .course { font-weight: 600; color: var(--primary-dark); }
#social-proof .address { color: var(--primary); font-weight: 600; }
#social-proof #time { font-size: 11px; color: #999; font-style: italic; }

/* Trusted badge */
.trust-badges {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.trust-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 20px;
}

/* Loading spinner */
.loader-ring {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 4px solid rgba(102, 126, 234, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinPulse 1s linear infinite;
  margin: 20px auto;
}

/* Slide transitions */
.slide-out-left { animation: slideOutLeft 0.3s ease-in forwards; }
.slide-in-right { animation: slideInRight 0.4s ease-out; }

@keyframes slideOutLeft {
  to { transform: translateX(-30px); opacity: 0; }
}

@keyframes slideInRight {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 480px) {
  .app-container { padding: 16px 12px 100px; }
}

@media (min-width: 768px) {
  .app-container {
    margin-top: 5vh;
    margin-bottom: 5vh;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 40px 24px 80px;
    min-height: auto;
  }
  .app-header { padding-top: 10px; }
}

@media (max-width: 380px) {
  .app-container { padding: 12px 10px 80px; }
  .card-body-content { padding: 16px; }
  .step-indicator { width: 32px; height: 32px; font-size: 0.75rem; }
  .step-label { font-size: 0.5rem; }
}
