:root {
  --primary-900: #0b2341;
  --primary-800: #12345e;
  --primary-700: #1a4980;
  --primary-600: #1e5ba8;
  --primary-500: #2563eb;
  --primary-400: #60a5fa;
  --accent-cyan: #06b6d4;
  --accent-teal: #0d9488;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --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);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Brand */
.site-header {
  background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-800) 50%, var(--primary-700) 100%);
  color: #ffffff;
  padding: 1.25rem 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: white;
}

.brand-logo-img {
  height: 42px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-sm);
  transition: transform 0.2s ease;
}

.logo-badge:hover .brand-logo-img {
  transform: scale(1.02);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-text h1 span {
  color: var(--accent-cyan);
}

.brand-tagline {
  font-size: 0.78rem;
  color: #cbd5e1;
  font-weight: 500;
  letter-spacing: 0.5px;
}

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

.admin-link-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.admin-link-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* Main Container */
.main-wrapper {
  max-width: 960px;
  margin: 2.5rem auto;
  padding: 0 1.25rem;
  flex: 1;
  width: 100%;
}

/* Hero Card */
.form-hero {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.form-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary-900), var(--primary-500), var(--accent-cyan));
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary-900);
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.hero-alert {
  background: #eff6ff;
  border-left: 4px solid var(--primary-500);
  padding: 0.85rem 1.15rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: #1e3a8a;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.auto-save-indicator {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.auto-save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

/* Stepper Bar */
.stepper-nav-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.stepper-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.stepper-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-900);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stepper-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-500);
  background: #eff6ff;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
}

.progress-track {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.progress-bar-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--primary-600), var(--accent-cyan));
  border-radius: var(--radius-full);
  transition: width 0.4s ease-in-out;
}

.steps-list {
  display: flex;
  justify-content: space-between;
  list-style: none;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 65px;
  cursor: pointer;
  position: relative;
  text-align: center;
  opacity: 0.6;
  transition: var(--transition);
}

.step-item:hover {
  opacity: 0.85;
}

.step-item.active {
  opacity: 1;
}

.step-item.completed {
  opacity: 0.9;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 2px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  transition: var(--transition);
}

.step-item.active .step-circle {
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.step-item.completed .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.step-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.step-item.active .step-label {
  color: var(--primary-600);
  font-weight: 700;
}

/* Form Sections */
.form-step-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.form-step-content.active {
  display: block;
}

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

.section-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.section-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.section-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #eff6ff;
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-900);
  margin-bottom: 0.25rem;
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* Field Groups & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.35rem;
}

.field-group {
  margin-bottom: 1.5rem;
}

.field-group.full-width {
  grid-column: 1 / -1;
}

.field-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.field-label .req {
  color: var(--danger);
  margin-left: 0.25rem;
}

.field-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.input-text,
.input-select,
.input-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  min-height: 48px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: #ffffff;
  transition: var(--transition);
  box-sizing: border-box;
}

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

.input-textarea {
  min-height: 96px;
  resize: vertical;
}

/* Checkbox & Radio Tiles */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.option-tile {
  position: relative;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: var(--transition);
  min-height: 48px;
  user-select: none;
}

.option-tile:hover {
  border-color: var(--primary-400);
  background: #f8fafc;
}

.option-tile input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-tile-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.option-tile input[type="radio"] + .option-tile-check {
  border-radius: 50%;
}

.option-tile:has(input:checked),
.option-tile.selected {
  border-color: var(--primary-500);
  background: #eff6ff;
  color: var(--primary-800);
  font-weight: 600;
}

.option-tile:has(input:checked) .option-tile-check,
.option-tile.selected .option-tile-check {
  background: var(--primary-500);
  border-color: var(--primary-500);
}

.option-tile:has(input:checked) .option-tile-check::after,
.option-tile.selected .option-tile-check::after {
  content: '';
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 1px;
}

.option-tile:has(input[type="radio"]:checked) .option-tile-check::after,
.option-tile input[type="radio"] + .option-tile-check::after {
  border-radius: 50%;
}

/* File Upload Zone */
.file-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.5rem 1.25rem;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
  border-color: var(--primary-500);
  background: #eff6ff;
}

.file-upload-icon {
  font-size: 1.75rem;
  color: var(--primary-500);
  margin-bottom: 0.35rem;
}

.file-upload-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.file-upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.file-preview-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
}

.file-name-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-file-btn {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.remove-file-btn:hover {
  background: #fee2e2;
}

/* Navigation Buttons */
.form-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.btn {
  padding: 0.85rem 1.75rem;
  min-height: 48px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  text-decoration: none;
}

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

.btn-secondary:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(37, 99, 235, 0.35);
}

.btn-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.35);
}

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

/* Review Step Styling */
.review-summary-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.review-summary-header {
  background: #f8fafc;
  padding: 0.85rem 1.25rem;
  font-weight: 700;
  color: var(--primary-900);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.review-summary-header .edit-step-btn {
  font-size: 0.8rem;
  color: var(--primary-500);
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.review-summary-body {
  padding: 1rem 1.25rem;
}

.review-item {
  margin-bottom: 0.65rem;
  font-size: 0.88rem;
}

.review-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.review-value {
  color: var(--text-primary);
  margin-top: 0.15rem;
}

/* Success Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.25rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-xl);
  position: relative;
}

.modal-icon-success {
  width: 72px;
  height: 72px;
  background: #dcfce7;
  color: #15803d;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  margin: 0 auto 1.25rem auto;
}

.modal-protocol-box {
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1.25rem 0;
}

.modal-protocol-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-700);
  letter-spacing: 1px;
}

/* Footer */
.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .site-header {
    padding: 1rem;
  }
  .form-hero {
    padding: 1.5rem;
  }
  .section-card {
    padding: 1.5rem;
  }
  .stepper-nav-container {
    padding: 1rem;
  }
  .steps-list {
    display: none; /* In mobile, rely on counter and progress track */
  }
  .form-footer-actions {
    flex-direction: column-reverse;
    gap: 0.75rem;
  }
  .form-footer-actions .btn {
    width: 100%;
  }
}
