/* ============================================================
   Sentrix Help Center — styles.css
   ============================================================ */

:root {
  --bg-base:      #020817;
  --bg-surface:   #0f172a;
  --bg-elevated:  #1e293b;
  --bg-hover:     #263148;
  --border:       #334155;
  --border-light: #475569;
  --text-primary: #f1f5f9;
  --text-muted:   #94a3b8;
  --text-dim:     #64748b;
  --accent:       #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #1d3a6e;
  --green:        #10b981;
  --amber:        #f59e0b;
  --red:          #ef4444;
  --purple:       #8b5cf6;
  --cyan:         #06b6d4;
  --sidebar-w:    280px;
  --topbar-h:     60px;
  --radius:       8px;
  --radius-sm:    4px;
  --mono:         'Consolas', 'Monaco', 'Courier New', monospace;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ──────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 100;
}
#topbar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}
#topbar .logo-icon {
  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; flex-shrink: 0;
}
#topbar .logo span { color: var(--text-muted); font-weight: 400; margin-left: 4px; }
#search-wrap {
  flex: 1;
  max-width: 480px;
  margin-left: 16px;
  position: relative;
}
#search-wrap svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none;
}
#search-input {
  width: 100%;
  padding: 8px 12px 8px 38px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
#search-input:focus { border-color: var(--accent); }
#search-input::placeholder { color: var(--text-dim); }
#search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 380px;
  overflow-y: auto;
  display: none;
  z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#search-results.open { display: block; }
.sr-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--bg-hover); }
.sr-item-title { font-weight: 600; font-size: 0.9rem; }
.sr-item-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.sr-empty { padding: 20px; text-align: center; color: var(--text-dim); font-size: 0.85rem; }
.topbar-spacer { flex: 1; }
.topbar-badge {
  font-size: 0.72rem; background: var(--accent-light); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 20px; padding: 2px 10px;
  white-space: nowrap;
}

/* ── Layout ───────────────────────────────────────────────── */
#layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px 0 24px;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-section { margin-bottom: 4px; }
.nav-section-header {
  padding: 6px 20px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-top: 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
  user-select: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-count {
  margin-left: auto;
  font-size: 0.68rem;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 1px 7px;
}

.nav-group { }
.nav-group-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  border-left: 3px solid transparent;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
.nav-group-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-group-toggle .toggle-arrow {
  margin-left: auto; font-size: 0.65rem;
  transition: transform 0.2s;
}
.nav-group.open .toggle-arrow { transform: rotate(90deg); }
.nav-group-children { display: none; padding-left: 16px; }
.nav-group.open .nav-group-children { display: block; }

/* ── Main Content ─────────────────────────────────────────── */
#main {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  background: var(--bg-base);
}
#main::-webkit-scrollbar { width: 6px; }
#main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: 2rem; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; line-height: 1.25; }
h2 { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin: 28px 0 12px; }
h4 { font-size: 0.95rem; font-weight: 700; color: var(--text-muted); margin: 20px 0 8px; text-transform: uppercase; letter-spacing: 0.05em; }
p { color: var(--text-muted); margin-bottom: 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.page-lead { font-size: 1.05rem; color: var(--text-muted); max-width: 620px; margin-bottom: 32px; }
.page-hero { margin-bottom: 40px; }

/* ── Cards ────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.card-grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card-grid-2 { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

.info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s, transform 0.15s;
  cursor: pointer;
}
.info-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.info-card .card-icon { font-size: 1.6rem; margin-bottom: 10px; }
.info-card .card-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.info-card .card-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.info-card .card-tag {
  display: inline-block; margin-top: 8px;
  font-size: 0.68rem; background: var(--bg-elevated); color: var(--text-dim);
  border-radius: 3px; padding: 2px 6px;
}

/* ── Code Blocks ──────────────────────────────────────────── */
code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-elevated);
  color: var(--cyan);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}
pre code {
  background: none; padding: 0; color: var(--text-primary);
  font-size: 0.855rem; line-height: 1.7;
}
.code-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); margin-bottom: 6px;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px; font-size: 0.72rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  background: var(--bg-elevated); color: var(--text-muted);
  font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
td { padding: 9px 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }
td code { font-size: 0.82rem; }

/* ── Callouts / Alerts ────────────────────────────────────── */
.callout {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 18px; border-radius: var(--radius);
  margin: 16px 0; font-size: 0.875rem;
  border-left: 4px solid;
}
.callout-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.callout.tip { background: #0c2d1e; border-color: var(--green); }
.callout.tip .callout-icon::before { content: '💡'; }
.callout.note { background: #1a2a4a; border-color: var(--accent); }
.callout.note .callout-icon::before { content: 'ℹ️'; }
.callout.warn { background: #2a1f0a; border-color: var(--amber); }
.callout.warn .callout-icon::before { content: '⚠️'; }
.callout p { margin: 0; color: var(--text-muted); }

/* ── Badges / Tags ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 0.72rem; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; gap: 4px;
}
.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-green { background: #083d27; color: var(--green); }
.badge-amber { background: #2a1f0a; color: var(--amber); }
.badge-purple { background: #26144a; color: var(--purple); }
.badge-cyan { background: #0a2a34; color: var(--cyan); }
.badge-gray { background: var(--bg-elevated); color: var(--text-dim); }

/* ── Widget Reference ─────────────────────────────────────── */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.widget-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
  position: relative;
}
.widget-card:hover { border-color: var(--accent); background: var(--bg-hover); }
.widget-card .w-icon { font-size: 1.4rem; margin-bottom: 8px; }
.widget-card .w-name { font-weight: 700; font-size: 0.9rem; margin-bottom: 3px; }
.widget-card .w-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; }
.widget-card .w-cat { margin-top: 8px; }
.widget-num {
  position: absolute; top: 10px; right: 12px;
  font-size: 0.7rem; color: var(--text-dim); font-weight: 700;
}

/* Widget detail panel */
.widget-detail {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 24px;
  overflow: hidden;
}
.widget-detail-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.widget-detail-header .dh-icon { font-size: 2rem; }
.widget-detail-header .dh-name { font-size: 1.3rem; font-weight: 800; }
.widget-detail-header .dh-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.widget-detail-body { padding: 24px; }
.widget-detail-close {
  margin-left: auto; background: none; border: 1px solid var(--border);
  color: var(--text-dim); border-radius: var(--radius-sm); padding: 4px 12px;
  cursor: pointer; font-size: 0.8rem; transition: all 0.15s;
}
.widget-detail-close:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Category filter bar */
.cat-bar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
}
.cat-btn {
  padding: 5px 14px; font-size: 0.8rem; font-weight: 600;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 20px; cursor: pointer;
  transition: all 0.15s;
}
.cat-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.cat-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Shortcut Table ───────────────────────────────────────── */
.shortcut-section { margin-bottom: 32px; }
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 8px;
}
.shortcut-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 12px;
}
.shortcut-row .action { font-size: 0.85rem; color: var(--text-muted); }
.shortcut-row .keys { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
kbd {
  display: inline-block;
  font-family: var(--mono); font-size: 0.75rem;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  color: var(--text-primary);
  padding: 2px 7px; border-radius: 4px;
}

/* ── Script Reference ─────────────────────────────────────── */
.script-section { margin-bottom: 40px; }
.script-cmd { margin-bottom: 20px; }
.script-cmd .cmd-title { font-weight: 700; color: var(--text-primary); font-size: 0.95rem; margin-bottom: 8px; }
.script-cmd .cmd-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; }
.fn-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-top: 12px;
}
.fn-item {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
}
.fn-item code { color: var(--green); }
.fn-item .fn-desc { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }

/* ── Step Guide ───────────────────────────────────────────── */
.steps { counter-reset: step; }
.step {
  display: flex; gap: 20px; margin-bottom: 28px;
  counter-increment: step;
}
.step-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem; flex-shrink: 0; margin-top: 2px;
}
.step-content .step-title { font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.step-content p { margin: 0; color: var(--text-muted); font-size: 0.875rem; }

/* ── Home Page Hero ───────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1a1040 50%, #0f2830 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 40px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(59,130,246,0.08) 0%, transparent 60%);
}
.hero-banner h1 { font-size: 2.4rem; margin-bottom: 12px; position: relative; }
.hero-banner p { font-size: 1.05rem; max-width: 540px; position: relative; margin-bottom: 24px; }
.hero-btns { display: flex; gap: 12px; flex-wrap: wrap; position: relative; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius); font-weight: 600;
  font-size: 0.9rem; cursor: pointer; text-decoration: none;
  transition: all 0.15s; border: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-outline:hover { background: var(--bg-elevated); border-color: var(--accent); text-decoration: none; }

/* ── Feature Grid (Home) ──────────────────────────────────── */
.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px; margin-bottom: 40px;
}
.feature-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 20px;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--border-light); }
.feature-card .f-icon { font-size: 1.5rem; margin-bottom: 12px; }
.feature-card .f-title { font-weight: 700; margin-bottom: 6px; }
.feature-card .f-desc { font-size: 0.83rem; color: var(--text-muted); line-height: 1.55; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 220px; }
  #main { padding: 24px 20px; }
  h1 { font-size: 1.6rem; }
  .hero-banner { padding: 32px 24px; }
}
@media (max-width: 680px) {
  #sidebar { display: none; }
  #main { padding: 20px 16px; }
}

/* ── Scrollbar global ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Misc ─────────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 8px; }
