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

:root {
  --primary: #1e3a8a;
  --primary-hover: #172554;
  --primary-light: #eff6ff;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #0b1329 0%, #1e293b 100%);
  color: #ffffff;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #ffffff;
}

.brand-badge {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-text h1 span.badge-us {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-sub);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Save Status Indicator */
.save-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: #e2e8f0;
  backdrop-filter: blur(8px);
}

.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.save-dot.saving {
  background-color: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: pulse 1s infinite;
}

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

.access-code-badge {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.access-code-badge:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
}

.btn-header {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Progress Tracker Bar */
.progress-strip-container {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 73px;
  z-index: 40;
}

.progress-strip-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
}

.progress-meta .step-name {
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress-meta .percent {
  font-weight: 700;
  color: var(--accent);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #38bdf8 100%);
  width: 8%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Steps Horizontal Scroller (Desktop/Tablet) */
.steps-nav-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.6rem 0 0.2rem 0;
  scrollbar-width: thin;
}

.steps-nav-bar::-webkit-scrollbar {
  height: 4px;
}
.steps-nav-bar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.step-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: #f1f5f9;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-chip:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.step-chip.active {
  background: var(--accent-light);
  color: var(--primary);
  font-weight: 600;
  border-color: #93c5fd;
}

.step-chip.completed {
  background: var(--success-light);
  color: var(--success);
  border-color: #a7f3d0;
}

/* Main Layout */
.main-wrapper {
  max-width: 1000px;
  margin: 1.5rem auto 5rem auto;
  padding: 0 1.25rem;
}

/* Form Card */
.form-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: all 0.2s ease;
}

.step-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
}

.step-header-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.step-header-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.step-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.step-subtitle {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* Form Grid */
.fields-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem 1rem;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-2 { grid-column: span 2; }

@media (max-width: 768px) {
  .col-8, .col-6, .col-4, .col-3, .col-2 {
    grid-column: span 12 !important;
  }
  .form-card {
    padding: 1.25rem;
  }
}

/* Form Fields */
.form-group {
  display: flex;
  flex-direction: column;
  position: relative;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label .en-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-sub);
  font-style: italic;
}

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

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #e2e8f0;
  color: #475569;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 0.35rem;
  cursor: help;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input.uppercase {
  text-transform: uppercase;
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

/* Radio Cards */
.radio-cards-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.radio-card-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.radio-card-label:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.radio-card-label input[type="radio"] {
  accent-color: var(--accent);
}

.radio-card-label.checked {
  background: var(--accent-light);
  border-color: #93c5fd;
  color: var(--primary);
  font-weight: 600;
}

/* Section Header Divider */
.section-divider-card {
  grid-column: span 12;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f1f5f9;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
}

.section-divider-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.section-divider-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Hints & Tooltip Popovers */
.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Conditional Field Transitions */
.conditional-field {
  transition: all 0.3s ease;
}
.conditional-field.hidden {
  display: none !important;
}

/* Actions Bar */
.form-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.35);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Review Step Styling */
.review-container {
  grid-column: span 12;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.review-section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
}

.review-section-header {
  padding: 0.85rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.review-section-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-edit-step {
  font-size: 0.78rem;
  color: var(--accent);
  background: none;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.btn-edit-step:hover {
  text-decoration: underline;
}

.review-grid {
  padding: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.review-item {
  display: flex;
  flex-direction: column;
}

.review-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.review-item-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
  margin-top: 0.15rem;
}

.review-item-val.empty {
  color: var(--text-sub);
  font-style: italic;
  font-weight: 400;
}

/* Submission Modal / Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: all 0.3s ease;
  position: relative;
}

.modal-backdrop.open .modal-content {
  transform: translateY(0);
}

.modal-success-icon {
  width: 60px;
  height: 60px;
  background: var(--success-light);
  color: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.25rem auto;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-code-box {
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-code-box .code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.modal-code-box .code-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-top: 0.25rem;
  user-select: all;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 999;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(50px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-left: 4px solid #10b981;
}

.toast.error {
  border-left: 4px solid #ef4444;
}

/* Footer Info */
.footer-info {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 2rem 0;
}
