/* ==========================================================================
   OKdevTV Markdown Documentation Stylesheet (omd)
   ========================================================================== */

@import url('/asset?u=https%3A%2F%2Ffonts.googleapis.com%2Fcss2%3Ffamily%3DInter%3Awght%40300%3B400%3B500%3B600%3B700%26family%3DJetBrains%2BMono%3Awght%40400%3B500%3B600%26display%3Dswap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;
  
  --header-height: 64px;
  --sidebar-width: 290px;
  --toc-width: 250px;
  --content-max-width: 860px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  /* Dark Theme (Default) */
  --bg-primary: #0b0f17;
  --bg-secondary: #111827;
  --bg-surface: #162032;
  --bg-surface-hover: #1e293b;
  --bg-header: rgba(11, 15, 23, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.16);
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #38bdf8;
  --accent-secondary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  --accent-glow: rgba(56, 189, 248, 0.15);
  
  --code-bg: #090d16;
  --code-header-bg: #131b2e;
  --code-inline-bg: rgba(56, 189, 248, 0.1);
  --code-inline-color: #7dd3fc;
  
  --table-border: #1e293b;
  --table-stripe: rgba(255, 255, 255, 0.02);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 28px 0 rgba(0, 0, 0, 0.6);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-header: rgba(255, 255, 255, 0.85);
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-primary: #0284c7;
  --accent-secondary: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #6366f1 100%);
  --accent-glow: rgba(2, 132, 199, 0.12);
  
  --code-bg: #f8fafc;
  --code-header-bg: #e2e8f0;
  --code-inline-bg: rgba(2, 132, 199, 0.08);
  --code-inline-color: #0369a1;
  
  --table-border: #e2e8f0;
  --table-stripe: #f8fafc;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 28px 0 rgba(0, 0, 0, 0.12);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.menu-toggle-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-decoration: none !important;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--accent-gradient);
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-center {
  flex: 1;
  max-width: 480px;
  margin: 0 1.5rem;
}

.search-trigger-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-trigger-btn:hover {
  border-color: var(--border-color-hover);
  color: var(--text-secondary);
  background: var(--bg-surface-hover);
}

.search-trigger-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kbd-shortcut {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.header-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
  text-decoration: none;
}

/* ==========================================================================
   Main App Layout
   ========================================================================== */

.app-container {
  display: flex;
  flex: 1;
  width: 100%;
  position: relative;
}

/* Left Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.sidebar-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.sidebar-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.sidebar-filter-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.sidebar-filter-input:focus {
  border-color: var(--accent-primary);
}

.sidebar-nav {
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-category {
  margin-bottom: 0.35rem;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.4rem 0.6rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.category-header:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.category-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.category-chevron {
  transition: transform 0.2s ease;
}

.nav-category.collapsed .category-chevron {
  transform: rotate(-90deg);
}

.category-count {
  font-size: 0.7rem;
  background: var(--bg-surface);
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  color: var(--text-muted);
}

.category-docs {
  list-style: none;
  padding-left: 0.75rem;
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nav-category.collapsed .category-docs {
  display: none;
}

.doc-link {
  display: block;
  padding: 0.35rem 0.6rem;
  font-size: 0.825rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s;
  text-decoration: none !important;
}

.doc-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.doc-link.active {
  color: var(--accent-primary);
  background: var(--accent-glow);
  font-weight: 500;
}

/* Main Content Area */
.app-main {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3rem 5rem 3rem;
  display: flex;
  justify-content: center;
}

.content-wrapper {
  width: 100%;
  max-width: var(--content-max-width);
}

/* Right TOC */
.app-toc {
  width: var(--toc-width);
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  padding: 2.5rem 1.25rem 2rem 0.5rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.toc-item.level-2 {
  font-size: 0.825rem;
}

.toc-item.level-3 {
  font-size: 0.785rem;
  padding-left: 0.75rem;
}

.toc-link {
  color: var(--text-secondary);
  display: block;
  padding: 0.2rem 0;
  line-height: 1.4;
  transition: color 0.15s;
  text-decoration: none !important;
}

.toc-link:hover,
.toc-link.active {
  color: var(--accent-primary);
}

/* ==========================================================================
   Markdown Document Elements
   ========================================================================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-primary);
}

.doc-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
}

.markdown-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.markdown-body h1 {
  font-size: 2.15rem;
  margin: 1.5rem 0 1.25rem;
  line-height: 1.25;
}

.markdown-body h2 {
  font-size: 1.55rem;
  margin: 2.25rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.markdown-body h3 {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.75rem;
}

.markdown-body h4 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
}

.header-anchor {
  color: inherit;
  text-decoration: none !important;
}

.header-anchor:hover::after {
  content: ' #';
  color: var(--accent-primary);
  font-weight: normal;
  opacity: 0.7;
}

.markdown-body p {
  margin-bottom: 1.25rem;
}

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.75rem;
}

.markdown-body li {
  margin-bottom: 0.4rem;
}

.markdown-body li > ul,
.markdown-body li > ol {
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

.markdown-body hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 2.5rem 0;
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent-primary);
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.markdown-body blockquote p:last-child {
  margin-bottom: 0;
}

/* Code Blocks */
.markdown-body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-inline-bg);
  color: var(--code-inline-color);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.code-block-wrapper {
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
}

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

.copy-code-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.copy-code-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.copy-code-btn.copied {
  color: #10b981;
}

.code-block-wrapper pre {
  margin: 0;
  padding: 0;
}

/* Mobile TOC dropdown */
.mobile-toc-dropdown {
  display: none;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.mobile-toc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.mobile-toc-summary::-webkit-details-marker {
  display: none;
}

.mobile-toc-summary-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-toc-chevron {
  transition: transform 0.2s ease;
}

.mobile-toc-dropdown[open] .mobile-toc-chevron {
  transform: rotate(180deg);
}

.mobile-toc-list {
  list-style: none;
  padding: 0.5rem 0.95rem 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 260px;
  overflow-y: auto;
}

.mobile-toc-item.level-2 a {
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.mobile-toc-item.level-3 a {
  font-size: 0.785rem;
  padding-left: 0.75rem;
  color: var(--text-muted);
}

.mobile-toc-item a:hover {
  color: var(--accent-primary);
}

/* Tables */
.markdown-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  border: 1px solid var(--table-border);
  border-radius: var(--radius-sm);
}

.markdown-body th {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--table-border);
}

.markdown-body td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-secondary);
}

.markdown-body tr:nth-child(even) {
  background: var(--table-stripe);
}

/* Images */
.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin: 1.25rem 0;
  box-shadow: var(--shadow-md);
  display: block;
}

/* Task lists */
.contains-task-list {
  list-style: none;
  padding-left: 0.5rem;
}

.task-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-list-item-checkbox {
  accent-color: var(--accent-primary);
  width: 1rem;
  height: 1rem;
}

/* Adjacent Pagination */
.doc-pagination {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.pagination-card {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all 0.2s ease;
  text-decoration: none !important;
}

.pagination-card:hover {
  border-color: var(--accent-primary);
  background: var(--bg-surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.pagination-card.next {
  text-align: right;
  grid-column: 2;
}

.pagination-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pagination-title {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* ==========================================================================
   Home / Index Page Styles
   ========================================================================== */

.hero-section {
  text-align: center;
  padding: 3rem 1rem 3.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--accent-glow);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 2.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 2rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Section grids */
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.5rem 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.feature-card {
  padding: 1.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.feature-card:hover {
  border-color: var(--accent-primary);
  background: var(--bg-surface-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-cat-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-badge {
  font-size: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  color: var(--accent-primary);
}

.card-preview-list {
  font-size: 0.825rem;
  color: var(--text-muted);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* All Categories List */
.all-cats-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.cat-pill {
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all 0.15s;
  text-decoration: none !important;
}

.cat-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

/* ==========================================================================
   Search Modal
   ========================================================================== */

.search-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 2rem;
}

.search-modal-backdrop.open {
  display: flex;
}

.search-modal {
  width: 100%;
  max-width: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalEnter 0.2s ease;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.search-modal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.05rem;
  outline: none;
}

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

.search-results-list {
  max-height: 400px;
  overflow-y: auto;
  list-style: none;
  padding: 0.5rem;
}

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none !important;
  transition: all 0.15s;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-surface-hover);
}

.search-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.search-item-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.search-item-cat {
  font-size: 0.725rem;
  background: var(--bg-surface);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: var(--accent-primary);
}

.search-item-path {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.search-footer {
  padding: 0.6rem 1.25rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

/* Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.75rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* ==========================================================================
   Responsive Breakpoints & Mobile Optimization
   ========================================================================== */

/* Tablet & Smaller Laptops */
@media (max-width: 1200px) {
  .app-toc {
    display: none;
  }
  .mobile-toc-dropdown {
    display: block;
  }
  .app-main {
    padding: 2rem 2rem 4rem;
  }
}

/* Tablet & Mobile Screens */
@media (max-width: 860px) {
  .menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: min(320px, 85vw);
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-height);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 140;
  }

  .sidebar-backdrop.open {
    display: block;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .app-main {
    padding: 1.5rem 1.25rem 3.5rem;
  }

  .content-wrapper {
    max-width: 100%;
  }

  .hero-title {
    font-size: 2.15rem;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .doc-pagination {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 2.5rem;
  }

  .pagination-card.next {
    grid-column: 1;
    text-align: left;
  }
}

/* Small Screens & Mobile Phones */
@media (max-width: 640px) {
  :root {
    --header-height: 56px;
  }

  .app-header {
    padding: 0 max(0.75rem, env(safe-area-inset-right)) 0 max(0.75rem, env(safe-area-inset-left));
  }

  .brand-logo {
    width: 26px;
    height: 26px;
  }

  .brand-link {
    font-size: 1.05rem;
    gap: 0.45rem;
  }

  .brand-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
  }

  .header-center {
    margin: 0 0.45rem;
    max-width: none;
  }

  .search-trigger-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.785rem;
    border-radius: var(--radius-sm);
  }

  .search-trigger-left {
    gap: 0.35rem;
  }

  .kbd-shortcut {
    display: none;
  }

  /* Make header right buttons compact icon-only buttons on mobile */
  .header-btn span {
    display: none;
  }

  .header-btn {
    padding: 0.45rem;
    border-radius: var(--radius-sm);
  }

  .header-right {
    gap: 0.35rem;
  }

  /* Main content padding on mobile */
  .app-main {
    padding: 1.25rem 0.85rem 3rem;
  }

  /* Breadcrumb & Metadata */
  .breadcrumb {
    font-size: 0.75rem;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
  }

  .doc-meta {
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    font-size: 0.75rem;
  }

  .meta-badge {
    font-size: 0.72rem;
    padding: 0.15rem 0.45rem;
  }

  /* Markdown Typography on Mobile */
  .markdown-body {
    font-size: 0.95rem;
    line-height: 1.7;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .markdown-body h1 {
    font-size: 1.65rem;
    margin: 1.25rem 0 0.85rem;
    line-height: 1.25;
  }

  .markdown-body h2 {
    font-size: 1.35rem;
    margin: 1.75rem 0 0.75rem;
  }

  .markdown-body h3 {
    font-size: 1.12rem;
    margin: 1.35rem 0 0.5rem;
  }

  .markdown-body h4 {
    font-size: 1rem;
    margin: 1.15rem 0 0.4rem;
  }

  .markdown-body ul,
  .markdown-body ol {
    padding-left: 1.35rem;
    margin-bottom: 1rem;
  }

  .markdown-body blockquote {
    padding: 0.65rem 0.95rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }

  .markdown-body :not(pre) > code {
    word-break: break-all;
    font-size: 0.82em;
  }

  /* Code Blocks on Mobile */
  .code-block-wrapper {
    margin-bottom: 1.25rem;
    border-radius: var(--radius-sm);
  }

  .code-block-header {
    padding: 0.35rem 0.65rem;
    font-size: 0.7rem;
  }

  pre code.hljs {
    padding: 0.9rem 0.75rem;
    font-size: 0.82rem;
    line-height: 1.5;
  }

  /* Tables on Mobile */
  .markdown-body table {
    font-size: 0.825rem;
    margin-bottom: 1.25rem;
  }

  .markdown-body th,
  .markdown-body td {
    padding: 0.55rem 0.75rem;
  }

  /* Home Page on Mobile */
  .hero-section {
    padding: 1.75rem 0.25rem 2rem;
  }

  .hero-badge {
    font-size: 0.72rem;
    padding: 0.25rem 0.65rem;
    margin-bottom: 0.85rem;
  }

  .hero-title {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
  }

  .hero-desc {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
  }

  .hero-stats {
    gap: 1rem;
    margin-top: 1.25rem;
  }

  .stat-num {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.68rem;
  }

  .section-title {
    font-size: 1.15rem;
    margin: 1.75rem 0 0.85rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .all-cats-container {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.45rem;
  }

  .cat-pill {
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
  }

  /* Search Modal on Mobile */
  .search-modal-backdrop {
    padding: 0.75rem;
    align-items: flex-start;
  }

  .search-modal {
    border-radius: var(--radius-md);
    max-height: calc(100vh - 1.5rem);
  }

  .search-input-wrapper {
    padding: 0.75rem 0.95rem;
    gap: 0.5rem;
  }

  .search-modal-input {
    font-size: 0.95rem;
  }

  .search-item-title {
    font-size: 0.9rem;
  }

  .search-item-path {
    font-size: 0.7rem;
  }

  .search-footer {
    display: none;
  }

  /* Footer on Mobile */
  .app-footer {
    padding: 1.25rem 1rem max(1.25rem, env(safe-area-inset-bottom));
    font-size: 0.785rem;
  }
}

/* Extra Narrow Devices (e.g. Galaxy Fold, iPhone SE 320-380px) */
@media (max-width: 400px) {
  .brand-badge {
    display: none;
  }

  .brand-link span {
    font-size: 0.95rem;
  }

  .search-trigger-btn span {
    display: none;
  }

  .search-trigger-left {
    justify-content: center;
    width: 100%;
  }

  .hero-stats {
    gap: 0.75rem;
  }

  .stat-num {
    font-size: 1.35rem;
  }

  .all-cats-container {
    grid-template-columns: 1fr;
  }
}
