/*
 * EDC Upload Portal SPA — Nutromics brand styling.
 *
 * Ported from the Streamlit portal's assets/style.css. The brand palette and
 * .nt-* component classes match the original; form controls (inputs, selects,
 * buttons, file dropzone) are rewritten for plain HTML instead of Streamlit's
 * generated DOM.
 *
 * Palette:  DARK_BLUE #1c1647 · TEAL #48c2c5 · MIDGRAY #bcbec0 · EGGSHELL #f4f4f5
 */

:root {
  --dark-blue: #1c1647;
  --teal: #48c2c5;
  --midgray: #bcbec0;
  --eggshell: #f4f4f5;
  --border: #dcdcdc;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #1c1647;
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Top bar: full-bleed dark navy ── */
.nt-topbar {
  background: var(--dark-blue);
  padding: 1rem 2.5rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.nt-topbar-wordmark {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nt-topbar-subtitle {
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nt-logo {
  height: 36px;
  width: auto;
  margin-right: 0.5rem;
  align-self: center;
  display: block;
}

/* Signed-in user block, pushed to the right of the top bar */
.nt-topbar-user {
  margin-left: auto;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.nt-user-id {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  text-align: right;
}
.nt-user-name {
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
}
.nt-user-email {
  color: #48c2c5;
  font-size: 0.72rem;
}
.nt-logout {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.nt-logout:hover {
  background: #48c2c5;
  border-color: #48c2c5;
  color: #1c1647;
}

/* ── Centered content column (matches Streamlit "centered" layout) ── */
.nt-container {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem 1.5rem;
}

/* ── Page heading ── */
.nt-page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark-blue);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}
.nt-page-subtitle {
  font-size: 0.9rem;
  color: var(--midgray);
  margin-bottom: 2rem;
}

/* ── Step progress ── */
.nt-steps {
  display: flex;
  align-items: center;
  margin-bottom: 2.5rem;
}
.nt-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nt-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}
.nt-step-circle.done {
  background: var(--teal);
  color: #fff;
}
.nt-step-circle.active {
  background: var(--dark-blue);
  color: #fff;
}
.nt-step-circle.todo {
  background: #fff;
  color: var(--midgray);
  border: 2px solid var(--midgray);
}
.nt-step-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.nt-step-label.done {
  color: var(--teal);
}
.nt-step-label.active {
  color: var(--dark-blue);
}
.nt-step-label.todo {
  color: var(--midgray);
}
.nt-step-connector {
  flex: 1;
  height: 1px;
  margin: 0 0.6rem;
}
.nt-step-connector.done {
  background: var(--teal);
}
.nt-step-connector.todo {
  background: #e0e0e0;
}

/* ── Section heading ── */
.nt-section-heading {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--dark-blue);
  letter-spacing: -0.01em;
  margin: 1.75rem 0 0.2rem 0;
}
.nt-section-caption {
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 1rem;
}

/* ── Form fields ── */
.nt-field {
  margin-bottom: 1.1rem;
}
.nt-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-blue);
  margin-bottom: 0.35rem;
}
.nt-field input[type="text"],
.nt-field input[type="email"],
.nt-field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  color: var(--dark-blue);
  background: #fff;
  font-family: inherit;
}
.nt-field input:focus,
.nt-field select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0, 196, 208, 0.2);
}
.nt-field-row {
  display: flex;
  gap: 1rem;
}
.nt-field-row > .nt-field {
  flex: 1;
}

/* ── Buttons ── */
.nt-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}
.nt-btn {
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--dark-blue);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.nt-btn:hover {
  border-color: var(--dark-blue);
}
.nt-btn-primary {
  background: var(--dark-blue);
  border: none;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: 1;
}
.nt-btn-primary:hover {
  background: var(--teal);
  color: var(--dark-blue);
}
.nt-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.nt-btn-primary:disabled:hover {
  background: var(--dark-blue);
  color: #fff;
}

/* ── Signed-in / metadata badge ── */
.nt-badge {
  display: inline-block;
  background: var(--eggshell);
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  color: var(--dark-blue);
  font-weight: 600;
  margin: 0 0.5rem 1rem 0;
}

/* ── File dropzone ── */
.nt-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  border: 2px dashed var(--border);
  border-radius: 6px;
  background: var(--eggshell);
  padding: 1.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
  margin-bottom: 0.5rem;
}
.nt-dropzone:hover,
.nt-dropzone.dragover {
  border-color: var(--teal);
  background: #eefbfb;
}
.nt-dropzone input[type="file"] {
  display: none;
}
.nt-dropzone-prompt {
  font-size: 0.88rem;
  color: #555;
}
.nt-dropzone-prompt b {
  color: var(--dark-blue);
}
.nt-dropzone-hint {
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.35rem;
}
.nt-dropzone.has-file {
  border-style: solid;
  border-color: var(--teal);
  background: #fff;
  text-align: left;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
}
.nt-dropzone-file {
  font-size: 0.88rem;
  color: var(--dark-blue);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.nt-dropzone-clear {
  color: #999;
  font-size: 0.8rem;
  cursor: pointer;
  border: none;
  background: none;
  font-weight: 600;
}
.nt-dropzone-clear:hover {
  color: #dc3545;
}

/* ── Staged files summary ── */
.nt-staged {
  border-left: 4px solid var(--teal);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: var(--dark-blue);
  margin: 1rem 0 1.5rem 0;
  background: var(--eggshell);
  line-height: 1.8;
}
.nt-staged strong {
  font-weight: 800;
}

/* ── Filename rule hint ── */
.nt-rule {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.6rem;
}
.nt-rule b {
  color: var(--dark-blue);
}

/* ── Alerts ── */
.nt-alert {
  border-radius: 4px;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
  line-height: 1.4;
}
.nt-alert-error {
  background: #fdecea;
  border: 1px solid #f5c6cb;
  color: #a12622;
}

/* ── Demo-mode banner ── */
.nt-demo-banner {
  background: var(--dark-blue);
  color: #fff;
  border-radius: 4px;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.nt-demo-banner code {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.78rem;
}

/* ── Success page ── */
.nt-success {
  text-align: center;
  padding: 3rem 0 2rem 0;
}
.nt-success-check {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--teal);
}
.nt-success-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark-blue);
  margin-bottom: 0.5rem;
}
.nt-success-body {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}
.nt-ref {
  display: inline-block;
  border-left: 3px solid var(--teal);
  background: var(--eggshell);
  padding: 0.6rem 1rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--dark-blue);
}

/* ── Flow-run status card ── */
.nt-flow-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  background: #fff;
  max-width: 520px;
  margin: 1.5rem auto 0 auto;
  text-align: left;
}
.nt-flow-label {
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.nt-flow-name {
  margin-top: 0.4rem;
  font-size: 0.95rem;
}
.nt-flow-name a {
  color: var(--dark-blue);
  text-decoration: none;
  font-family: monospace;
}
.nt-flow-pill {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  background: #666;
}

/* ── Spinner ── */
.nt-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: nt-spin 0.7s linear infinite;
  vertical-align: -0.15rem;
  margin-right: 0.5rem;
}
@keyframes nt-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Footer ── */
.nt-footer {
  text-align: center;
  color: #999;
  font-size: 0.7rem;
  padding: 2rem 0 1rem 0;
  font-family: monospace;
}

/* ── Narrow screens ── */
@media (max-width: 560px) {
  .nt-topbar {
    padding: 0.85rem 1.25rem;
    flex-wrap: wrap;
  }
  .nt-topbar-user {
    gap: 0.6rem;
  }
  .nt-user-email {
    display: none; /* keep the name + logout; drop the longer email */
  }
  .nt-field-row {
    flex-direction: column;
    gap: 0;
  }
  .nt-actions {
    flex-wrap: wrap;
  }
  .nt-step-label {
    display: none;
  }
}
