/* Bizlync Wiki — Custom Styles */
/* Matches the Bizlync app brand: DM Sans, teal #2A9D8F, navy #2B3674 */

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

/* ─── Brand Variables ─────────────────────────────── */
:root {
  --brand-400: #84DCC6;
  --brand-500: #2A9D8F;
  --brand-600: #23857A;
  --brand-900: #04302E;

  --navy-700:  #2B3674;
  --navy-800:  #1B2559;
  --navy-900:  #0B1437;

  --gray-400:  #A3AED0;
  --gray-500:  #707EAE;

  --bg:        #F4F7FE;
  --card-bg:   #ffffff;
  --border:    #e2e8f0;
  --shadow:    14px 17px 40px 4px rgba(112, 144, 176, 0.08);

  --header-h:  64px;
  --sidebar-w: 276px;
  --t: 0.3s ease;
  --radius: 20px;
}

[data-theme="dark"] {
  --navy-700:  #FFFFFF;
  --navy-800:  #CAD2C5;
  --navy-900:  #0F172A;
  --gray-400:  #84DCC6;
  --gray-500:  #CAD2C5;
  --bg:        #0F172A;
  --card-bg:   #1E293B;
  --border:    #2F3E46;
  --shadow:    0px 4px 10px rgba(0, 0, 0, 0.4);
}

/* ─── Reset & Base ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--navy-700);
  transition: background var(--t), color var(--t);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--brand-500); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--brand-600); }

/* ─── Header ──────────────────────────────────────── */
.wiki-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.75rem;
  z-index: 1000;
  box-shadow: var(--shadow);
  transition: background var(--t), border-color var(--t);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
  color: var(--navy-700);
  text-decoration: none;
  min-width: 0;
}
.header-brand:hover { text-decoration: none; }

.header-logo-svg {
  height: 22px;
  width: auto;
  flex-shrink: 0;
  color: var(--navy-700);
  transition: color var(--t);
}

.wiki-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--brand-500);
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.header-spacer { flex: 1; }

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  color: var(--navy-700);
  font-size: 1.05rem;
  width: 38px;
  height: 38px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--brand-400);
  border-color: var(--brand-400);
  color: var(--brand-900);
}

.btn-sidebar-toggle { display: none; }
@media (max-width: 768px) { .btn-sidebar-toggle { display: flex; } }

/* ─── Layout ──────────────────────────────────────── */
.wiki-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-h);
}

/* ─── Sidebar ─────────────────────────────────────── */
.wiki-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0 2.5rem;
  z-index: 900;
  transition: background var(--t), border-color var(--t), transform 0.3s ease;
}

.wiki-sidebar::-webkit-scrollbar { width: 3px; }
.wiki-sidebar::-webkit-scrollbar-track { background: transparent; }
.wiki-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

@media (max-width: 768px) {
  .wiki-sidebar { transform: translateX(-100%); box-shadow: none; }
  .wiki-sidebar.open { transform: translateX(0); box-shadow: 6px 0 30px rgba(0,0,0,0.18); }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 850;
}
.sidebar-overlay.active { display: block; }

/* Nav Groups */
.nav-group { margin-bottom: 0.125rem; }

.nav-group-label {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 0.85rem 1.25rem 0.35rem;
}

/* Nav Items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.575rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item i {
  font-size: 0.975rem;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}
.nav-item:hover {
  background: rgba(42, 157, 143, 0.07);
  color: var(--brand-500);
}
.nav-item.active {
  background: rgba(42, 157, 143, 0.10);
  color: var(--brand-500);
  font-weight: 600;
}
.nav-item.active::after {
  content: '';
  position: absolute;
  right: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--brand-500);
  border-radius: 2px 0 0 2px;
}

/* ─── Main Content ────────────────────────────────── */
.wiki-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2.25rem 2.5rem 5rem;
  min-height: 100vh;
}

@media (max-width: 768px) {
  .wiki-main { margin-left: 0; padding: 1.5rem 1.1rem 4rem; }
}

/* ─── Sections ────────────────────────────────────── */
.wiki-section { display: none; max-width: 860px; }
.wiki-section.active { display: block; }

/* ─── Page Header ─────────────────────────────────── */
.page-header { margin-bottom: 1.75rem; }

.page-icon {
  width: 50px; height: 50px;
  background: rgba(42, 157, 143, 0.1);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  color: var(--brand-500);
  margin-bottom: 0.875rem;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--navy-700);
  margin-bottom: 0.35rem;
  line-height: 1.25;
}

.page-header .page-lead {
  color: var(--gray-500);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ─── Cards ───────────────────────────────────────── */
.wiki-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.625rem;
  margin-bottom: 1.25rem;
  transition: background var(--t), border-color var(--t);
}

.wiki-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy-700);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.3;
}
.wiki-card h2 i { color: var(--brand-500); font-size: 1rem; flex-shrink: 0; }

.wiki-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--navy-700);
  margin: 1.125rem 0 0.4rem;
}
.wiki-card h3:first-child { margin-top: 0; }

.wiki-card p {
  font-size: 0.875rem;
  color: var(--navy-800);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}
.wiki-card p:last-child { margin-bottom: 0; }

.wiki-card ul, .wiki-card ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.wiki-card li {
  font-size: 0.875rem;
  color: var(--navy-800);
  line-height: 1.7;
  margin-bottom: 0.2rem;
}
.wiki-card li strong { color: var(--navy-700); }

/* ─── Step List ───────────────────────────────────── */
.step-list { display: flex; flex-direction: column; gap: 0.875rem; }

.step-item { display: flex; gap: 0.875rem; align-items: flex-start; }

.step-num {
  min-width: 28px; height: 28px;
  background: var(--brand-500);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.step-body { flex: 1; }
.step-body strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy-700);
  margin-bottom: 0.2rem;
}
.step-body p, .step-body span {
  font-size: 0.85rem;
  color: var(--navy-800);
  line-height: 1.65;
  margin: 0;
}

/* ─── Info Boxes ──────────────────────────────────── */
.info-box {
  border-radius: 12px;
  padding: 0.8rem 1rem;
  margin: 0.875rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--navy-700);
}
.info-box:last-child { margin-bottom: 0; }
.info-box i { flex-shrink: 0; font-size: 1rem; margin-top: 0.075rem; }

.info-box.teal  { background: rgba(42,157,143,.08); border-left: 3px solid var(--brand-500); }
.info-box.teal i { color: var(--brand-500); }

.info-box.blue  { background: rgba(59,130,246,.08); border-left: 3px solid #3B82F6; }
.info-box.blue i { color: #3B82F6; }

.info-box.amber { background: rgba(245,158,11,.08); border-left: 3px solid #F59E0B; }
.info-box.amber i { color: #F59E0B; }

.info-box.red   { background: rgba(239,68,68,.08); border-left: 3px solid #EF4444; }
.info-box.red i { color: #EF4444; }

/* ─── Feature Grid ────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.875rem;
  margin-top: 0.5rem;
}

.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  transition: background var(--t), border-color var(--t);
}
.feature-card .fc-icon {
  width: 36px; height: 36px;
  background: rgba(42,157,143,.12);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-500);
  font-size: 1rem;
  margin-bottom: 0.6rem;
}
.feature-card strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-700);
  margin-bottom: 0.2rem;
}
.feature-card span {
  font-size: 0.8rem;
  color: var(--gray-500);
  line-height: 1.5;
}

/* ─── Formula Box ─────────────────────────────────── */
.formula-box {
  background: rgba(42,157,143,.06);
  border: 1px solid rgba(42,157,143,.2);
  border-radius: 10px;
  padding: 0.875rem 1.1rem;
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 0.825rem;
  color: var(--brand-600);
  margin: 0.75rem 0;
  line-height: 1.7;
}
[data-theme="dark"] .formula-box { color: var(--brand-400); }

/* ─── FAQ ─────────────────────────────────────────── */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1.1rem 0;
}
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }

.faq-q {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy-700);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.faq-q i { color: var(--brand-500); flex-shrink: 0; margin-top: 0.1rem; }

.faq-a {
  font-size: 0.85rem;
  color: var(--navy-800);
  line-height: 1.7;
  padding-left: 1.6rem;
}

/* ─── Tags / Pills ────────────────────────────────── */
.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.tag-teal  { background: rgba(42,157,143,.12); color: var(--brand-600); }
.tag-navy  { background: rgba(43,54,116,.1);   color: var(--navy-800); }
.tag-amber { background: rgba(245,158,11,.12); color: #92400E; }
[data-theme="dark"] .tag-teal  { color: var(--brand-400); }
[data-theme="dark"] .tag-navy  { color: var(--navy-800); }
[data-theme="dark"] .tag-amber { color: #FCD34D; }

/* ─── Divider ─────────────────────────────────────── */
.wiki-divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ─── Welcome Hero ────────────────────────────────── */
.welcome-hero {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-900) 100%);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  color: #fff;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}
.welcome-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.welcome-hero::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 20%;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.welcome-hero h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}
.welcome-hero p {
  font-size: 0.9rem;
  line-height: 1.65;
  opacity: 0.88;
  max-width: 560px;
  position: relative;
  z-index: 1;
  margin: 0;
}

/* ─── Quick Nav Cards (on Overview) ──────────────── */
.quicknav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.875rem;
}
.quicknav-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background var(--t);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--navy-700);
  font-weight: 500;
  font-size: 0.875rem;
}
.quicknav-card:hover {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(42,157,143,.12);
  color: var(--brand-500);
  text-decoration: none;
}
.quicknav-card i { color: var(--brand-500); font-size: 1.1rem; flex-shrink: 0; }

/* ─── Breadcrumb ──────────────────────────────────── */
.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-bottom: 1.25rem;
}
.breadcrumb-bar span { color: var(--gray-500); }
.breadcrumb-bar i { font-size: 0.65rem; }

/* ─── Search Bar ──────────────────────────────────── */
.header-search-wrap {
  flex: 1;
  max-width: 400px;
  margin: 0 0.75rem;
  position: relative;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 0.75rem;
  height: 38px;
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s, background var(--t);
}
.header-search:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(42,157,143,.13);
}

.search-prefix-icon {
  color: var(--gray-400);
  font-size: 0.85rem;
  flex-shrink: 0;
  pointer-events: none;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--navy-700);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  min-width: 0;
  transition: color var(--t);
}
.search-input::placeholder { color: var(--gray-400); }
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration { display: none; }

.search-kbd {
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--border);
  color: var(--gray-500);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  transition: opacity 0.15s;
  pointer-events: none;
}
/* hide shortcut hint while typing */
.search-input:not(:placeholder-shown) ~ .search-kbd { opacity: 0; }

/* ─── Search Dropdown ─────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 7px);
  left: 0; right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
  z-index: 2000;
  overflow: hidden;
  max-height: 440px;
  overflow-y: auto;
  transition: background var(--t), border-color var(--t);
}
.search-dropdown::-webkit-scrollbar { width: 3px; }
.search-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.search-count {
  font-size: 0.7rem;
  color: var(--gray-400);
  padding: 0.55rem 1rem 0.4rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.02em;
}

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--navy-700);
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover,
.search-result.focused {
  background: rgba(42,157,143,.07);
  outline: none;
}

.sr-icon {
  width: 34px; height: 34px;
  background: rgba(42,157,143,.1);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  color: var(--brand-500);
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.sr-body { flex: 1; min-width: 0; }

.sr-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy-700);
  margin-bottom: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-group {
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-bottom: 0.2rem;
}

.sr-snippet {
  font-size: 0.78rem;
  color: var(--gray-500);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Highlighted search term */
mark.sh {
  background: rgba(42,157,143,.2);
  color: var(--brand-600);
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 700;
}
[data-theme="dark"] mark.sh { color: var(--brand-400); }

.search-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--gray-400);
}
.search-empty i { display: block; font-size: 1.5rem; margin-bottom: 0.5rem; color: var(--border); }

/* Mobile: search fills remaining space, no max-width cap */
@media (max-width: 600px) {
  .header-search-wrap { max-width: none; margin: 0 0.5rem 0 0.35rem; }
  .search-kbd { display: none; }
  .search-dropdown { left: calc(-1 * (100vw - 100%) / 2 - 0.5rem); right: calc(-1 * (100vw - 100%) / 2 - 0.5rem); border-radius: 0 0 14px 14px; }
}
