/* ════════════════════════════════════════════════════════
   DSF-AI — Clean, fast, professional
   ════════════════════════════════════════════════════════ */

:root {
  --bg: #fafafa;
  --bg-alt: #f0f0f0;
  --text: #1a1a1a;
  --text-muted: #666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #ddd;
  --card-bg: #fff;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* ── Header ─────────────────────────────────────────── */
header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -1px;
}

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

nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.9rem;
}

nav a:hover { color: var(--accent); }

.nav-auth {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.9rem;
}

#user-button {
  margin-left: 1rem;
  display: inline-flex;
  align-items: center;
}

.user-info {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.user-name {
  font-weight: 600;
  color: var(--text);
}

.user-credits {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-account {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.9rem;
}

/* ── Hero ───────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
}

.hero h2 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.3;
  max-width: 700px;
  margin: 0 auto 1rem;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

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

.domain-tag {
  background: #f0f0f0;
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

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

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover { background: #f0f5ff; }

.btn-small {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  background: #eee;
  color: var(--text);
}

.btn-small:hover { background: #ddd; }

/* ── Sections ───────────────────────────────────────── */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.section h2 {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.section > p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.section-alt {
  background: var(--bg-alt);
  max-width: none;
  padding-left: calc((100% - 1100px) / 2 + 1.5rem);
  padding-right: calc((100% - 1100px) / 2 + 1.5rem);
}

/* ── Upload Area ────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s;
  margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent);
  background: #f8faff;
}

.upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.file-label {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.upload-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.context-row {
  margin-bottom: 1rem;
}

.context-row input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: #fff;
  cursor: text;
  position: relative;
  z-index: 10;
}

.status {
  margin: 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status.error { color: #dc2626; }

/* ── Results ────────────────────────────────────────── */
.results {
  margin-top: 2rem;
}

.result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.file-selected {
  font-weight: 600;
  color: var(--success);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.card h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.card ul {
  list-style: none;
  padding: 0;
}

.card li {
  padding: 0.3rem 0;
  font-size: 0.95rem;
  border-bottom: 1px solid #f0f0f0;
}

.card li:last-child { border-bottom: none; }

.narrative {
  background: #f8faff;
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.narrative h4 { margin-bottom: 0.5rem; color: var(--accent); }

.result-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.download-warning {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: #92400e;
}

.download-row {
  display: flex;
  gap: 0.5rem;
}

/* ── Cluster Screener ───────────────────────────────── */
.cluster-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.form-group select {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: #fff;
  min-width: 160px;
}

.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.property-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.property-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.property-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.property-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cluster-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cluster-warning {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.cluster-viable {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}

/* ── Example ────────────────────────────────────────── */
.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.example-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.example-table th, .example-table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.example-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.table-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.tc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.tc-table th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.tc-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid #f0f0f0;
}

.tc-table tr:hover { background: #f8faff; }

.tc-delta { font-weight: 700; color: var(--accent); }

/* ── Pricing ────────────────────────────────────────── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.pricing-free-note {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: #166534;
}

.pricing-subtitle {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.pricing-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), var(--shadow);
}

.pricing-card h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.price {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.pricing-card .buy-btn {
  margin-top: 0.75rem;
  background: var(--accent);
  color: #fff;
}

.pricing-card .buy-btn:hover {
  background: var(--accent-hover);
}

.pricing-contact {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pricing-contact a {
  color: var(--accent);
}

/* ── Footer ─────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-note { margin-top: 0.25rem; }
.footer-note a { color: var(--accent); }

/* ── Regime bar ─────────────────────────────────────── */
.regime-bar {
  display: flex;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.regime-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  min-width: 30px;
}

.regime-STABLE { background: var(--success); }
.regime-VOLATILE { background: #dc2626; }
.regime-TRANSITIONAL { background: var(--warning); }
.regime-DEGENERATE { background: #6b7280; }

.regime-list {
  margin-top: 0.5rem;
}

.regime-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid #f0f0f0;
}

.regime-row:last-child { border-bottom: none; }

.regime-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.regime-dot.regime-STABLE { background: var(--success); }
.regime-dot.regime-VOLATILE { background: #dc2626; }
.regime-dot.regime-TRANSITIONAL { background: var(--warning); }
.regime-dot.regime-DEGENERATE { background: #6b7280; }

.regime-range {
  margin-left: auto;
  color: var(--text-muted);
}

.payment-success-banner {
  background: #16a34a;
  color: #fff;
  text-align: center;
  padding: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  .hero h2 { font-size: 1.6rem; }
  .cluster-form { flex-direction: column; }
  .result-meta { flex-direction: column; gap: 0.3rem; }
  .section-alt {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}
