/* ═══════════════════════════════════════════
   Sēkwel — Application Form Styles
   form.css — loaded only on apply.html
   ═══════════════════════════════════════════ */

/* ─── Page layout ─────────────────────────── */
.apply-page {
  min-height: 100vh;
  background: var(--color-bg);
}

.apply-hero {
  background: var(--color-dark);
  padding: calc(var(--space-32) + var(--space-8)) 0 var(--space-12);
  text-align: center;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .apply-hero {
  background: var(--color-surface);
}

.apply-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 120%, rgba(200, 130, 10, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.apply-hero__tag {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.apply-hero__heading {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: #f0ece4;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

[data-theme="dark"] .apply-hero__heading {
  color: var(--color-text);
}

.apply-hero__sub {
  font-size: var(--text-base);
  color: rgba(196, 191, 180, 0.9);
  line-height: 1.7;
  max-width: 52ch;
  margin-inline: auto;
}

[data-theme="dark"] .apply-hero__sub {
  color: var(--color-text-muted);
}

/* ─── Form wrapper ─────────────────────────── */
.apply-body {
  padding: var(--space-12) 0 var(--space-24);
}

.apply-container {
  max-width: 860px;
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* ─── Progress indicator ───────────────────── */
.progress-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
  margin-bottom: var(--space-12);
  position: relative;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(100% / 18);
  right: calc(100% / 18);
  height: 2px;
  background: var(--color-divider);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.progress-step__dot {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  transition:
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    color var(--transition-interactive);
  position: relative;
}

/* Connecting line fill */
.progress-step__dot::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transform: translateY(-50%);
  transition: width 0.4s ease;
}

.progress-step__label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  text-align: center;
  line-height: 1.2;
  max-width: 64px;
  transition: color var(--transition-interactive);
}

/* Active step */
.progress-step.is-active .progress-step__dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--color-primary-highlight);
}

.progress-step.is-active .progress-step__label {
  color: var(--color-primary);
  font-weight: 600;
}

/* Completed step */
.progress-step.is-complete .progress-step__dot {
  background: #2a7a4f;
  border-color: #2a7a4f;
  color: #fff;
}

.progress-step.is-complete .progress-step__label {
  color: #2a7a4f;
}

@media (max-width: 768px) {
  .progress-bar {
    gap: 2px;
  }
  .progress-step__label {
    display: none;
  }
  .progress-step__dot {
    width: 28px;
    height: 28px;
    font-size: 0.6rem;
  }
  .progress-bar::before {
    top: 14px;
  }
}

/* ─── Form card ────────────────────────────── */
.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-10);
  box-shadow: var(--shadow-md);
}

@media (max-width: 640px) {
  .form-card {
    padding: var(--space-8) var(--space-6);
  }
}

.form-step {
  display: none;
}

.form-step.is-active {
  display: block;
  animation: stepIn 0.3s ease forwards;
}

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

.step-heading {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
}

.step-subheading {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-8);
}

.step-divider {
  height: 1px;
  background: var(--color-divider);
  margin: var(--space-8) 0;
}

/* ─── Form fields ──────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.form-group--no-margin {
  margin-bottom: 0;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-label .req {
  color: var(--color-primary);
  font-size: var(--text-xs);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-top: calc(-1 * var(--space-1));
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.5;
  transition:
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive);
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-faint);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-highlight);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: #c0392b;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.form-error {
  font-size: var(--text-xs);
  color: #c0392b;
  font-weight: 500;
  display: none;
}

.form-error.is-visible {
  display: block;
}

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

/* Select arrow */
.form-select-wrap {
  position: relative;
}

.form-select-wrap::after {
  content: '';
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--color-text-muted);
  pointer-events: none;
}

.form-select-wrap .form-select {
  padding-right: var(--space-10);
}

/* ─── Grid helpers ─────────────────────────── */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4) var(--space-6);
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-4) var(--space-6);
}

@media (max-width: 600px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
}

/* ─── Radio & checkbox groups ──────────────── */
.radio-group,
.check-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.radio-group--inline,
.check-group--inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
}

.radio-option,
.check-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.radio-option input[type="radio"],
.check-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.radio-option__label,
.check-option__label {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.4;
}

/* ─── Age distribution table ───────────────── */
.age-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: var(--space-2);
}

.age-table thead th {
  background: var(--color-surface-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.age-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.age-table tbody tr:last-child td {
  border-bottom: none;
}

.age-table tbody tr:nth-child(even) {
  background: var(--color-surface-2);
}

.age-input {
  width: 90px;
}

/* ─── Reference block ──────────────────────── */
.ref-block {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.ref-block__title {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

/* ─── Certification block ──────────────────── */
.cert-block {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
}

.cert-block h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.cert-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cert-list li {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 100%;
}

.cert-list li::before {
  content: '▸';
  color: var(--color-primary);
  flex-shrink: 0;
  margin-top: 1px;
}

.cert-acknowledge {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

/* ─── Navigation buttons ───────────────────── */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-divider);
  gap: var(--space-4);
}

.form-nav--right {
  justify-content: flex-end;
}

.btn-form {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-3) var(--space-8);
  border-radius: var(--radius-full);
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition:
    background var(--transition-interactive),
    color var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive);
}

.btn-form--primary {
  background: var(--color-primary);
  color: #fff;
}

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

.btn-form--primary:active {
  background: var(--color-primary-active);
}

.btn-form--secondary {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
}

.btn-form--secondary:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
  background: var(--color-surface-2);
}

.btn-form--submit {
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-base);
  padding: var(--space-4) var(--space-12);
  box-shadow: 0 4px 16px rgba(200, 130, 10, 0.3);
}

.btn-form--submit:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 6px 20px rgba(200, 130, 10, 0.4);
  transform: translateY(-1px);
}

.btn-form svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ─── Step counter ─────────────────────────── */
.step-counter {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ─── Success screen ───────────────────────── */
.success-screen {
  display: none;
  text-align: center;
  padding: var(--space-16) var(--space-8);
}

.success-screen.is-visible {
  display: block;
  animation: stepIn 0.5s ease forwards;
}

.success-icon {
  width: 80px;
  height: 80px;
  background: var(--color-primary-highlight);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-8);
  color: var(--color-primary);
}

.success-heading {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-4);
}

.success-body {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
  max-width: 50ch;
  margin-inline: auto;
  margin-bottom: var(--space-8);
}

.success-details {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: left;
  max-width: 480px;
  margin-inline: auto;
  margin-bottom: var(--space-10);
}

.success-details__item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
}

.success-details__item:last-child {
  border-bottom: none;
}

.success-details__key {
  color: var(--color-text-muted);
  font-weight: 500;
}

.success-details__val {
  color: var(--color-text);
  text-align: right;
  font-weight: 500;
}

/* ─── Section label within form ───────────────── */
.field-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  margin-top: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}

/* ─── Scrollable validation notice ────────────── */
.validation-banner {
  display: none;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: #c0392b;
  font-weight: 500;
  margin-bottom: var(--space-6);
}

.validation-banner.is-visible {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ─── Apply hero header tweak ─────────────────── */
.header--apply {
  background: color-mix(in oklab, var(--color-bg) 92%, transparent) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

.header--apply .header__logo {
  color: var(--color-text);
}

.header--apply .header__link {
  color: var(--color-text-muted);
}

.header--apply .header__link:hover {
  color: var(--color-text);
}

.header--apply .header__link--active {
  color: var(--color-primary);
  font-weight: 600;
}

.header--apply .theme-toggle {
  color: var(--color-text-muted);
}

.header--apply .theme-toggle:hover {
  color: var(--color-text);
}

/* ─── Mobile tweaks ────────────────────────────── */
@media (max-width: 640px) {
  .form-nav {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .btn-form {
    width: 100%;
    justify-content: center;
    padding: var(--space-4) var(--space-6);
  }
  .form-nav--right {
    flex-direction: column;
  }
}

/* ── Submit spinner ───────────────────────────── */
.btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.btn-form--submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

/* -- Form description text ---------------------- */
.form-description {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--color-text-secondary, #666);
  margin: 0;
}
.form-hint-inline {
  font-weight: 400;
  color: var(--color-text-secondary, #888);
  font-size: 0.85em;
}
