/* Evidence Exchange — design system
 * Self-hosted only. No external origins (fonts, images, remote stylesheets) — CSP default-src 'self'.
 * System font stack; no Google Fonts.
 */

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

:root {
  --bg:          #07091A;
  --surface:     #0C1027;
  --surface-2:   #101530;
  --border:      #1C2342;
  --border-h:    #2A3560;
  --text:        #E4EAFF;
  --muted:       #6B7FAB;
  --blue:        #3D5CFF;
  --blue-h:      #5572FF;
  --blue-glow:   rgba(61, 92, 255, 0.28);
  --blue-dim:    rgba(61, 92, 255, 0.10);
  --green:       #00CF76;
  --green-dim:   rgba(0, 207, 118, 0.12);
  --red:         #FF4D6A;
  --red-dim:     rgba(255, 77, 106, 0.12);
  --amber:       #FFB020;
  --amber-dim:   rgba(255, 176, 32, 0.12);
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(61,92,255,0.08) 0%, transparent 70%),
    radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: auto, 28px 28px;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ───────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 9, 26, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 32px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.06em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.nav-links a {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-links a:hover {
  color: #ffffff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.status-text {
  font-size: 12px;
  color: var(--green);
  white-space: nowrap;
}

.logout-form {
  margin: 0;
}

.btn-logout {
  padding: 6px 14px;
  font-size: 12px;
}

.config-badge {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1;    box-shadow: 0 0 0   0   rgba(255,176,32,0); }
  50%       { opacity: 0.6; box-shadow: 0 0 10px 2px rgba(255,176,32,0.45); }
}
.config-badge.is-checking {
  color: var(--amber);
  border-color: rgba(255,176,32,0.4);
  animation: badgePulse 1.1s ease-in-out infinite;
}
.config-badge.is-valid {
  color: var(--green);
  border-color: rgba(0,207,118,0.3);
}
.badge-bulb {
  display: inline-block;
  width: 11px;
  height: 11px;
  vertical-align: -1px;
  margin-right: 4px;
  flex-shrink: 0;
}

/* ── Main layout ──────────────────────────────── */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

/* ── Page header ──────────────────────────────── */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 6px;
}

.page-header p {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.page-header p span {
  display: inline-block;
  margin: 0 6px;
  opacity: 0.4;
}

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* ── Drop zone ────────────────────────────────── */
.drop-zone {
  padding: 56px 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  margin-bottom: 16px;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--blue), inset 0 0 40px rgba(61,92,255,0.04);
}

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

.drop-icon-wrap {
  width: 56px;
  height: 56px;
  background: var(--blue-dim);
  border: 1px solid rgba(61,92,255,0.3);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  transition: background 0.2s, box-shadow 0.2s;
}

.drop-zone:hover .drop-icon-wrap,
.drop-zone.drag-over .drop-icon-wrap {
  background: rgba(61,92,255,0.18);
  box-shadow: 0 0 16px var(--blue-glow);
}

.drop-icon-wrap svg { width: 26px; height: 26px; }

.drop-primary {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.drop-secondary {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-outline {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--border-h);
  background: #151d3e;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 0 18px var(--blue-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-h);
  border-color: var(--blue-h);
  box-shadow: 0 0 28px rgba(61,92,255,0.45);
}

.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* ── Actions bar ──────────────────────────────── */
.actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  margin-bottom: 4px;
}

.file-summary {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.clear-btn:hover { color: var(--text); background: var(--surface-2); }

/* ── Overall progress ─────────────────────────── */
.overall-card {
  display: none;
  padding: 16px 20px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.overall-card.visible { display: block; }

.card-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.card-label strong { color: var(--text); font-size: 13px; font-weight: 600; }

/* ── Progress bars ────────────────────────────── */
.bar-track {
  background: var(--surface-2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  background: var(--blue);
  transition: width 0.3s ease, background 0.4s;
  box-shadow: 0 0 8px var(--blue-glow);
}

.bar-fill.done  { background: var(--green); box-shadow: 0 0 8px rgba(0,207,118,0.3); }
.bar-fill.error { background: var(--red);   box-shadow: 0 0 8px rgba(255,77,106,0.3); }

/* ── File list ────────────────────────────────── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.2s;
  animation: cardIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.file-card.is-done  { border-color: rgba(0,207,118,0.25); }
.file-card.is-error { border-color: rgba(255,77,106,0.25); }
.file-card-blocked  { border-color: rgba(255,77,106,0.3); opacity: 0.8; }
.file-blocked-reason {
  font-size: 11px;
  color: var(--red);
  padding: 0 4px 6px;
  margin-top: -2px;
}

.file-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.file-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--blue-dim);
  border: 1px solid rgba(61,92,255,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-icon svg { width: 16px; height: 16px; }

.file-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.file-size { font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* ── Badges ───────────────────────────────────── */
.badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge-queued    { background: var(--surface-2);  color: var(--muted);  border-color: var(--border); }
.badge-resume    { background: var(--amber-dim);   color: var(--amber);  border-color: rgba(255,176,32,0.25); }
.badge-uploading { background: var(--blue-dim);    color: #A0B4FF;       border-color: rgba(61,92,255,0.3); }
.badge-done      { background: var(--green-dim);   color: var(--green);  border-color: rgba(0,207,118,0.3); }
.badge-error     { background: var(--red-dim);     color: var(--red);    border-color: rgba(255,77,106,0.3); }

/* ── File footer ──────────────────────────────── */
.file-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

.error-msg {
  font-size: 12px;
  color: var(--red);
  margin-top: 6px;
}

/* ── Info / contact widget ────────────────────── */
.info-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 272px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 20px;
  z-index: 200;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(61,92,255,0.08);
  animation: cardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
}

.info-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.info-close:hover { color: var(--text); background: var(--surface-2); }

.info-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.info-header-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background: var(--blue-dim);
  border: 1px solid rgba(61,92,255,0.25);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-header-icon svg { width: 16px; height: 16px; }

.info-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.info-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.info-body {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.info-email {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s, text-shadow 0.15s;
}

.info-email:hover {
  color: var(--blue-h);
  text-shadow: 0 0 12px var(--blue-glow);
}

.info-email svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 600px) {
  .topbar-inner { padding: 0 20px; }
  .main         { padding: 32px 20px 60px; }
  .drop-zone    { padding: 40px 24px; }
  .config-badge { display: none; }
}
