/* ============================================
   ChallanAI — Styles
   Aesthetic: Editorial Minimalism meets Utility
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&display=swap');

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

:root {
  --bg: #08080c;
  --bg-warm: #0c0b10;
  --surface: #111118;
  --surface-2: #191924;
  --surface-3: #1f1f2e;
  --border: #262638;
  --border-hover: #3a3a56;
  --text: #eaeaf2;
  --text-secondary: #a0a0b8;
  --text-muted: #6a6a82;
  --accent: #818cf8;
  --accent-bright: #a5b4fc;
  --accent-dim: #6366f1;
  --accent-glow: rgba(129, 140, 248, 0.12);
  --accent-glow-strong: rgba(129, 140, 248, 0.25);
  --green: #34d399;
  --green-dim: #059669;
  --green-glow: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-glow: rgba(248, 113, 113, 0.1);
  --amber: #fbbf24;
  --radius: 14px;
  --radius-sm: 8px;
  --font-body: 'DM Sans', sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Noise overlay for texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

/* ── Layout ── */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Ambient glow behind hero ── */
.ambient-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(129, 140, 248, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Nav ── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0;
  position: relative;
  z-index: 10;
}

.nav-logo {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  text-decoration: none;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
  letter-spacing: 0.01em;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.gh {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link.gh svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
  letter-spacing: 0.02em;
}

.hero-eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--text);
}

.hero h1 em {
  font-style: italic;
  color: var(--accent-bright);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 1.25rem auto 0;
  line-height: 1.7;
}

.hero-badges {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.85rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface);
}

/* ── Features strip ── */
.features-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 2.5rem 0;
  position: relative;
  z-index: 1;
}

@media (max-width: 520px) {
  .features-strip {
    grid-template-columns: 1fr;
  }
}

.feature-cell {
  background: var(--surface);
  padding: 1.5rem 1.25rem;
  text-align: center;
  transition: background var(--transition);
}

.feature-cell:hover {
  background: var(--surface-2);
}

.feature-cell .f-num {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.feature-cell .f-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  filter: grayscale(0.3);
}

.feature-cell .f-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.feature-cell .f-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Main Card ── */
.main-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  z-index: 1;
  margin-bottom: 2rem;
}

.card-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-header .step-indicator {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.card-body {
  padding: 1.75rem;
}

/* ── Dropzone ── */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2.75rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: var(--bg);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: inset 0 0 40px var(--accent-glow);
}

.dropzone.has-file {
  border-color: var(--green-dim);
  border-style: solid;
  background: var(--green-glow);
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone .dz-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all var(--transition);
}

.dropzone:hover .dz-icon {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.dropzone.has-file .dz-icon {
  border-color: var(--green-dim);
  background: var(--green-glow);
}

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

.dropzone .dz-text strong {
  color: var(--accent-bright);
  font-weight: 600;
}

.dropzone .dz-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.dropzone .dz-filename {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.dropzone .dz-filename::before {
  content: '✓';
  font-size: 0.7rem;
}

/* ── Form Controls ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-group {
  position: relative;
}

.form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236a6a82' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* ── Toggle ── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle input {
  display: none;
}

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: all var(--transition);
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}

.toggle input:checked + .slider {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle input:checked + .slider::before {
  transform: translate(18px, -50%);
  background: #fff;
}

.toggle-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Buttons ── */
.btn {
  width: 100%;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 1.25rem;
  position: relative;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--accent-dim);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-success {
  background: var(--green-dim);
  color: #fff;
  display: none;
  box-shadow: 0 2px 12px rgba(5, 150, 105, 0.3);
}

.btn-success:hover {
  background: var(--green);
  box-shadow: 0 4px 24px rgba(5, 150, 105, 0.4);
  transform: translateY(-1px);
}

/* ── Status ── */
.status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  display: none;
  line-height: 1.5;
}

.status.loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-glow);
  color: var(--accent-bright);
  border: 1px solid rgba(129, 140, 248, 0.2);
}

.status.success {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.status.error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ── Spinner ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Footer ── */
.footer {
  padding: 3rem 0 2rem;
  position: relative;
  z-index: 1;
}

.footer-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 2rem;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-left {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-left .footer-brand {
  font-weight: 600;
  color: var(--text-secondary);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.footer-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.footer-link:hover {
  color: var(--accent-bright);
}

.footer-link svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ── Animations ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeUp 0.5s ease-out both;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .card-body {
    padding: 1.25rem;
  }

  .nav-links {
    gap: 1rem;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}
