/* ─────────────────────────────────────────────────────────────────────────
   Feingold Medical Legal — Report Generator
   Custom styling layered on top of Tailwind utilities.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --navy: #1A376C;
  --navy-700: #16305e;
  --navy-900: #0e1f44;
  --accent: #2DD4BF;
  --gold: #E0A458;
}

html, body { scroll-behavior: smooth; }
body {
  background: #f5f7fb;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Ambient aurora background ─────────────────────────────────────────── */
.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(60rem 40rem at 10% -10%, rgba(45, 212, 191, 0.10), transparent 60%),
    radial-gradient(50rem 40rem at 100% 0%, rgba(26, 55, 108, 0.12), transparent 55%),
    radial-gradient(40rem 30rem at 50% 120%, rgba(224, 164, 88, 0.08), transparent 60%);
  pointer-events: none;
}

/* ── Logo mark ─────────────────────────────────────────────────────────── */
.logo-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--navy), var(--navy-900));
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 20px -6px rgba(26, 55, 108, 0.5);
}

/* ── Stepper ───────────────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 4px;
  flex-wrap: wrap;
}
.step-dot {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}
.step-dot .pip {
  width: 30px; height: 30px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #94a3b8;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}
.step-dot .pip-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
  transition: color 0.3s ease;
}
.step-dot.active .pip {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 16px -4px rgba(26, 55, 108, 0.6);
  transform: scale(1.08);
}
.step-dot.active .pip-label { color: var(--navy); }
.step-dot.done .pip {
  background: var(--accent);
  color: #06403a;
}
.step-dot.done .pip-label { color: #0d9488; }
.step-dot.error .pip { background: #ef4444; color: #fff; }
.step-connector {
  flex: 1 1 14px;
  min-width: 10px;
  height: 2px;
  background: #e2e8f0;
  border-radius: 2px;
}
.step-connector.filled { background: var(--accent); }

/* ── Wizard panels ─────────────────────────────────────────────────────── */
.panel {
  animation: slideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 22px;
  box-shadow:
    0 1px 2px rgba(16, 31, 68, 0.04),
    0 20px 50px -24px rgba(16, 31, 68, 0.28);
  padding: 30px;
}

.panel-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.eyebrow-required { background: rgba(224, 164, 88, 0.15); color: #b97f2c; }
.eyebrow-optional { background: rgba(26, 55, 108, 0.08); color: var(--navy); }

.panel-icon {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 6px;
}
.panel-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--navy-900);
  letter-spacing: -0.3px;
}
.panel-desc { color: #64748b; margin-top: 6px; font-size: 0.95rem; }

.instr {
  margin-top: 18px;
  padding: 16px 18px;
  background: rgba(26, 55, 108, 0.04);
  border-left: 3px solid var(--navy);
  border-radius: 12px;
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.6;
}
.instr strong { color: var(--navy); }
.format-hint {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.zip-tip {
  margin-top: 12px;
  padding: 11px 14px;
  background: rgba(224, 164, 88, 0.12);
  border: 1px dashed rgba(224, 164, 88, 0.5);
  border-radius: 10px;
  font-size: 0.82rem;
  color: #8a6321;
}

/* ── Dropzone ──────────────────────────────────────────────────────────── */
.dropzone {
  position: relative;
  margin-top: 20px;
  border: 2px dashed #cbd5e1;
  border-radius: 18px;
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  background: rgba(255, 255, 255, 0.5);
}
.dropzone:hover {
  border-color: var(--accent);
  background: rgba(45, 212, 191, 0.04);
  transform: translateY(-1px);
}
.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(45, 212, 191, 0.10);
  transform: scale(1.01);
  box-shadow: 0 10px 30px -12px rgba(45, 212, 191, 0.5);
}
.dropzone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
}
.drop-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  transition: transform 0.25s ease;
}
.dropzone:hover .drop-icon { transform: translateY(-3px); }
.drop-primary { font-weight: 600; color: #334155; }
.drop-secondary { font-size: 0.85rem; color: #94a3b8; margin-top: 3px; }
.drop-secondary span { color: var(--accent); font-weight: 600; text-decoration: underline; }

/* ── File list ─────────────────────────────────────────────────────────── */
.file-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 31, 68, 0.04);
  animation: popIn 0.3s ease;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.file-item .fi-icon { font-size: 1.1rem; }
.file-item .fi-name { flex: 1; font-size: 0.88rem; font-weight: 500; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fi-size { font-size: 0.75rem; color: #94a3b8; }
.file-item .fi-remove {
  cursor: pointer; color: #cbd5e1; font-weight: 700;
  padding: 0 4px; transition: color 0.15s;
}
.file-item .fi-remove:hover { color: #ef4444; }

/* ── Status pill (inside panel) ────────────────────────────────────────── */
.statpill {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 18px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.statpill .dot { width: 9px; height: 9px; border-radius: 50%; }
.statpill.processing { background: rgba(45, 212, 191, 0.12); color: #0d9488; }
.statpill.processing .dot { background: #0d9488; animation: pulse 1.2s infinite; }
.statpill.done { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.statpill.done .dot { background: #16a34a; }
.statpill.error { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.statpill.error .dot { background: #dc2626; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Progress bar ──────────────────────────────────────────────────────── */
.progress-track {
  height: 8px;
  background: #e8edf5;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #34d399);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.6);
}
.progress-label { margin-top: 8px; font-size: 0.8rem; color: #64748b; }

/* ── Review (final) card grid ──────────────────────────────────────────── */
.review-header { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.review-header .panel-icon { margin-bottom: 0; }
.review-header .panel-title { font-size: 1.5rem; }

/* Flex-wrap so 5 cards sit 3+2, with the bottom row self-centering */
.review-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 18px 0 16px;
}
.review-card {
  flex: 1 1 160px;
  max-width: 210px;
  min-width: 140px;
  padding: 16px;
  background: #fff;
  border: 1.5px solid #eef2f7;
  border-radius: 18px;
  transition: all 0.25s ease;
  animation: popIn 0.3s ease;
}
.review-card.card-done  { border-color: rgba(34,197,94,0.45);  background: rgba(34,197,94,0.04); }
.review-card.card-busy  { border-color: rgba(45,212,191,0.5);  background: rgba(45,212,191,0.04); }
.review-card.card-error { border-color: rgba(239,68,68,0.45);  background: rgba(239,68,68,0.04); }
.rc-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.rc-icon { font-size: 1.6rem; }
.rc-status-icon { font-size: 1.05rem; }
.rc-title {
  font-weight: 700; font-size: 0.9rem; color: #1e293b;
  margin-bottom: 4px; line-height: 1.3;
}
.rc-star { color: var(--gold); }
.rc-status { font-size: 0.78rem; font-weight: 600; }
.rc-err {
  font-size: 0.73rem; color: #dc2626; margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.s-idle  { color: #94a3b8; }
.s-busy  { color: #0d9488; }
.s-done  { color: #16a34a; }
.s-error { color: #dc2626; }

/* ── Generate section layout ───────────────────────────────────────────── */
#gen-progress { margin-top: 16px; }
#download-wrap { margin-top: 18px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--navy), var(--navy-900));
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 11px 26px;
  border-radius: 13px;
  transition: all 0.2s ease;
  box-shadow: 0 10px 24px -10px rgba(26, 55, 108, 0.65);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 30px -10px rgba(26, 55, 108, 0.7); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  color: #64748b;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 11px 18px;
  border-radius: 13px;
  transition: all 0.15s ease;
}
.btn-ghost:hover { background: rgba(100, 116, 139, 0.08); color: #334155; }
.btn-ghost.hidden, .hidden { display: none !important; }

.btn-generate {
  width: 100%;
  background: linear-gradient(135deg, var(--gold), #c8862f);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 16px;
  border-radius: 16px;
  margin-top: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 14px 32px -12px rgba(224, 164, 88, 0.8);
}
.btn-generate:hover:not(:disabled) { transform: translateY(-2px); }
.btn-generate:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-download {
  display: block;
  width: 100%;
  text-align: center;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  padding: 16px;
  border-radius: 16px;
  text-decoration: none;
  box-shadow: 0 14px 32px -12px rgba(22, 163, 74, 0.7);
  transition: transform 0.2s ease;
}
.btn-download:hover { transform: translateY(-2px); }

/* ── Banners ───────────────────────────────────────────────────────────── */
.success-banner {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #16a34a;
  margin-bottom: 14px;
  animation: popIn 0.4s ease;
}
.error-banner {
  margin-top: 16px;
  padding: 13px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  color: #dc2626;
  font-size: 0.88rem;
}

/* ── Sticky nav bar ────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(16, 31, 68, 0.07);
  box-shadow: 0 -8px 30px -16px rgba(16, 31, 68, 0.25);
}

/* ── Floating processing tray ──────────────────────────────────────────── */
.tray {
  position: fixed;
  bottom: 84px; right: 24px;
  z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--navy);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px -12px rgba(16, 31, 68, 0.6);
  animation: popIn 0.3s ease;
}
.tray-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Welcome panel ─────────────────────────────────────────────────────── */
.welcome-hero { text-align: center; padding: 18px 0 4px; }
.welcome-badge {
  display: inline-block;
  padding: 4px 12px;
  background: linear-gradient(135deg, var(--accent), #34d399);
  color: #065f46;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border-radius: 999px;
  margin-bottom: 14px;
}
.welcome-hero h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1.15;
  letter-spacing: -0.5px;
}
.welcome-hero p { color: #64748b; margin-top: 12px; font-size: 0.95rem; line-height: 1.6; }

/* Pipeline flow strip */
.welcome-pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
  padding: 18px;
  background: rgba(26, 55, 108, 0.04);
  border-radius: 16px;
}
.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  min-width: 78px;
}
.pipeline-step.ps-output {
  background: linear-gradient(135deg, rgba(26,55,108,0.08), rgba(26,55,108,0.04));
  border-color: rgba(26,55,108,0.18);
}
.ps-icon { font-size: 1.2rem; }
.ps-name { font-size: 0.66rem; font-weight: 600; color: #475569; text-align: center; line-height: 1.2; }
.ps-req {
  font-size: 0.6rem; font-weight: 700; color: #b97f2c;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.ps-arrow { font-size: 0.8rem; color: #94a3b8; flex: none; }

.welcome-steps { display: grid; gap: 10px; margin-top: 4px; text-align: left; }
.welcome-step {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.7);
  border: 1px solid #eef2f7;
  border-radius: 14px;
}
.welcome-step .ws-num {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(26,55,108,0.08);
  color: var(--navy);
  font-weight: 700; font-size: 0.78rem;
}
.welcome-step .ws-text { font-size: 0.88rem; color: #475569; }
.welcome-step .ws-text strong { color: var(--navy); }

/* ── Toast notification ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 90px; left: 50%; transform: translateX(-50%) translateY(12px);
  z-index: 50;
  background: #1e293b;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,0.35);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}
.toast.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .step-dot .pip-label { display: none; }
  .card { padding: 22px; }
  .panel-title { font-size: 1.5rem; }
  .welcome-hero h1 { font-size: 1.8rem; }
  .welcome-pipeline { gap: 4px; padding: 12px; }
  .pipeline-step { min-width: 58px; padding: 6px 8px; }
  .review-card { flex: 1 1 120px; min-width: 120px; max-width: 160px; padding: 13px; }
}

/* ── Accessibility & micro-interaction polish ──────────────────────────── */
button:focus-visible,
.btn-primary:focus-visible,
.btn-generate:focus-visible,
.btn-download:focus-visible,
.btn-ghost:focus-visible,
.dropzone:focus-within {
  outline: 2px solid var(--accent, #2DD4BF);
  outline-offset: 2px;
}

.btn-primary:active:not(:disabled),
.btn-generate:active:not(:disabled),
.btn-download:active {
  transform: translateY(0) scale(0.985);
}

.file-item { transition: background 0.15s ease, border-color 0.15s ease; }
.file-item:hover { background: #fafbfd; border-color: #dbe4f0; }

.fi-remove { transition: color 0.15s ease, transform 0.15s ease; }
.fi-remove:hover { color: #dc2626; transform: scale(1.15); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
