/*
  Online Swift Loan — shared design system
  Builds on the existing Bootstrap 5 + Inter setup already loaded on the site.
*/

:root {
  --color-primary: #047857;
  --color-primary-dark: #065f46;
  --color-primary-light: #10b981;
  --color-navy: #1e1b4b;
  --color-navy-light: #312e81;
  --gradient-brand: linear-gradient(135deg, #047857 0%, #1e1b4b 100%);

  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-text-subtle: #64748b;

  --color-success: #15803d;
  --color-success-bg: #f0fdf4;
  --color-warning: #b45309;
  --color-warning-bg: #fffbeb;
  --color-danger: #b91c1c;
  --color-danger-bg: #fef2f2;
  --color-info: #1d4ed8;
  --color-info-bg: #eff6ff;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.12);

  --focus-ring: 0 0 0 3px rgba(4, 120, 87, 0.35);

  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Focus & accessibility ---------- */

a, button, input, select, textarea, [tabindex] {
  outline-color: var(--color-primary);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--color-navy);
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  z-index: 2000;
  transition: top 0.2s ease;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
  color: #fff;
}

.visually-hidden-focusable-fix:not(:focus):not(:focus-within) {
  clip: rect(0 0 0 0);
}

/* ---------- Buttons ---------- */

.btn-brand {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-brand:hover,
.btn-brand:focus-visible {
  background: var(--color-primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-brand:disabled {
  background: #9ca3af;
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-outline-brand {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  padding: 0.8rem 1.7rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-outline-brand:hover,
.btn-outline-brand:focus-visible {
  background: var(--color-primary);
  color: #fff;
}

.btn-outline-light-brand {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  padding: 0.8rem 1.7rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  transition: background 0.2s ease;
}

.btn-outline-light-brand:hover,
.btn-outline-light-brand:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn-link-quiet {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  padding: 0.4rem 0.2rem;
}

.btn-link-quiet:hover { text-decoration: underline; }

/* ---------- Navbar ---------- */

.osl-navbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.osl-navbar .navbar-brand {
  color: var(--color-primary);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.osl-navbar .nav-link {
  color: var(--color-text);
  font-weight: 500;
  padding: 0.6rem 0.9rem !important;
  border-radius: var(--radius-sm);
}

.osl-navbar .nav-link:hover,
.osl-navbar .nav-link.active {
  color: var(--color-primary);
  background: var(--color-success-bg);
}

.osl-navbar .nav-link.active { font-weight: 700; }

/* ---------- Cards / surfaces ---------- */

.surface-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.demo-banner {
  background: var(--color-warning-bg);
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.15rem;
  font-size: 0.92rem;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.demo-banner strong { color: #78350f; }

/* ---------- Status badges ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

.status-pill::before {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-received { background: var(--color-info-bg); color: var(--color-info); }
.status-review { background: #fef3c7; color: #92400e; }
.status-info-required { background: var(--color-danger-bg); color: var(--color-danger); }
.status-processing { background: #ede9fe; color: #5b21b6; }
.status-completed { background: var(--color-success-bg); color: var(--color-success); }
.status-cancelled { background: #fee2e2; color: #991b1b; }
.status-not-found { background: #f1f5f9; color: var(--color-text-muted); }

/* ---------- Application wizard: stepper ---------- */

.wizard-shell {
  max-width: 820px;
  margin: 0 auto;
}

.wizard-header .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
}

.step-track {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 1.25rem 0 0.5rem;
}

.step-track .step-seg {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
}

.step-track .step-seg > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gradient-brand);
  border-radius: var(--radius-pill);
  transition: width 0.35s ease;
}

.step-track .step-seg.is-complete > span,
.step-track .step-seg.is-current > span { width: 100%; }

.step-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  margin-bottom: 1.75rem;
}

.step-labels .is-active { color: var(--color-primary); font-weight: 700; }

.wizard-panel {
  animation: fadeSlideIn 0.25s ease;
}

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

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 575.98px) {
  .wizard-actions { flex-direction: column-reverse; }
  .wizard-actions > * { width: 100%; }
}

/* ---------- Form fields ---------- */

.form-label {
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.92rem;
}

.required-mark { color: var(--color-danger); margin-left: 0.15rem; }

.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border-strong);
  padding: 0.7rem 0.9rem;
  font-size: 0.96rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--color-danger);
}

.field-error {
  color: var(--color-danger);
  font-size: 0.84rem;
  margin-top: 0.35rem;
  display: none;
  align-items: center;
  gap: 0.3rem;
}

.field-error.is-visible { display: flex; }

.form-hint {
  font-size: 0.82rem;
  color: var(--color-text-subtle);
  margin-top: 0.3rem;
}

/* ---------- File upload ---------- */

.upload-card {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 1.75rem 1.25rem;
  text-align: center;
  background: #fbfdff;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
}

.upload-card.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-success-bg);
}

.upload-card.has-file {
  text-align: left;
  border-style: solid;
  border-color: var(--color-primary-light);
}

.upload-card.is-error {
  border-color: var(--color-danger);
  background: var(--color-danger-bg);
}

.upload-card .upload-icon {
  font-size: 1.9rem;
  color: var(--color-primary);
}

.upload-card [data-upload-file-row] { display: none; }
.upload-card.has-file [data-upload-file-row] { display: flex; }
.upload-card.has-file [data-upload-empty] { display: none; }
.upload-card.is-error [data-upload-empty] { display: block; }
.upload-card.is-error [data-upload-file-row] { display: none; }

.upload-file-actions { display: flex; gap: 0.9rem; margin-top: 0.6rem; }
.upload-file-actions button {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-text-subtle);
}
.upload-file-actions button:hover { color: var(--color-primary); text-decoration: underline; }
.upload-file-actions button.text-danger:hover { color: var(--color-danger) !important; }

.upload-file-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.upload-file-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--color-success-bg);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.upload-file-meta { min-width: 0; flex: 1; }
.upload-file-name {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-file-size { font-size: 0.8rem; color: var(--color-text-subtle); }

.upload-progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
  margin-top: 0.6rem;
}

.upload-progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  transition: width 0.2s ease;
}

/* ---------- Summary / review ---------- */

.summary-section + .summary-section { margin-top: 1.25rem; }

.summary-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--color-border);
  font-size: 0.93rem;
}

.summary-row:last-child { border-bottom: none; }
.summary-row dt { color: var(--color-text-subtle); }
.summary-row dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- Timeline ---------- */

.status-timeline { list-style: none; padding: 0; margin: 0; }

.status-timeline li {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding-bottom: 1.5rem;
  position: relative;
}

.status-timeline li::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.status-timeline li:last-child::before { display: none; }
.status-timeline li:last-child { padding-bottom: 0; }

.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  background: var(--color-border);
  color: var(--color-text-subtle);
  z-index: 1;
}

.status-timeline li.is-done .timeline-dot { background: var(--color-primary); color: #fff; }
.status-timeline li.is-current .timeline-dot { background: var(--color-navy); color: #fff; box-shadow: 0 0 0 4px rgba(30, 27, 75, 0.15); }
.status-timeline li.is-cancelled .timeline-dot { background: var(--color-danger); color: #fff; box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.15); }

.timeline-label { font-weight: 600; }
.timeline-sub { font-size: 0.82rem; color: var(--color-text-subtle); }

/* ---------- Loading / spinner ---------- */

.spinner-brand {
  width: 1.15rem;
  height: 1.15rem;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ---------- Toast ---------- */

.osl-toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  left: 1.25rem;
  max-width: 380px;
  margin-left: auto;
  background: var(--color-navy);
  color: #fff;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.osl-toast.is-visible { transform: translateY(0); opacity: 1; }

/* ---------- Misc ---------- */

.section-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-primary);
}

.hairline-divider { border-color: var(--color-border); }

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  padding: 1rem 0;
  list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  float: right;
  font-size: 1.3rem;
  color: var(--color-primary);
}

.faq-item[open] summary::after { content: '\2212'; }

.faq-item p { padding-bottom: 1rem; color: var(--color-text-muted); }

.mock-notice-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
}
