/**
 * Easy Quant Upload page — 3-step form (data + qre + brief)
 * Палитра — общая с лендингом
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --border: #e8e8e8;
  --border-subtle: #ebebeb;
  --text: #0a0a0a;
  --text-secondary: #5a5a64;
  --text-hint: #8e8e93;
  --primary: #40a7e3;
  --primary-hover: #2c95d4;
  --primary-soft: rgba(64, 167, 227, 0.12);
  --primary-soft-strong: rgba(64, 167, 227, 0.22);
  --accent-dark: #1a78b3;
  --success: #2e7d32;
  --error: #c62828;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 6px rgba(20, 40, 60, 0.04);
  --shadow-md: 0 6px 24px rgba(20, 40, 60, 0.08);
  --shadow-lg: 0 16px 48px rgba(20, 40, 60, 0.10);
  --transition: all .18s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

/* ── Nav ─────────────────────────────────────────────────── */
.up-nav {
  background: rgba(245, 245, 245, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.up-nav-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.up-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-mark { font-size: 1.3rem; }
.logo-text { color: var(--text); }

.up-nav-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.95rem;
}

.up-nav-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ── Main ────────────────────────────────────────────────── */
.up-main {
  flex-grow: 1;
  padding: 40px 24px;
  display: flex;
  justify-content: center;
}

.up-container {
  width: 100%;
  max-width: 720px;
}

/* ── Header ──────────────────────────────────────────────── */
.up-head {
  text-align: center;
  margin-bottom: 28px;
}

.up-eyebrow {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--accent-dark);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.up-head h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.up-sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.55;
}

.up-sub strong { color: var(--text); font-weight: 600; }

/* ── Step card ───────────────────────────────────────────── */
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.step-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.step-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 2px;
}

.req {
  display: inline-block;
  background: rgba(64, 167, 227, 0.16);
  color: var(--accent-dark);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: 2px;
}

.opt {
  display: inline-block;
  background: var(--bg);
  color: var(--text-hint);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: 2px;
}

.step-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
}

.step-desc strong { color: var(--text); font-weight: 600; }

/* ── Dropzone ────────────────────────────────────────────── */
.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone-small {
  padding: 18px 18px;
  margin-top: 12px;
}

.dz-body {
  text-align: center;
}

.dz-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.dz-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 2px;
}

.dz-sub {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.dz-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
}

.dz-selected-name {
  flex-grow: 1;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dz-clear {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.dz-clear:hover {
  background: var(--error);
  color: #fff;
}

/* ── Brief textarea ──────────────────────────────────────── */
.brief-textarea {
  display: block;
  width: 100%;
  min-height: 100px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.96rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  transition: var(--transition);
}

.brief-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.brief-file-collapse {
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.brief-file-collapse summary {
  cursor: pointer;
  padding: 6px 0;
  font-weight: 500;
  color: var(--primary);
}

.brief-file-collapse summary:hover {
  color: var(--primary-hover);
}

/* ── Submit + note ──────────────────────────────────────── */
.up-note {
  margin: 18px 0 0;
  color: var(--text-hint);
  font-size: 0.88rem;
  text-align: center;
}

/* ── Button (shared) ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-lg { padding: 16px 30px; font-size: 1.05rem; border-radius: 12px; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--primary);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(64, 167, 227, 0.32);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(64, 167, 227, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text) !important;
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary) !important;
}

.btn-arrow { font-size: 1.1em; transition: transform .18s ease; }
.btn:hover:not(:disabled) .btn-arrow { transform: translateX(3px); }

/* ── Card for upload/scanning/ready/error ────────────────── */
.up-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  padding: 48px 40px;
  text-align: center;
}

.up-card h1, .up-card h2 {
  margin: 0 0 12px;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.up-filename {
  margin: 0 0 20px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.up-fineprint {
  margin: 18px 0 0;
  color: var(--text-hint);
  font-size: 0.88rem;
  line-height: 1.5;
}

.up-error-msg {
  margin: 0 0 24px;
  color: var(--error);
  font-size: 1rem;
  line-height: 1.5;
  background: rgba(198, 40, 40, 0.06);
  border: 1px solid rgba(198, 40, 40, 0.18);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 24px;
}

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

/* ── Progress ────────────────────────────────────────────── */
.progress {
  background: var(--border-subtle);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 12px 0 8px;
}

.progress-bar {
  background: var(--primary);
  height: 100%;
  width: 0;
  transition: width .2s ease;
  border-radius: 999px;
}

.progress-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* ── Success / Stats ─────────────────────────────────────── */
.success-mark, .error-mark { font-size: 3rem; margin-bottom: 8px; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.stat {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 20px 12px;
  border: 1px solid var(--border-subtle);
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.stat-label { color: var(--text-secondary); font-size: 0.9rem; }

.up-cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Downloads (run page) ────────────────────────────────── */
.downloads {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 4px;
  text-align: left;
}

.download-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  transition: var(--transition);
}

.download-card:hover {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.dl-icon { font-size: 2rem; line-height: 1; }
.dl-body { text-align: left; }
.dl-title { font-weight: 700; color: var(--text); font-size: 1rem; }
.dl-sub {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 2px;
  word-break: break-all;
}
.dl-meta { color: var(--text-hint); font-size: 0.82rem; margin-top: 4px; }
.dl-arrow {
  font-size: 1.4rem;
  color: var(--primary);
  font-weight: 700;
  transition: transform .18s ease;
}
.download-card:hover .dl-arrow { transform: translateY(3px); }

/* ── Footer ──────────────────────────────────────────────── */
.up-footer {
  padding: 28px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  margin-top: auto;
}

.up-footer-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  color: var(--text-hint);
  font-size: 0.9rem;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 560px) {
  .up-main { padding: 24px 14px; }
  .step-card { padding: 18px; }
  .dropzone { padding: 22px 16px; }
  .up-card { padding: 36px 22px; }
  .up-cta-row { flex-direction: column; }
  .up-cta-row .btn { width: 100%; }
  .stats { grid-template-columns: 1fr; }
}
