/* =========================================================
   CMMS Data Pipeline — Apple-inspired design system
   ========================================================= */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
    'Helvetica Neue', Helvetica, Arial, sans-serif;
  --color-text: #1d1d1f;
  --color-text-secondary: #6e6e73;
  --color-text-tertiary: #86868b;
  --color-bg: #ffffff;
  --color-bg-secondary: #f5f5f7;
  --color-bg-dark: #000000;
  --color-accent: #0071e3;
  --color-accent-hover: #0077ed;
  --color-border: #d2d2d7;
  --color-success: #30d158;
  --color-error: #ff3b30;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --max-width: 980px;
  --max-width-narrow: 680px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  font-size: 17px;
}

img { max-width: 100%; display: block; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

/* ── Navigation ────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.nav__logo {
  font-size: 21px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.nav__logo span {
  color: var(--color-accent);
}

.nav__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--color-accent);
  border-radius: 980px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.nav__cta:hover {
  background: var(--color-accent-hover);
  text-decoration: none;
  color: #fff;
}

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  padding: 100px 24px 80px;
  text-align: center;
  background: linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 100%);
}

.hero__eyebrow {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin-bottom: 16px;
}

.hero__title {
  font-size: clamp(36px, 7vw, 64px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--color-text);
  max-width: 800px;
  margin: 0 auto;
}

.hero__subtitle {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 400;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 20px auto 0;
  line-height: 1.4;
}

.hero__actions {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 17px;
  font-weight: 500;
  border-radius: 980px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  text-decoration: none;
  color: #fff;
}

.btn--secondary {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn--secondary:hover {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

.btn--small {
  padding: 10px 22px;
  font-size: 15px;
}

/* ── Section layout ────────────────────────────────────── */
.section {
  padding: 80px 24px;
}

.section--alt {
  background: var(--color-bg-secondary);
}

.section--dark {
  background: var(--color-bg-dark);
  color: #fff;
}

.section--dark .section__eyebrow { color: #2997ff; }
.section--dark .section__subtitle { color: #a1a1a6; }
.section--dark .step__number { color: #2997ff; }
.section--dark .step__desc { color: #a1a1a6; }

.section__eyebrow {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  text-align: center;
  margin-bottom: 8px;
}

.section__title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  text-align: center;
  margin-bottom: 16px;
}

.section__subtitle {
  font-size: 18px;
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 600px;
  margin: 0 auto 48px;
  line-height: 1.5;
}

/* ── Problem cards ─────────────────────────────────────── */
.problems {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.problem-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s, box-shadow 0.3s;
}

.problem-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.problem-card__icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.problem-card__title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.problem-card__desc {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ── Steps ─────────────────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 40px;
  max-width: 800px;
  margin: 0 auto;
  counter-reset: step;
}

.step {
  text-align: center;
}

.step__number {
  font-size: 56px;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}

.step__title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.step__desc {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ── Upload section ────────────────────────────────────── */
.upload-section {
  padding: 80px 24px 100px;
  background: linear-gradient(180deg, #f5f5f7 0%, #ffffff 100%);
}

.upload-container {
  max-width: 640px;
  margin: 0 auto;
}

.upload-card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0,0,0,0.04);
}

.upload-card__title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.upload-card__desc {
  font-size: 15px;
  color: var(--color-text-secondary);
  text-align: center;
  margin-bottom: 32px;
}

/* Email input */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  font-family: var(--font-sans);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(0,113,227,0.12);
}

.form-input::placeholder {
  color: var(--color-text-tertiary);
}

/* Drop zone */
.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone--active {
  border-color: var(--color-accent);
  background: rgba(0,113,227,0.04);
}

.dropzone__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--color-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone__icon svg {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
}

.dropzone__text {
  font-size: 17px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
}

.dropzone__hint {
  font-size: 14px;
  color: var(--color-text-tertiary);
}

.dropzone__browse {
  color: var(--color-accent);
  font-weight: 500;
  cursor: pointer;
}

/* File list */
.file-list {
  list-style: none;
  margin-top: 20px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.file-item:last-child {
  border-bottom: none;
}

.file-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-item__icon svg {
  width: 18px;
  height: 18px;
  color: var(--color-text-secondary);
}

.file-item__info {
  flex: 1;
  min-width: 0;
}

.file-item__name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item__meta {
  font-size: 13px;
  color: var(--color-text-tertiary);
}

.file-item__status {
  flex-shrink: 0;
}

.file-item__remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--color-text-tertiary);
  transition: color 0.2s;
}

.file-item__remove:hover {
  color: var(--color-error);
}

/* Progress bar */
.progress-bar {
  height: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar__fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-bar__fill--done {
  background: var(--color-success);
}

.progress-bar__fill--error {
  background: var(--color-error);
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 980px;
}

.badge--uploading {
  background: rgba(0,113,227,0.1);
  color: var(--color-accent);
}

.badge--done {
  background: rgba(48,209,88,0.12);
  color: #248a3d;
}

.badge--error {
  background: rgba(255,59,48,0.1);
  color: var(--color-error);
}

.badge--queued {
  background: rgba(0,0,0,0.05);
  color: var(--color-text-tertiary);
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Check icon */
.check-icon {
  width: 18px;
  height: 18px;
  color: var(--color-success);
}

/* Submit area */
.upload-submit {
  margin-top: 24px;
  text-align: center;
}

.upload-submit .btn {
  width: 100%;
  justify-content: center;
}

.upload-note {
  font-size: 13px;
  color: var(--color-text-tertiary);
  text-align: center;
  margin-top: 12px;
}

/* Success state */
.upload-success {
  text-align: center;
  padding: 40px 20px;
}

.upload-success__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(48,209,88,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.upload-success__icon svg {
  width: 32px;
  height: 32px;
  color: var(--color-success);
}

.upload-success__title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.upload-success__desc {
  font-size: 15px;
  color: var(--color-text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

/* ── Features grid ─────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.feature {
  text-align: center;
  padding: 24px;
}

.feature__icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.feature__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature__desc {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ── CTA banner ────────────────────────────────────────── */
.cta-banner {
  text-align: center;
  padding: 80px 24px;
  background: linear-gradient(135deg, #1d1d1f 0%, #2c2c2e 100%);
  color: #fff;
}

.cta-banner__title {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
}

.cta-banner__desc {
  font-size: 18px;
  color: #a1a1a6;
  max-width: 500px;
  margin: 0 auto 32px;
}

/* ── Footer ────────────────────────────────────────────── */
.footer {
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 48px 24px;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
}

.footer__col {
  min-width: 160px;
}

.footer__col-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

.footer__links {
  list-style: none;
}

.footer__links li {
  margin-bottom: 8px;
}

.footer__links a {
  color: var(--color-text-secondary);
  font-size: 14px;
  transition: color 0.2s;
}

.footer__links a:hover {
  color: var(--color-text);
}

.footer__bottom {
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.footer__legal {
  font-size: 13px;
  color: var(--color-text-tertiary);
  line-height: 1.6;
  max-width: 600px;
}

.footer__legal a {
  color: var(--color-text-secondary);
}

.footer__copyright {
  font-size: 13px;
  color: var(--color-text-tertiary);
}

/* ── Scroll animations ─────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Toast notifications ───────────────────────────────── */
.toast-container {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  background: var(--color-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  font-size: 14px;
  max-width: 360px;
  animation: toast-in 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast--success { border-left: 3px solid var(--color-success); }
.toast--error { border-left: 3px solid var(--color-error); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Legal pages ───────────────────────────────────────── */
.legal {
  padding: 80px 24px;
  max-width: 720px;
  margin: 0 auto;
}

.legal h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.legal .legal__updated {
  font-size: 14px;
  color: var(--color-text-tertiary);
  margin-bottom: 40px;
}

.legal h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 40px 0 12px;
  letter-spacing: -0.01em;
}

.legal p {
  font-size: 16px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.legal ul {
  margin: 0 0 16px 20px;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.legal li {
  margin-bottom: 8px;
  font-size: 16px;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding: 60px 20px 50px; }
  .section { padding: 60px 20px; }
  .upload-card { padding: 28px 20px; }
  .steps { gap: 28px; }
  .nav__inner { height: 48px; }
  .nav__logo { font-size: 18px; }
  .footer__top { flex-direction: column; gap: 24px; }
  .footer__bottom { flex-direction: column; }
  .hero__actions { flex-direction: column; align-items: center; }
  .btn { width: 100%; max-width: 320px; justify-content: center; }
  .problems { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .hero { padding: 40px 16px 40px; }
  .section { padding: 48px 16px; }
  .upload-card { padding: 24px 16px; }
  .dropzone { padding: 32px 16px; }
}

/* ── Hidden utility ────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Accessible focus ──────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Dark Mode ─────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --color-text: #f5f5f7;
    --color-text-secondary: #a1a1a6;
    --color-text-tertiary: #86868b;
    --color-bg: #000000;
    --color-bg-secondary: #1c1c1e;
    --color-bg-dark: #000000;
    --color-accent: #2997ff;
    --color-accent-hover: #409cff;
    --color-border: #38383a;
    --color-success: #30d158;
    --color-error: #ff453a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  }

  .nav {
    background: rgba(0,0,0,0.72);
    border-bottom-color: rgba(255,255,255,0.08);
  }

  .hero {
    background: linear-gradient(180deg, #000000 0%, #1c1c1e 100%);
  }

  .section--alt {
    background: var(--color-bg-secondary);
  }

  .section--dark {
    background: #111111;
  }

  .problem-card {
    background: #1c1c1e;
    border: 1px solid var(--color-border);
  }

  .upload-section {
    background: linear-gradient(180deg, #1c1c1e 0%, #000000 100%);
  }

  .upload-card {
    background: #1c1c1e;
    border-color: var(--color-border);
  }

  .form-input {
    background: #2c2c2e;
    border-color: var(--color-border);
    color: var(--color-text);
  }

  .form-input::placeholder {
    color: #636366;
  }

  .dropzone {
    border-color: var(--color-border);
  }

  .dropzone:hover,
  .dropzone--active {
    border-color: var(--color-accent);
    background: rgba(41,151,255,0.08);
  }

  .dropzone__icon {
    background: #2c2c2e;
  }

  .file-item {
    border-bottom-color: rgba(255,255,255,0.06);
  }

  .file-item__icon {
    background: #2c2c2e;
  }

  .progress-bar {
    background: rgba(255,255,255,0.08);
  }

  .badge--done {
    background: rgba(48,209,88,0.15);
    color: #30d158;
  }

  .badge--queued {
    background: rgba(255,255,255,0.06);
  }

  .cta-banner {
    background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%);
  }

  .footer {
    background: #1c1c1e;
    border-top-color: var(--color-border);
  }

  .footer__top {
    border-bottom-color: var(--color-border);
  }

  .footer__links a:hover {
    color: var(--color-text);
  }

  .toast {
    background: #1c1c1e;
    border-color: var(--color-border);
  }

  .upload-success__icon {
    background: rgba(48,209,88,0.15);
  }
}
