/* ============================================================
   AUTOMATION HUB — Documentation Stylesheet
   Professional, dark-themed documentation with violet accent
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --brand:          #7c3aed;
  --brand-light:    #a78bfa;
  --brand-dark:     #5b21b6;
  --brand-bg:       rgba(124,58,237,.08);
  --brand-glow:     rgba(124,58,237,.25);

  --bg-base:        #0f1117;
  --bg-surface:     #161b27;
  --bg-elevated:    #1e2538;
  --bg-hover:       #252d3f;
  --bg-code:        #0d1117;

  --text-primary:   #e2e8f0;
  --text-secondary: #a8b2c7;
  --text-muted:     #6b7a94;
  --text-inverse:   #0f1117;

  --border:         #2a3348;
  --border-light:   #1e2a3d;

  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;

  --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
  --shadow-md:      0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:      0 8px 24px rgba(0,0,0,.5);

  --sidebar-w:      280px;
  --topnav-h:       60px;
  --transition:     250ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand); }
img { max-width: 100%; height: auto; }
code { font-family: var(--font-mono); font-size: .875em; }
::selection { background: var(--brand); color: #fff; }

/* ── Typography ── */
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.015em; line-height: 1.3; margin: 2.5rem 0 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; }
h2 svg { flex-shrink: 0; color: var(--brand-light); }
h3 { font-size: 1.15rem; font-weight: 600; margin: 2rem 0 .75rem; color: var(--text-primary); }
h4 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 .5rem; }
p { margin-bottom: 1rem; color: var(--text-secondary); }
ul, ol { margin: 0 0 1rem 1.5rem; color: var(--text-secondary); }
li { margin-bottom: .35rem; }
li > ul, li > ol { margin-top: .35rem; }
hr { border: none; height: 1px; background: var(--border); margin: 2rem 0; }
strong { color: var(--text-primary); font-weight: 600; }
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .875rem; }
thead th { background: var(--bg-elevated); color: var(--text-primary); font-weight: 600; text-align: left; padding: .75rem 1rem; border-bottom: 2px solid var(--border); }
tbody td { padding: .65rem 1rem; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); vertical-align: top; }
tbody tr:hover { background: var(--bg-surface); }

/* ── Layout ── */
.doc-topnav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topnav-h);
  background: rgba(15,17,23,.85); backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; z-index: 100;
}
.topnav-brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .95rem; color: var(--text-primary); }
.topnav-brand svg { color: var(--brand); }
.topnav-right { display: flex; align-items: center; gap: 1rem; }
.topnav-search {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: .35rem .75rem;
}
.topnav-search input {
  background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: .8rem; width: 180px;
  font-family: var(--font-sans);
}
.topnav-search input::placeholder { color: var(--text-muted); }
.topnav-search svg { color: var(--text-muted); flex-shrink: 0; }
.topnav-link {
  font-size: .8rem; color: var(--text-muted); font-weight: 500;
  transition: color var(--transition);
}
.topnav-link:hover { color: var(--text-primary); }
.topnav-badge {
  background: var(--brand-bg); color: var(--brand-light);
  font-size: .7rem; font-weight: 600; padding: .2rem .5rem;
  border-radius: var(--radius-sm); border: 1px solid rgba(124,58,237,.2);
}
.hamburger { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: .25rem; }

.doc-sidebar {
  position: fixed; top: var(--topnav-h); left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  overflow-y: auto; padding: 1rem 0; z-index: 90;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.doc-sidebar::-webkit-scrollbar { width: 4px; }
.doc-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar-logo {
  padding: 0 1.25rem 1rem; border-bottom: 1px solid var(--border-light); margin-bottom: .75rem;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 700; color: var(--text-primary);
}
.sidebar-brand svg { color: var(--brand); }
.sidebar-section { padding: .25rem 1.25rem; margin-top: .5rem; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.sidebar-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem 1.25rem; margin: 1px .5rem; border-radius: var(--radius-md);
  font-size: .82rem; font-weight: 500; color: var(--text-secondary);
  transition: all var(--transition); cursor: pointer; text-decoration: none;
}
.sidebar-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item.active { background: var(--brand-bg); color: var(--brand-light); font-weight: 600; }
.sidebar-item svg { flex-shrink: 0; width: 16px; height: 16px; }

.doc-content {
  margin-left: var(--sidebar-w); margin-top: var(--topnav-h);
  padding: 2rem 3rem 4rem; max-width: 900px;
}

.breadcrumb {
  display: flex; align-items: center; gap: .5rem;
  margin-bottom: 1.5rem; font-size: .8rem; color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--brand-light); }
.breadcrumb .sep { color: var(--border); }

/* ── Page Header ── */
.page-header { margin-bottom: 2.5rem; }
.page-header h1 { font-size: 2.25rem; margin-bottom: .5rem; }
.page-header .subtitle { font-size: 1.05rem; color: var(--text-muted); margin-bottom: 1rem; }
.badge-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .7rem; font-weight: 600; padding: .2rem .6rem;
  border-radius: var(--radius-sm); border: 1px solid;
}
.badge-primary   { background: var(--brand-bg); color: var(--brand-light); border-color: rgba(124,58,237,.2); }
.badge-success   { background: rgba(16,185,129,.1); color: #34d399; border-color: rgba(16,185,129,.2); }
.badge-warning   { background: rgba(245,158,11,.1); color: #fbbf24; border-color: rgba(245,158,11,.2); }
.badge-danger    { background: rgba(239,68,68,.1); color: #f87171; border-color: rgba(239,68,68,.2); }
.badge-info      { background: rgba(59,130,246,.1); color: #60a5fa; border-color: rgba(59,130,246,.2); }
.badge-tech      { background: var(--bg-elevated); color: var(--text-secondary); border-color: var(--border); }

/* ── Hero (index.html only) ── */
.hero {
  background: linear-gradient(135deg, rgba(124,58,237,.08) 0%, rgba(59,130,246,.05) 100%);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 3rem; margin-bottom: 3rem; text-align: center;
}
.hero h1 { font-size: 2.5rem; margin-bottom: .75rem; }
.hero .subtitle { font-size: 1.1rem; max-width: 600px; margin: 0 auto 1.5rem; }
.hero-actions { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.25rem; border-radius: var(--radius-md);
  font-size: .85rem; font-weight: 600; transition: all var(--transition);
}
.hero-btn-primary { background: var(--brand); color: #fff; }
.hero-btn-primary:hover { background: var(--brand-dark); color: #fff; }
.hero-btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.hero-btn-outline:hover { border-color: var(--brand-light); color: var(--brand-light); }

/* ── Feature Cards ── */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.feature-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  transition: all var(--transition);
}
.feature-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.feature-card-icon {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--brand-bg); color: var(--brand-light); margin-bottom: .75rem;
}
.feature-card h3 { font-size: .9rem; margin: 0 0 .35rem; }
.feature-card p { font-size: .8rem; color: var(--text-muted); margin: 0; line-height: 1.5; }

/* ── Callout Boxes ── */
.callout {
  display: flex; gap: .75rem; padding: 1rem 1.25rem;
  border-radius: var(--radius-md); margin: 1.5rem 0;
  border: 1px solid;
}
.callout-icon { flex-shrink: 0; margin-top: 2px; }
.callout-body { flex: 1; }
.callout-title { font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.callout p:last-child { margin-bottom: 0; }
.callout-info    { background: rgba(59,130,246,.06); border-color: rgba(59,130,246,.2); }
.callout-info    .callout-icon { color: var(--info); }
.callout-info    .callout-title { color: #60a5fa; }
.callout-warning { background: rgba(245,158,11,.06); border-color: rgba(245,158,11,.2); }
.callout-warning .callout-icon { color: var(--warning); }
.callout-warning .callout-title { color: #fbbf24; }
.callout-tip     { background: rgba(16,185,129,.06); border-color: rgba(16,185,129,.2); }
.callout-tip     .callout-icon { color: var(--success); }
.callout-tip     .callout-title { color: #34d399; }
.callout-danger  { background: rgba(239,68,68,.06); border-color: rgba(239,68,68,.2); }
.callout-danger  .callout-icon { color: var(--danger); }
.callout-danger  .callout-title { color: #f87171; }

/* ── Code Blocks ── */
.code-block {
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin: 1.25rem 0; overflow: hidden;
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem 1rem; background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-light);
}
.code-block-dots { display: flex; gap: 6px; }
.code-block-dots span { width: 10px; height: 10px; border-radius: 50%; }
.code-block-dots span:nth-child(1) { background: #ef4444; }
.code-block-dots span:nth-child(2) { background: #f59e0b; }
.code-block-dots span:nth-child(3) { background: #10b981; }
.code-block-lang { font-size: .7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.copy-btn {
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: .7rem; font-weight: 500; padding: .2rem .5rem;
  cursor: pointer; transition: all var(--transition); font-family: var(--font-sans);
}
.copy-btn:hover { color: var(--text-primary); border-color: var(--brand-light); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }
.code-block pre {
  padding: 1rem; margin: 0; overflow-x: auto; font-size: .825rem; line-height: 1.6;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.code-block pre::-webkit-scrollbar { height: 4px; }
.code-block pre::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.code-block code { color: var(--text-primary); background: none; padding: 0; }

/* Inline code */
:not(pre) > code {
  background: var(--bg-elevated); color: var(--brand-light);
  padding: .15em .4em; border-radius: var(--radius-sm);
  font-size: .85em; border: 1px solid var(--border);
}

/* ── Step List ── */
.step-list { list-style: none; margin-left: 0; counter-reset: step-counter; }
.step-card {
  display: flex; gap: 1rem; padding: 1.25rem;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: .75rem;
  transition: border-color var(--transition);
}
.step-card:hover { border-color: var(--brand); }
.step-number {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand-bg); color: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700;
}
.step-body { flex: 1; }
.step-body h4 { margin: 0 0 .35rem; font-size: .95rem; }
.step-body p { margin: 0; font-size: .85rem; color: var(--text-secondary); }

/* ── Quick Links Grid ── */
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin: 1.5rem 0; }
.quick-link {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: .85rem; font-weight: 500; color: var(--text-secondary);
  transition: all var(--transition);
}
.quick-link:hover { border-color: var(--brand); color: var(--brand-light); transform: translateX(2px); }
.quick-link svg { flex-shrink: 0; color: var(--brand-light); }

/* ── Node Reference Card ── */
.node-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem;
}
.node-card-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.node-card-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
}
.node-card-icon.core     { background: rgba(59,130,246,.12); color: #60a5fa; }
.node-card-icon.email    { background: rgba(59,130,246,.12); color: #3b82f6; }
.node-card-icon.whatsapp { background: rgba(16,185,129,.12); color: #10b981; }
.node-card-icon.ai       { background: rgba(139,92,246,.12); color: #a78bfa; }
.node-card-icon.courier  { background: rgba(245,158,11,.12); color: #f59e0b; }
.node-card-icon.notify   { background: rgba(236,72,153,.12); color: #ec4899; }
.node-card h4 { margin: 0; font-size: .95rem; }
.node-card .node-type { font-size: .7rem; color: var(--text-muted); font-family: var(--font-mono); }
.node-card p { font-size: .85rem; margin: 0; }

/* ── Comparison Table ── */
.comparison-table th:first-child { width: 200px; }
.comparison-table .check { color: var(--success); text-align: center; }
.comparison-table .cross { color: var(--danger); text-align: center; }
.comparison-table .partial { color: var(--warning); text-align: center; }

/* ── Template Card ── */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.template-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.25rem;
  transition: all var(--transition);
}
.template-card:hover { border-color: var(--brand); }
.template-card h4 { margin: 0 0 .35rem; font-size: .9rem; }
.template-card p { font-size: .8rem; margin: 0 0 .5rem; color: var(--text-muted); }
.template-card .template-tags { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ── ENV Table ── */
.env-table td:first-child { font-family: var(--font-mono); font-size: .8rem; white-space: nowrap; color: var(--brand-light); }
.env-table td:nth-child(2) { font-size: .82rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .hamburger { display: block; }
  .doc-sidebar { transform: translateX(-100%); transition: transform var(--transition); z-index: 110; }
  body.sidebar-open .doc-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 105; background: rgba(0,0,0,.5); }
  .doc-content { margin-left: 0; padding: 1.5rem; }
  .hero h1 { font-size: 1.75rem; }
  .feature-grid { grid-template-columns: 1fr; }
  .topnav-search { display: none; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Highlight.js overrides ── */
.hljs { background: transparent !important; padding: 0 !important; }

/* ── Print ── */
@media print {
  .doc-sidebar, .doc-topnav, .hamburger, .copy-btn { display: none !important; }
  .doc-content { margin: 0; padding: 1rem; max-width: 100%; }
  body { background: #fff; color: #111; }
  a { color: #111; text-decoration: underline; }
  .code-block { border: 1px solid #ccc; }
}
