/* ═══════════════════════════════════════════════════════════════
   FxMath Harmony Pro — Landing Page & Docs
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset & Variables ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0a0e14;
  --bg2: #111820;
  --bg3: #1a2433;
  --card: #141c28;
  --border: #2a3440;
  --border-light: #3a4860;
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #6e7681;
  --accent: #e94560;
  --accent-hover: #ff5a7a;
  --green: #2ea043;
  --green-glow: rgba(46, 160, 67, 0.15);
  --green-hover: #3fb950;
  --blue: #58a6ff;
  --blue-glow: rgba(88, 166, 255, 0.12);
  --gold: #f1c40f;
  --purple: #a371f7;
  --teal: #56d4dd;
  --orange: #f0883e;
  --red: #da3633;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --max-width: 1200px;
  --header-h: 68px;
  --radius: 12px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold); }

::selection { background: var(--accent); color: white; }

/* ─── Preloader ─── */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 24px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#preloader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.preloader-text { font-size: 13px; color: var(--text2); letter-spacing: 2px; text-transform: uppercase; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── Header / Nav ─── */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.3s;
}
header.scrolled { border-color: var(--border-light); }
.nav-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 100%; padding: 0 24px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 800; color: var(--text);
}
.nav-brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900; color: #fff;
}
.nav-brand .version { font-size: 10px; color: var(--text3); font-weight: 500; margin-left: 2px; }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  color: var(--text2); font-size: 13px; font-weight: 500;
  transition: all 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--bg3); }
.nav-links a.active { color: var(--text); background: var(--bg3); }
.nav-cta {
  background: var(--accent) !important; color: #fff !important;
  padding: 8px 20px !important; border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
}
.nav-cta:hover { background: var(--accent-hover) !important; }

/* Mobile menu */
.mobile-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px;
}
.mobile-toggle span {
  width: 24px; height: 2px; background: var(--text2);
  border-radius: 2px; transition: all 0.3s;
}

/* ─── Hero ─── */
.hero {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 120px 24px 80px;
  position: relative; overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(233, 69, 96, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(88, 166, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 20% 70%, rgba(163, 113, 247, 0.05) 0%, transparent 50%);
}
.hero-grid-lines {
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
}
.hero-content {
  position: relative; z-index: 1;
  max-width: 800px; text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-glow); border: 1px solid rgba(46, 160, 67, 0.3);
  padding: 6px 16px; border-radius: 20px;
  font-size: 12px; color: var(--green); font-weight: 600;
  margin-bottom: 24px;
}
.hero-badge .dot {
  width: 6px; height: 6px; background: var(--green);
  border-radius: 50%; animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 20px; letter-spacing: -1px;
}
.hero h1 .highlight { background: linear-gradient(135deg, var(--accent), var(--purple)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text2); max-width: 620px; margin: 0 auto 36px;
  line-height: 1.7;
}
.hero-actions {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: all 0.25s; border: 1px solid transparent;
  font-family: var(--font);
}
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(233, 69, 96, 0.25); }
.btn-secondary {
  background: transparent; color: var(--text); border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }
.btn-outline {
  background: transparent; color: var(--blue); border-color: var(--blue);
}
.btn-outline:hover { background: var(--blue-glow); transform: translateY(-2px); }
.hero-stats {
  display: flex; justify-content: center; gap: 40px; margin-top: 48px;
  padding-top: 40px; border-top: 1px solid var(--border);
}
.hero-stat { text-align: center; }
.hero-stat .num { font-size: 28px; font-weight: 800; color: var(--text); }
.hero-stat .label { font-size: 12px; color: var(--text3); margin-top: 4px; text-transform: uppercase; letter-spacing: 1px; }

/* ─── Section Common ─── */
section { padding: 100px 24px; }
.section-inner { max-width: var(--max-width); margin: 0 auto; }
.section-label {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px;
}
.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 800; margin-bottom: 16px; letter-spacing: -0.5px;
}
.section-sub {
  font-size: 1rem; color: var(--text2); max-width: 640px;
  line-height: 1.7;
}

/* ─── Features ─── */
#features { background: var(--bg2); }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px; margin-top: 48px;
}
.feature-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  transition: all 0.3s;
}
.feature-card:hover {
  border-color: var(--border-light);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.feature-card .icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 16px;
}
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: var(--text2); line-height: 1.7; }

/* ─── How It Works ─── */
.steps { display: flex; flex-direction: column; gap: 0; margin-top: 48px; position: relative; }
.steps::before {
  content: ''; position: absolute; left: 28px; top: 40px; bottom: 40px;
  width: 2px; background: linear-gradient(to bottom, var(--accent), var(--blue));
}
.step {
  display: flex; gap: 28px; padding: 28px 0;
  position: relative;
}
.step-num {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: var(--accent);
  flex-shrink: 0; z-index: 1;
}
.step-body h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.step-body p { font-size: 14px; color: var(--text2); line-height: 1.7; max-width: 560px; }

/* ─── Screenshots ─── */
#screenshots { background: var(--bg2); }
.screenshot-showcase {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-top: 48px;
}
.screenshot-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: all 0.3s;
}
.screenshot-item:hover { border-color: var(--border-light); transform: translateY(-3px); }
.screenshot-item .mockup {
  height: 220px; display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: var(--text3);
  background: linear-gradient(135deg, var(--bg), var(--bg3));
  border-bottom: 1px solid var(--border);
}
.screenshot-item .mockup .demo-chart {
  width: 100%; height: 100%; padding: 20px;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: 6px;
}
.screenshot-item .mockup .demo-chart .bar {
  height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, var(--green), var(--accent));
  opacity: 0.3;
}
.screenshot-item .mockup .demo-chart .bar:nth-child(1) { width: 65%; opacity: 0.5; }
.screenshot-item .mockup .demo-chart .bar:nth-child(2) { width: 80%; }
.screenshot-item .mockup .demo-chart .bar:nth-child(3) { width: 45%; opacity: 0.4; }
.screenshot-item .mockup .demo-chart .bar:nth-child(4) { width: 90%; }
.screenshot-item .mockup .demo-chart .bar:nth-child(5) { width: 55%; }
.screenshot-item .caption { padding: 16px 20px; }
.screenshot-item .caption h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.screenshot-item .caption p { font-size: 12px; color: var(--text2); }

/* ─── Tech Stack ─── */
#tech { background: var(--bg); }
.tech-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-top: 40px;
}
.tech-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px; text-align: center;
  transition: all 0.25s;
}
.tech-item:hover { border-color: var(--border-light); }
.tech-item .tech-icon { font-size: 32px; margin-bottom: 10px; }
.tech-item .tech-name { font-size: 14px; font-weight: 600; }
.tech-item .tech-desc { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ─── Download / CTA ─── */
#download {
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
  text-align: center;
}
.download-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px; margin-top: 40px; max-width: 600px; margin-left: auto; margin-right: auto;
}
.download-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px 28px;
  transition: all 0.3s;
}
.download-card:hover { border-color: var(--blue); transform: translateY(-4px); }
.download-card .icon { font-size: 40px; margin-bottom: 16px; }
.download-card h3 { font-size: 18px; font-weight: 700; }
.download-card p { font-size: 13px; color: var(--text2); margin: 8px 0 20px; }

/* ─── Pricing Cards ─── */
.pricing-card:hover {
  border-color: var(--blue) !important;
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* ─── FAQ ─── */
#faq { background: var(--bg2); }
.faq-list { margin-top: 40px; display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.faq-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color 0.2s;
}
.faq-item:hover { border-color: var(--border-light); }
.faq-q {
  padding: 18px 20px; cursor: pointer; display: flex;
  justify-content: space-between; align-items: center;
  font-size: 14px; font-weight: 600; user-select: none;
}
.faq-q .arrow { font-size: 10px; color: var(--text3); transition: transform 0.3s; }
.faq-item.open .faq-q .arrow { transform: rotate(180deg); }
.faq-a {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 20px; font-size: 13px; color: var(--text2); line-height: 1.7;
}
.faq-item.open .faq-a {
  max-height: 300px; padding: 0 20px 18px;
}

/* ─── Footer ─── */
footer {
  background: var(--bg); border-top: 1px solid var(--border);
  padding: 48px 24px 32px;
}
.footer-inner {
  max-width: var(--max-width); margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer-brand .logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 800; margin-bottom: 12px;
}
.footer-brand p { font-size: 12px; color: var(--text3); line-height: 1.7; max-width: 300px; }
.footer-col h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); margin-bottom: 14px; }
.footer-col a {
  display: block; font-size: 13px; color: var(--text2);
  padding: 4px 0; transition: color 0.2s;
}
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  max-width: var(--max-width); margin: 32px auto 0;
  padding-top: 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text3);
}

/* ════════════════════════════════════════════════════════
   DOCS PAGE
   ════════════════════════════════════════════════════════ */
.docs-layout {
  display: flex; gap: 0; padding-top: var(--header-h);
  min-height: 100vh;
}
.docs-sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  padding: 24px 0; position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h)); overflow-y: auto;
}
.docs-sidebar .sidebar-section { margin-bottom: 24px; }
.docs-sidebar .sidebar-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text3); padding: 0 20px 8px;
}
.docs-sidebar a {
  display: block; padding: 7px 20px; font-size: 13px;
  color: var(--text2); transition: all 0.15s;
  border-left: 2px solid transparent;
}
.docs-sidebar a:hover { color: var(--text); background: var(--bg3); }
.docs-sidebar a.active {
  color: var(--text); background: var(--bg3); border-left-color: var(--accent);
  font-weight: 600;
}
.docs-content {
  flex: 1; min-width: 0; padding: 48px 48px 80px;
  max-width: 860px;
}
.docs-content h1 {
  font-size: 2.2rem; font-weight: 800; margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.docs-content h2 {
  font-size: 1.5rem; font-weight: 700; margin: 40px 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.docs-content h3 { font-size: 1.1rem; font-weight: 700; margin: 28px 0 8px; }
.docs-content p { margin-bottom: 16px; color: var(--text2); line-height: 1.7; }
.docs-content ul, .docs-content ol { margin: 0 0 16px 24px; color: var(--text2); line-height: 1.7; }
.docs-content li { margin-bottom: 6px; }
.docs-content strong { color: var(--text); }

/* Code blocks */
.docs-content code {
  font-family: var(--font-mono); font-size: 13px;
  background: var(--bg3); padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border);
}
.docs-content pre {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px;
  overflow-x: auto; margin: 16px 0;
}
.docs-content pre code {
  background: none; padding: 0; border: none;
  font-size: 13px; line-height: 1.6;
}

/* Tables */
.docs-content table {
  width: 100%; border-collapse: collapse;
  margin: 16px 0; font-size: 13px;
}
.docs-content th, .docs-content td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.docs-content th {
  background: var(--bg3); font-weight: 600; color: var(--text);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
.docs-content tr:hover td { background: rgba(255,255,255,0.02); }

/* Info boxes */
.docs-content .info-box {
  background: var(--blue-glow); border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: var(--radius-sm); padding: 16px 20px; margin: 16px 0;
  font-size: 13px; color: var(--text2);
}
.docs-content .info-box strong { color: var(--blue); }
.docs-content .warn-box {
  background: rgba(210, 153, 34, 0.08); border: 1px solid rgba(210, 153, 34, 0.2);
  border-radius: var(--radius-sm); padding: 16px 20px; margin: 16px 0;
  font-size: 13px; color: var(--text2);
}
.docs-content .warn-box strong { color: var(--gold); }

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none; position: fixed; bottom: 20px; right: 20px; z-index: 99;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 20px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .screenshot-showcase { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .docs-sidebar {
    position: fixed; left: -280px; top: var(--header-h); z-index: 50;
    height: calc(100vh - var(--header-h)); transition: left 0.3s;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .docs-sidebar.open { left: 0; }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .docs-content { padding: 32px 20px 80px; }
}
@media (max-width: 700px) {
  .nav-links { display: none; }
  .mobile-toggle { display: flex; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 16px; gap: 4px;
  }
  .hero-stats { flex-direction: column; gap: 20px; }
  .features-grid { grid-template-columns: 1fr; }
  .steps::before { left: 20px; }
  .step-num { width: 44px; height: 44px; font-size: 16px; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}
