/* ═══════════════════════════════════════════════════════════════════
   Ibsen Applicant Portal – Shared Stylesheet
   Used by the applicant-facing step pages (step1–step4).
   Test and diagnostics pages have their own dark-theme styles.
   WCAG 2.1 AA / European Accessibility Act compliant.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* ── Skip Navigation (accessibility) ─────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #1a3a5c;
  color: #fff;
  padding: 8px 16px;
  z-index: 10000;
  font-size: 0.9em;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  left: 0;
}

/* ── Layout ────────────────────────────────────────────────────── */
.container {
  max-width: 700px;
  margin: 40px auto;
  padding: 0 20px;
}

.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 40px;
}

/* ── Typography ────────────────────────────────────────────────── */
h2 {
  color: #1a3a5c;
  margin-bottom: 8px;
  font-size: 1.4em;
}

h3 {
  color: #1a3a5c;
  margin: 24px 0 12px;
  font-size: 1.1em;
}

p {
  margin-bottom: 12px;
}

ul {
  margin: 8px 0 12px 24px;
}

li {
  margin-bottom: 4px;
}

a {
  color: #1a3a5c;
}

/* ── Horizontal Rule ───────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid #e0e4ea;
  margin: 20px 0;
}

/* ── Step Indicator ────────────────────────────────────────────── */
.step-indicator {
  text-align: center;
  margin-bottom: 24px;
  font-size: 0.9em;
}

.step-indicator span,
.step-indicator a.step-link {
  display: inline-block;
  width: 36px;
  height: 36px;
  line-height: 36px;
  border-radius: 50%;
  background: #ccc;
  color: #fff;
  font-weight: bold;
  margin: 0 6px;
  font-size: 0.9em;
  text-align: center;
  text-decoration: none;
}

.step-indicator .active {
  background: #1a3a5c;
}

.step-indicator .inactive {
  background: #bbb;
}

.step-indicator .done {
  background: #27ae60;
}

/* "You are applying for <position>" — centered, no background */
.applying-for {
  margin: 0 0 20px;
  text-align: center;
  font-size: 0.95em;
  color: #1a3a5c;
}
.applying-for strong {
  display: block;
  margin-top: 2px;
  font-size: 1.1em;
}

/* Clickable step links */
a.step-link {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

a.step-link:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  color: #fff;
}

a.step-link:focus-visible {
  outline: 3px solid #2a5a8c;
  outline-offset: 2px;
}

/* ── Focus Indicator (global accessibility) ──────────────────── */
:focus-visible {
  outline: 3px solid #2a5a8c;
  outline-offset: 2px;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: block;
  width: fit-content;
  background: #1a3a5c;
  color: #fff;
  padding: 14px 32px;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  cursor: pointer;
  text-decoration: none;
  margin: 20px auto 0;
  min-height: 44px;
}

.btn:hover {
  background: #2a5a8c;
}

.btn:focus-visible {
  outline: 3px solid #2a5a8c;
  outline-offset: 2px;
}

.btn:disabled {
  background: #999;
  cursor: not-allowed;
}

/* ── Form Elements ─────────────────────────────────────────────── */
label {
  display: block;
  margin-top: 18px;
  font-weight: bold;
  font-size: 0.95em;
  color: #1a3a5c;
}

label .req {
  color: #c0392b;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  display: block;
  padding: 8px 12px;
  border: 1px solid #999;
  border-radius: 6px;
  font-size: 1em;
  margin-top: 4px;
  font-family: inherit;
  min-height: 40px;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

input[type="file"] {
  margin-top: 6px;
}

.hint {
  color: #595959;
  font-size: 0.85em;
  margin-top: 2px;
}

/* ── Checkbox Group ────────────────────────────────────────────── */
.checkbox-group {
  margin-top: 18px;
}

.checkbox-group label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: normal;
}

.checkbox-group input[type="checkbox"] {
  margin-top: 4px;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* ── Slim single-column form: label to the LEFT of each field ─────
   Used on the application form (step 2). One field per row; the label
   sits in a fixed left column, the field fills the rest. Below 640px it
   falls back to the stacked layout (label above the field). */
.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 9.6px;
}
.form-row > label {
  flex: 0 0 220px;
  max-width: 220px;
  text-align: right;
  margin: 10px 0 0;
}
.form-row > .form-control {
  flex: 1 1 auto;
  min-width: 0;
}
.form-row > .form-control > input,
.form-row > .form-control > select,
.form-row > .form-control > textarea {
  margin-top: 0;
}

/* Upload size error message */
.file-error {
  margin: 0 0 14px;
  padding: 10px 14px;
  background: #fdecea;
  border: 1px solid #e6b0aa;
  border-radius: 6px;
  color: #c0392b;
  font-size: 0.9em;
  font-weight: bold;
}

/* Upload rows sit closer together */
.form-row--upload { margin-top: 6.4px; }
.form-row--upload .hint { margin-top: 4px; }

/* GDPR consent row: checkbox right-aligned in the label column,
   consent text aligned with the field left border */
.form-row--consent { margin-top: 14.4px; align-items: flex-start; }
.form-row--consent > .form-consent-check {
  flex: 0 0 220px;
  max-width: 220px;
  display: flex;
  justify-content: flex-end;
  margin-top: 1px;
}
.form-row--consent .form-consent-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
}
.form-row--consent .consent-text {
  font-weight: normal;
  color: #333;
  font-size: 0.85em;
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 640px) {
  .form-row { flex-direction: column; gap: 4px; align-items: stretch; }
  .form-row > label { flex: none; max-width: none; text-align: left; margin: 0; }
  .form-row > .form-control { width: 100%; }
  /* Keep the consent checkbox beside its text on mobile */
  .form-row--consent { flex-direction: row; align-items: flex-start; gap: 8px; }
  .form-row--consent > .form-consent-check { flex: 0 0 auto; max-width: none; justify-content: flex-start; }
  .form-row--consent > .form-control { width: auto; }
}

/* ── Assessment Box (Step 3) ───────────────────────────────────── */
.assessment-box {
  background: #f8f9fc;
  border: 1px solid #e0e4ea;
  border-radius: 8px;
  padding: 24px;
  margin: 16px 0;
}

/* ── Thank-you Checkmark (Step 4) ──────────────────────────────── */
.check {
  font-size: 3em;
  color: #27ae60;
  margin-bottom: 16px;
}

/* ── Processing Spinner (Step 2) ───────────────────────────────── */
.processing {
  display: none;
  text-align: center;
  padding: 40px;
}

.processing .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e4ea;
  border-top-color: #1a3a5c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Language Toggle ───────────────────────────────────────────── */
.lang-toggle {
  position: fixed;
  top: 8px;
  right: 16px;
  z-index: 9990;
  display: flex;
  gap: 2px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
  overflow: hidden;
}

.lang-btn {
  padding: 8px 14px;
  border: none;
  background: #f0f2f5;
  color: #555;
  font-size: 0.85em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-width: 44px;
  min-height: 44px;
}

.lang-btn:hover {
  background: #e0e4ea;
}

.lang-btn:focus-visible {
  outline: 3px solid #2a5a8c;
  outline-offset: -2px;
}

.lang-btn.active {
  background: #1a3a5c;
  color: #fff;
}

/* Both language classes visible by default;
   the language-toggle script hides the inactive one on load.
   If JS fails to run, users see both languages (safe fallback). */

/* ── Staging URL Override Box ──────────────────────────────────── */
.staging-url-box {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.9em;
}

.staging-url-box label {
  color: #6b5000;
  font-size: 0.85em;
  margin-top: 0;
}

.staging-url-box input[type="url"] {
  border-color: #c9a800;
}

.staging-url-box .hint {
  color: #6b5000;
}

/* ── Drag-and-Drop File Upload Zones ─────────────────────────── */
.drop-zone {
  border: 2px dashed #999;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-top: 0;
}

.drop-zone:hover,
.drop-zone:focus-within {
  border-color: #1a3a5c;
  background: rgba(26,58,92,0.03);
}

.drop-zone.dragover {
  border-color: #1a3a5c;
  background: rgba(26,58,92,0.06);
}

.drop-zone .drop-icon {
  font-size: 1.3em;
  display: block;
  margin-bottom: 2px;
  opacity: 0.5;
}

.drop-zone .drop-text {
  font-size: 0.85em;
  color: #595959;
}

.drop-zone .file-name {
  font-size: 0.9em;
  color: #1e7e34;
  font-weight: bold;
  word-break: break-all;
  display: block;
  margin-top: 2px;
}

.drop-zone input[type="file"] {
  display: none;
}

.remove-selected-btn {
  background: none;
  border: 1px solid #c0392b;
  color: #c0392b;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.75em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  margin-top: 8px;
}
.remove-selected-btn:hover {
  background: #fdecea;
}

/* ── Existing File Display (back navigation) ──────────────────── */
.existing-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  margin-top: 6px;
}

.existing-file .file-icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.existing-file .file-name {
  font-size: 0.9em;
  color: #333;
  font-weight: bold;
  word-break: break-all;
  flex: 1;
}

.remove-file-btn {
  background: none;
  border: 1px solid #c0392b;
  color: #c0392b;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 0.9em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

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

.remove-file-btn:focus-visible {
  outline: 3px solid #c0392b;
  outline-offset: 2px;
}

/* ── Visually Hidden (screen reader only) ────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   Mobile Responsiveness
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .container {
    margin: 16px auto;
    padding: 0 12px;
  }

  .card {
    padding: 20px 16px;
    border-radius: 6px;
  }

  h2 {
    font-size: 1.2em;
  }

  h3 {
    font-size: 1em;
  }

  .btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 16px;
  }

  .assessment-box {
    padding: 16px 12px;
  }

  .processing {
    padding: 24px 16px;
  }

  .drop-zone {
    padding: 16px 12px;
  }

  .existing-file {
    padding: 10px 12px;
  }

  .lang-toggle {
    top: 4px;
    right: 8px;
  }

  .staging-url-box {
    padding: 10px 14px;
  }

  .step-indicator span,
  .step-indicator a.step-link {
    width: 32px;
    height: 32px;
    line-height: 32px;
    margin: 0 4px;
  }
}
