/* ========== Apple-inspired Design System ========== */
:root {
  --bg: #f5f5f7;
  --white: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ED;
  --accent-light: rgba(0, 113, 227, 0.08);
  --success: #34c759;
  --success-bg: rgba(52, 199, 89, 0.08);
  --warning: #ff9f0a;
  --warning-bg: rgba(255, 159, 10, 0.08);
  --danger: #ff3b30;
  --danger-bg: rgba(255, 59, 48, 0.08);
  --border: #d2d2d7;
  --border-light: #e8e8ed;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ========== Language Selector Page ========== */
.lang-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(180deg, #f5f5f7 0%, #e8e8ed 100%);
}

.lang-container {
  text-align: center;
  max-width: 520px;
  width: 100%;
  animation: fadeInUp 0.6s ease;
}

.lang-logo {
  width: 72px;
  height: 72px;
  background: var(--accent);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.3);
}

.lang-logo svg {
  width: 36px;
  height: 36px;
  fill: white;
}

.lang-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.lang-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 40px;
}

.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.lang-card {
  background: var(--white);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  position: relative;
  overflow: hidden;
}

.lang-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.lang-card:active {
  transform: translateY(-2px) scale(0.98);
}

.lang-flag {
  width: 72px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.08);
}

.lang-flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

.lang-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.lang-native {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========== Language Switcher (top of form) ========== */
.lang-switcher {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 980px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  transition: var(--transition);
  box-shadow: var(--shadow);
}

.lang-switcher:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.switcher-flag {
  width: 24px;
  height: 16px;
  border-radius: 3px;
  overflow: hidden;
  display: inline-flex;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.switcher-flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 600px) {
  .lang-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .lang-card { padding: 22px 12px; }
  .lang-flag { font-size: 36px; }
  .lang-title { font-size: 26px; }
  .lang-subtitle { font-size: 14px; margin-bottom: 28px; }
  .lang-switcher { top: 10px; right: 10px; padding: 6px 12px; font-size: 12px; }
  .lang-switcher span:first-child { font-size: 16px; }
}

/* ========== Form Page Layout ========== */
.form-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 60px;
}

.form-header {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeInDown 0.6s ease;
}

.form-header .logo {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3);
}

.form-header .logo svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.form-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.form-header p {
  color: var(--text-secondary);
  font-size: 17px;
  max-width: 460px;
}

/* ========== Progress Bar ========== */
.progress-container {
  width: 100%;
  max-width: 580px;
  margin-bottom: 32px;
  animation: fadeIn 0.6s ease 0.1s both;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.progress-line {
  position: absolute;
  top: 16px;
  left: 32px;
  right: 32px;
  height: 2px;
  background: var(--border-light);
  z-index: 0;
}

.progress-line-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
  border-radius: 2px;
}

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  cursor: default;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  margin-bottom: 8px;
}

.step-indicator.active .step-circle {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.step-indicator.completed .step-circle {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  max-width: 80px;
  transition: var(--transition);
}

.step-indicator.active .step-label {
  color: var(--accent);
  font-weight: 600;
}

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

/* ========== Form Card ========== */
.form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 580px;
  overflow: hidden;
  animation: fadeInUp 0.5s ease 0.2s both;
}

.form-card-body {
  padding: 36px;
}

.step-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.step-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 28px;
}

/* ========== Form Fields ========== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

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

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  transition: var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder {
  color: #c7c7cc;
}

.form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

.error-text {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.form-group.has-error .error-text {
  display: block;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2386868b' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

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

/* ========== Radio Group ========== */
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.radio-option {
  position: relative;
}

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

.radio-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.radio-option input[type="radio"]:checked + label {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.radio-option label:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

/* ========== Loan Type Cards ========== */
.loan-type-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.loan-type-option {
  position: relative;
}

.loan-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.loan-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.loan-type-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.loan-type-option input:checked + .loan-type-card {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.loan-type-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 24px;
}

.loan-type-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.loan-type-card p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ========== Buttons ========== */
.form-actions {
  display: flex;
  justify-content: space-between;
  padding: 20px 36px 28px;
  border-top: 1px solid var(--border-light);
}

.btn {
  padding: 12px 28px;
  border-radius: 980px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--accent);
}
.btn-secondary:hover { background: var(--accent-light); }

.btn-success {
  background: var(--success);
  color: white;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========== Summary Step ========== */
.summary-section {
  margin-bottom: 20px;
}

.summary-section h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}

.summary-row .label {
  color: var(--text-secondary);
}

.summary-row .value {
  font-weight: 600;
  text-align: right;
  max-width: 60%;
}

/* ========== Success Screen ========== */
.success-screen {
  text-align: center;
  padding: 60px 36px;
  animation: fadeInUp 0.6s ease;
}

.success-icon {
  width: 72px;
  height: 72px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s both;
}

.success-icon svg { width: 36px; height: 36px; stroke: var(--success); fill: none; }

.success-screen h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-screen p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 8px;
}

.reference-box {
  display: inline-block;
  background: var(--bg);
  padding: 12px 24px;
  border-radius: var(--radius);
  margin: 16px 0 24px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  border: 1.5px dashed var(--accent);
}

/* ========== Animations ========== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@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 scaleIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.step-content {
  animation: fadeInUp 0.4s ease;
}

/* ========== Mobile ========== */
@media (max-width: 600px) {
  .form-page { padding: 24px 16px 40px; }
  .form-header h1 { font-size: 26px; }
  .form-header p { font-size: 15px; }
  .form-card-body { padding: 24px 20px; }
  .form-actions { padding: 16px 20px 20px; }
  .form-row { grid-template-columns: 1fr; }
  .radio-group { grid-template-columns: 1fr 1fr; }
  .loan-type-group { grid-template-columns: 1fr; }
  .step-label { font-size: 10px; max-width: 60px; }
  .progress-steps { padding: 0 4px; }
  .summary-row { font-size: 13px; }
  .btn { padding: 12px 22px; font-size: 14px; }
}
