/* =====================================================
   KHMERSEC DOCUMENTATION PLATFORM
   Inspired by CyLab Academy Primer, GitBook, MDN
   ===================================================== */

/* === THEME TOKENS === */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fb;
  --bg-tertiary: #f0f2f5;
  --bg-code: #f6f8fa;
  --bg-sidebar: #fafbfc;
  --bg-nav: rgba(255,255,255,0.95);
  --bg-card: #ffffff;
  --bg-callout-info: #eff6ff;
  --bg-callout-warn: #fffbeb;
  --bg-callout-danger: #fef2f2;
  --bg-callout-success: #f0fdf4;
  --bg-kbd: #f6f8fa;
  --bg-search: #ffffff;
  --bg-progress: #2563eb;

  --text-primary: #1a1d23;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --text-link: #2563eb;
  --text-heading: #111827;
  --text-code: #d63384;
  --text-nav: #6b7280;
  --text-nav-active: #111827;

  --border-primary: #e5e7eb;
  --border-secondary: #f0f0f0;
  --border-sidebar: #e5e7eb;
  --border-code: #e5e7eb;

  --accent-primary: #2563eb;
  --accent-primary-light: #dbeafe;
  --accent-green: #059669;
  --accent-green-light: #d1fae5;
  --accent-red: #dc2626;
  --accent-red-light: #fee2e2;
  --accent-orange: #d97706;
  --accent-orange-light: #fef3c7;
  --accent-purple: #7c3aed;
  --accent-purple-light: #ede9fe;
  --accent-cyan: #0891b2;
  --accent-pink: #db2777;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.04);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

  --sidebar-width: 280px;
  --nav-height: 56px;
  --toc-width: 220px;
  --content-max-width: 740px;
  --transition: 0.15s ease;
}

[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #161922;
  --bg-tertiary: #1e2130;
  --bg-code: #1a1d2e;
  --bg-sidebar: #13151f;
  --bg-nav: rgba(15,17,23,0.95);
  --bg-card: #161922;
  --bg-callout-info: #0c1929;
  --bg-callout-warn: #1f1908;
  --bg-callout-danger: #1f0c0c;
  --bg-callout-success: #0c1f14;
  --bg-kbd: #1e2130;
  --bg-search: #161922;
  --bg-progress: #60a5fa;

  --text-primary: #e2e5eb;
  --text-secondary: #9ca3b0;
  --text-tertiary: #636a7a;
  --text-link: #60a5fa;
  --text-heading: #f0f2f5;
  --text-code: #f472b6;
  --text-nav: #8b92a3;
  --text-nav-active: #e2e5eb;

  --border-primary: #252838;
  --border-secondary: #1e2130;
  --border-sidebar: #252838;
  --border-code: #252838;

  --accent-primary: #60a5fa;
  --accent-primary-light: rgba(96,165,250,0.12);
  --accent-green: #34d399;
  --accent-green-light: rgba(52,211,153,0.12);
  --accent-red: #f87171;
  --accent-red-light: rgba(248,113,113,0.12);
  --accent-orange: #fbbf24;
  --accent-orange-light: rgba(251,191,36,0.12);
  --accent-purple: #a78bfa;
  --accent-purple-light: rgba(167,139,250,0.12);
  --accent-cyan: #22d3ee;
  --accent-pink: #f472b6;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
}

/* === RESET & BASE === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  scroll-padding-top: calc(var(--nav-height) + 24px);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text-link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-primary); }

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

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* =====================================================
   READING PROGRESS BAR
   ===================================================== */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--bg-progress);
  z-index: 1001;
  transition: width 0.1s linear;
}

/* =====================================================
   TOP NAVIGATION
   ===================================================== */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-primary);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-heading);
  text-decoration: none;
  flex-shrink: 0;
}
.topnav-brand:hover { color: var(--accent-primary); text-decoration: none; }

.topnav-brand .brand-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.topnav-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 400px;
  margin: 0 32px;
}

.search-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  cursor: pointer;
  font-family: var(--font-sans);
}
.search-trigger:hover { border-color: var(--accent-primary); background: var(--bg-primary); }
.search-trigger svg, .search-trigger i { width: 15px; height: 15px; opacity: 0.5; }
.search-trigger .search-shortcut {
  margin-left: auto;
  padding: 2px 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.topnav-link {
  padding: 6px 10px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-nav);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.topnav-link:hover { color: var(--text-nav-active); background: var(--bg-tertiary); text-decoration: none; }

.theme-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-btn:hover { background: var(--bg-tertiary); color: var(--text-heading); }

.mobile-toggle {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* =====================================================
   LAYOUT: SIDEBAR + CONTENT + TOC
   ===================================================== */
.doc-layout {
  display: flex;
  margin-top: var(--nav-height);
  min-height: calc(100vh - var(--nav-height));
}

/* === LEFT SIDEBAR === */
.sidebar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 100;
  transition: transform 0.2s ease;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 2px; }

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
}
.sidebar-section-title:hover { color: var(--text-secondary); }
.sidebar-section-title .chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}
.sidebar-section.collapsed .chevron { transform: rotate(-90deg); }
.sidebar-section.collapsed .sidebar-links { display: none; }

.sidebar-links {
  list-style: none;
  padding: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 20px 5px 24px;
  font-size: 0.8125rem;
  font-weight: 450;
  color: var(--text-nav);
  text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.5;
}
.sidebar-link:hover { color: var(--text-nav-active); background: var(--bg-tertiary); text-decoration: none; }
.sidebar-link.active {
  color: var(--accent-primary);
  background: var(--accent-primary-light);
  border-left-color: var(--accent-primary);
  font-weight: 550;
}
.sidebar-link .link-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.6;
}
.sidebar-link.active .link-icon { opacity: 1; }

.sidebar-divider {
  height: 1px;
  background: var(--border-primary);
  margin: 8px 20px;
}

/* === MAIN CONTENT === */
.doc-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  padding: 32px 48px 80px;
  max-width: calc(var(--content-max-width) + 96px + var(--toc-width));
}

/* === RIGHT TOC (Table of Contents) === */
.doc-toc {
  position: fixed;
  top: var(--nav-height);
  right: 0;
  bottom: 0;
  width: var(--toc-width);
  padding: 24px 16px;
  overflow-y: auto;
  border-left: 1px solid var(--border-secondary);
}

.doc-toc::-webkit-scrollbar { width: 3px; }
.doc-toc::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 2px; }

.toc-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  padding: 0;
}

.toc-link {
  display: block;
  padding: 3px 0;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-decoration: none;
  line-height: 1.5;
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -1px;
}
.toc-link:hover { color: var(--text-secondary); text-decoration: none; }
.toc-link.active { color: var(--accent-primary); border-left-color: var(--accent-primary); }
.toc-link.toc-h3 { padding-left: 20px; }

/* =====================================================
   CONTENT TYPOGRAPHY
   ===================================================== */
.doc-content {
  max-width: var(--content-max-width);
}

.doc-content > *:first-child { margin-top: 0; }

.doc-content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.25;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.doc-content h2 {
  font-size: 1.375rem;
  font-weight: 650;
  color: var(--text-heading);
  line-height: 1.35;
  margin-top: 40px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-secondary);
  letter-spacing: -0.01em;
}

.doc-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.4;
  margin-top: 32px;
  margin-bottom: 8px;
}

.doc-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-top: 24px;
  margin-bottom: 6px;
}

.doc-content p {
  margin-bottom: 14px;
  font-size: 0.9375rem;
  line-height: 1.75;
}

.doc-content > ul, .doc-content > ol {
  margin-bottom: 14px;
  padding-left: 24px;
}

.doc-content li {
  margin-bottom: 4px;
  font-size: 0.9375rem;
  line-height: 1.7;
}

.doc-content strong { color: var(--text-heading); font-weight: 600; }
.doc-content em { font-style: italic; }

.doc-content hr {
  border: none;
  height: 1px;
  background: var(--border-primary);
  margin: 28px 0;
}

/* === BREADCRUMBS === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-tertiary); }
.breadcrumb a:hover { color: var(--accent-primary); }
.breadcrumb .sep,
.breadcrumb .breadcrumb-sep { font-size: 0.75rem; opacity: 0.5; }
.breadcrumb .breadcrumb-current { color: var(--text-secondary); }

/* === PAGE TITLE AREA === */
.page-title-area {
  margin-bottom: 24px;
}
.page-title-area h1 {
  margin: 0 0 8px 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.3;
}
.doc-description {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* === INLINE CODE === */
.doc-content code:not(pre code) {
  padding: 2px 5px;
  background: var(--bg-code);
  border: 1px solid var(--border-code);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8125em;
  color: var(--text-code);
  font-weight: 500;
}

/* === CODE BLOCKS === */
.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border-code);
  border-radius: var(--radius-md);
  margin: 16px 0;
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-code);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.code-block-header .lang-badge {
  padding: 1px 8px;
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
}

.copy-btn {
  padding: 2px 8px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  cursor: pointer;
  font-family: var(--font-sans);
}
.copy-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

.code-block pre {
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--text-heading);
}

.code-block code {
  font-family: inherit;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 400;
}

/* === BLOCKQUOTES === */
.doc-content blockquote {
  margin: 16px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--accent-primary);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
.doc-content blockquote p:last-child { margin-bottom: 0; }
.doc-content blockquote strong { color: var(--accent-primary); }

/* === CALLOUT BOXES === */
.callout {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  border: 1px solid;
  font-size: 0.875rem;
  line-height: 1.6;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.875rem;
}

.callout-title svg, .callout-title i { width: 15px; height: 15px; }

.callout-info { background: var(--bg-callout-info); border-color: var(--accent-primary); }
.callout-info .callout-title { color: var(--accent-primary); }

.callout-warning { background: var(--bg-callout-warn); border-color: var(--accent-orange); }
.callout-warning .callout-title { color: var(--accent-orange); }

.callout-danger { background: var(--bg-callout-danger); border-color: var(--accent-red); }
.callout-danger .callout-title { color: var(--accent-red); }

.callout-success { background: var(--bg-callout-success); border-color: var(--accent-green); }
.callout-success .callout-title { color: var(--accent-green); }

.callout p { margin-bottom: 6px; font-size: 0.875rem; }
.callout p:last-child { margin-bottom: 0; }
.callout code { font-size: 0.8125em; }

/* === TABLES === */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.875rem;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.doc-content thead {
  background: var(--bg-secondary);
}

.doc-content th {
  padding: 8px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-heading);
  border-bottom: 1px solid var(--border-primary);
  font-size: 0.8125rem;
}

.doc-content td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-secondary);
  color: var(--text-secondary);
}

.doc-content tbody tr:last-child td { border-bottom: none; }
.doc-content tbody tr:hover { background: var(--bg-secondary); }

/* === PREV/NEXT NAVIGATION === */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-primary);
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  text-decoration: none;
}
.page-nav-link:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.page-nav-link .nav-direction {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.page-nav-link .nav-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.page-nav-prev {
  text-align: left;
}

.page-nav-next {
  text-align: right;
  justify-content: flex-end;
}

/* =====================================================
   SEARCH MODAL
   ===================================================== */
.search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  padding: 80px 24px;
  justify-content: center;
}
.search-modal.open { display: flex; }

.search-modal-inner {
  width: 100%;
  max-width: 520px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 440px;
  display: flex;
  flex-direction: column;
}

.search-modal-input {
  width: 100%;
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  outline: none;
}

.search-modal-input::placeholder { color: var(--text-tertiary); }

.search-results {
  overflow-y: auto;
  padding: 6px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
.search-result-item:hover { background: var(--bg-secondary); text-decoration: none; }
.search-result-item .result-icon { color: var(--text-tertiary); width: 15px; height: 15px; flex-shrink: 0; }
.search-result-item .result-title { font-size: 0.875rem; font-weight: 550; color: var(--text-heading); }
.search-result-item .result-section { font-size: 0.75rem; color: var(--text-tertiary); }

.search-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* === SIDEBAR OVERLAY (mobile) === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1280px) {
  .doc-toc { display: none; }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .doc-main {
    margin-left: 0;
    padding: 28px 24px 64px;
  }
  .mobile-toggle { display: flex; }
  .topnav-center { display: none; }
}

@media (max-width: 768px) {
  .page-nav { grid-template-columns: 1fr; }
  .doc-content h1 { font-size: 1.625rem; }
  .doc-content h2 { font-size: 1.25rem; }
  .topnav-link { display: none; }
}

@media (max-width: 480px) {
  .doc-main { padding: 20px 16px 48px; }
}

/* =====================================================
   UTILITIES
   ===================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* =====================================================
   TOOLS PAGE
   ===================================================== */
.search-container {
  position: relative;
  margin-bottom: 16px;
}

.search-container .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-sans);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--bg-primary);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 24px;
}

.filter-btn {
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
}

.filter-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.filter-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color var(--transition);
}

.tool-card:hover {
  border-color: var(--accent-primary);
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.tool-card-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-primary-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.tool-card-icon i, .tool-card-icon svg {
  width: 18px;
  height: 18px;
}

.tool-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
}

.tool-card p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.tag-blue {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
}

.tag-purple {
  background: var(--accent-purple-light);
  color: var(--accent-purple);
}

.tag-red {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

.tag-orange {
  background: var(--accent-orange-light);
  color: var(--accent-orange);
}

.tag-green {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.tool-hidden {
  display: none;
}

@media (max-width: 768px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }
  .filter-btn {
    white-space: nowrap;
  }
}
