/* SupGuide adaptations on top of SupDocD docs.css */

:root {
  --sidebar-topcat-height: 50px;
}

/* 文档阅读工具栏：与标题区衔接 */
.docs-article-detail > .article-header,
.docs-article-header {
  margin-bottom: 0.75rem;
  padding-bottom: 0;
  border-bottom: none;
}

.docs-article-detail .article-title {
  margin-bottom: 0.75rem;
}

.docs-article-detail .article-description {
  margin-bottom: 0.75rem;
}

@media print {
  .docs-top-nav,
  .docs-sidebar,
  .docs-toc,
  .toc-minimized-btn,
  .doc-share-bar,
  .doc-reading-tools,
  .article-stat-actions,
  .scroll-progress,
  .scroll-to-top,
  .search-modal-overlay {
    display: none !important;
  }

  .docs-layout,
  .docs-main,
  .docs-content {
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}

/* ---- Frontend admin user menu (top-right) ---- */
.docs-user-dropdown {
  position: relative;
}

.docs-user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--docs-border-primary, #e5e7eb);
  border-radius: 8px;
  background: var(--docs-bg-primary, #fff);
  color: var(--docs-text-secondary, #475569);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.docs-user-menu-toggle:hover,
.docs-user-menu-toggle:focus,
.docs-user-menu-toggle.show {
  background: var(--docs-bg-secondary, #f8fafc);
  border-color: #93c5fd;
  color: var(--docs-primary, #2563eb);
  outline: none;
  box-shadow: none;
}

.docs-user-menu-toggle::after {
  margin-left: 0.15rem;
}

.docs-user-menu-toggle i {
  font-size: 1.15rem;
  line-height: 1;
}

/* 用户名掩码：默认首尾，hover / focus / 展开时显示全文（对齐后台） */
.docs-username-display {
  display: inline-block;
  min-width: 0;
  max-width: 7.5rem;
  vertical-align: middle;
  font-weight: 500;
}

.docs-username-masked,
.docs-username-full {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.docs-username-full {
  display: none;
}

.docs-user-menu-toggle:hover .docs-username-masked,
.docs-user-menu-toggle:focus .docs-username-masked,
.docs-user-menu-toggle.show .docs-username-masked {
  display: none;
}

.docs-user-menu-toggle:hover .docs-username-full,
.docs-user-menu-toggle:focus .docs-username-full,
.docs-user-menu-toggle.show .docs-username-full {
  display: inline-block;
}

.docs-user-menu {
  --bs-dropdown-min-width: 12rem;
  min-width: 12rem;
  padding: 0.35rem 0;
  margin-top: 0.4rem !important;
  border: 1px solid var(--docs-border-primary, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.docs-user-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
}

.docs-user-menu .dropdown-item i {
  font-size: 1rem;
  width: 1.1rem;
  text-align: center;
}

.docs-user-menu .dropdown-item:hover {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
}

.docs-user-menu .dropdown-item.text-danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}

#docsLogoutModal .modal-content {
  border-radius: 12px;
  border: 1px solid var(--docs-border-primary, #e5e7eb);
}

#docsLogoutModal .modal-header,
#docsLogoutModal .modal-footer {
  border-color: var(--docs-border-primary, #e5e7eb);
}

@media (max-width: 576px) {
  .docs-username-display {
    display: none;
  }
  .docs-user-menu-toggle {
    padding: 0.45rem 0.55rem;
  }
}

[data-theme="dark"] .docs-user-menu-toggle {
  background: var(--docs-bg-primary, #1e293b);
  border-color: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

[data-theme="dark"] .docs-user-menu-toggle:hover,
[data-theme="dark"] .docs-user-menu-toggle.show {
  border-color: rgba(148, 163, 184, 0.28);
  color: #93c5fd;
  background: #334155;
}

[data-theme="dark"] .docs-user-menu {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.14);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .docs-user-menu .dropdown-item {
  color: #e2e8f0;
}

/* ---- Breadcrumb (avoid Bootstrap .breadcrumb-item default blue links) ---- */
.docs-breadcrumb {
  margin-bottom: 1rem;
  padding: 0.35rem 0 0.85rem;
  border-bottom: 1px solid var(--docs-border-primary, #e5e7eb);
  font-size: 0.8125rem;
  color: var(--docs-text-muted, #64748b);
}

.docs-breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  color: var(--docs-text-muted, #64748b);
}

.docs-breadcrumb-item:not(:last-child)::after {
  content: '/';
  margin-left: 0.4rem;
  margin-right: 0.15rem;
  color: var(--docs-text-light, #94a3b8);
  opacity: 0.85;
  font-weight: 400;
  pointer-events: none;
}

.docs-breadcrumb-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  color: var(--docs-text-secondary, #475569);
  text-decoration: none;
  border-radius: 4px;
  padding: 0.1rem 0.2rem;
  margin: -0.1rem -0.2rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.docs-breadcrumb-link span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.docs-breadcrumb-link:hover,
.docs-breadcrumb-link:focus {
  color: var(--docs-primary, #2563eb);
  text-decoration: none;
  background: rgba(37, 99, 235, 0.06);
}

.docs-breadcrumb-home-icon {
  font-size: 0.95rem;
  line-height: 1;
  color: var(--docs-text-muted, #64748b);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.docs-breadcrumb-link--home:hover .docs-breadcrumb-home-icon,
.docs-breadcrumb-link:hover .docs-breadcrumb-home-icon {
  color: var(--docs-primary, #2563eb);
}

.docs-breadcrumb-current {
  display: inline-block;
  min-width: 0;
  max-width: 280px;
  padding: 0.1rem 0.15rem;
  color: var(--docs-text-primary, #0f172a);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.docs-breadcrumb-item.is-current {
  color: var(--docs-text-primary, #0f172a);
}

/* Legacy breadcrumb-nav: tame Bootstrap .breadcrumb-item a */
.breadcrumb-nav .breadcrumb-item + .breadcrumb-item::before {
  color: var(--docs-text-light, #94a3b8);
  opacity: 0.85;
}

.breadcrumb-nav .breadcrumb-item a,
.breadcrumb-nav .breadcrumb-link {
  color: var(--docs-text-secondary, #475569);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb-nav .breadcrumb-item a:hover,
.breadcrumb-nav .breadcrumb-link:hover {
  color: var(--docs-primary, #2563eb);
  text-decoration: none;
}

.breadcrumb-nav .breadcrumb-item.active {
  color: var(--docs-text-primary, #0f172a);
  font-weight: 550;
}

/* ---- In-doc / footer / content links ---- */
.article-body a,
.article-content .article-body a {
  color: var(--docs-link, #2563eb);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.article-body a:hover,
.article-content .article-body a:hover {
  color: var(--docs-link-hover, #1d4ed8);
  border-bottom-color: currentColor;
  text-decoration: none;
}

.docs-breadcrumb a,
.docs-breadcrumb a:hover {
  border-bottom: none;
}

.docs-footer a.footer-link,
.footer-content a {
  color: var(--docs-text-secondary, #475569);
  text-decoration: none;
  transition: color 0.15s ease;
}

.docs-footer a.footer-link:hover,
.footer-content a:hover {
  color: var(--docs-primary, #2563eb);
  text-decoration: none;
}

[data-theme="dark"] .docs-breadcrumb-link:hover,
[data-theme="dark"] .docs-breadcrumb-link:focus {
  background: rgba(147, 197, 253, 0.08);
}

[data-theme="dark"] .docs-breadcrumb-current {
  color: var(--docs-text-primary, #e2e8f0);
}

@media (max-width: 768px) {
  .docs-breadcrumb-link span {
    max-width: 120px;
  }
  .docs-breadcrumb-current {
    max-width: 160px;
  }
}

.article-body { line-height: 1.75; color: var(--docs-text-primary); }
.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--docs-text-primary);
}
.article-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--docs-border-primary);
  border-radius: 6px;
  margin: 0.75rem 0;
}

/* 文档区：优先避免横向滚动条（短代码不出现假滚动条） */
.docs-main,
.docs-content,
.article-content,
.article-content-rendered,
.article-body {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.article-body .table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--docs-border-primary, var(--docs-border-secondary));
  border-radius: 0.5rem;
}
.article-body table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 0;
}
.article-body th,
.article-body td {
  border: 1px solid var(--docs-border-primary, var(--docs-border-secondary));
  padding: 0.5rem 0.75rem;
}
.article-body blockquote {
  border-left: 4px solid var(--docs-primary);
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  color: var(--docs-text-secondary);
  background: var(--docs-bg-secondary);
}

.article-body code,
.article-content code {
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.92em;
}
.article-body :not(pre) > code,
.article-content :not(pre) > code {
  background: var(--docs-code-bg);
  color: var(--docs-code-text);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  word-break: break-word;
}

/* 覆盖 docs.css 中 min-width:100% + content-box 导致的多余横向滚动条 */
.article-body pre,
.article-content pre,
.docs-layout .article-content pre,
.docs-layout.no-toc .article-content pre {
  background: var(--docs-bg-code-block);
  border: 1px solid var(--docs-border-primary);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  max-width: 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

.article-body pre code,
.article-content pre code,
.docs-layout .article-content pre code,
.docs-layout.no-toc .article-content pre code,
.article-body pre.sg-source code {
  display: block;
  background: none;
  padding: 0;
  margin: 0;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.article-content pre code *,
.article-body pre code * {
  max-width: 100% !important;
  white-space: inherit !important;
  word-break: inherit !important;
  overflow-wrap: inherit !important;
}

.article-body pre.sg-source {
  max-height: none;
  font-size: 0.9rem;
  line-height: 1.55;
  padding-top: 1rem; /* 源码视图无需为复制按钮预留空白 */
}

.code-block-wrapper,
.docs-layout.no-toc .code-block-wrapper {
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

/* 仅在真正溢出时出现细滚动条；无溢出时不占位 */
.article-body pre,
.article-content pre {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.article-body pre:hover,
.article-content pre:hover {
  scrollbar-color: rgba(100, 116, 139, 0.55) transparent;
}
.article-body pre::-webkit-scrollbar,
.article-content pre::-webkit-scrollbar {
  height: 6px;
}
.article-body pre::-webkit-scrollbar-thumb,
.article-content pre::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}
.article-body pre:hover::-webkit-scrollbar-thumb,
.article-content pre:hover::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.55);
}

/* TOC — 对齐 SupDoc 排版 */
.docs-toc {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}
.docs-toc .toc-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.85rem 0.75rem 0.65rem;
  margin: 0;
  background: var(--docs-bg-body);
  border-bottom: 1px solid var(--docs-border-primary);
}
.docs-toc .toc-title {
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--docs-text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.docs-toc .toc-title i {
  color: var(--docs-text-muted);
  font-size: 1rem;
}
.docs-toc .toc-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0 1rem;
}
.docs-toc .toc-list {
  padding: 0 0.35rem 0 0;
}
.docs-toc .toc-item {
  margin: 0;
}
.docs-toc .toc-link {
  display: block;
  padding: 0.4rem 0.65rem;
  margin: 0.1rem 0.35rem;
  color: var(--docs-text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  line-height: 1.45;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.docs-toc .toc-link:hover {
  color: var(--docs-primary);
  background: var(--docs-bg-secondary);
  border-left-color: var(--docs-primary);
}
.docs-toc .toc-link.active {
  color: var(--docs-primary);
  background: var(--docs-primary-light);
  border-left-color: var(--docs-primary);
  font-weight: 600;
}
.docs-toc .toc-level-2 .toc-link { padding-left: 0.65rem; }
.docs-toc .toc-level-3 .toc-link { padding-left: 1.25rem; font-size: 0.78rem; }
.docs-toc .toc-level-4 .toc-link { padding-left: 1.75rem; }
.toc-empty {
  list-style: none;
  padding: 0.85rem 1rem;
  font-size: 0.8125rem;
  color: var(--docs-text-muted);
}
.search-result-item {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--docs-border-primary);
  cursor: pointer;
}
.search-result-item:hover,
.search-result-item.active { background: var(--docs-bg-highlight); }
.search-result-title { font-weight: 600; color: var(--docs-text-primary); }
.search-result-path { font-size: 0.8rem; color: var(--docs-text-muted); margin-top: 0.15rem; }
.search-result-desc { font-size: 0.875rem; color: var(--docs-text-secondary); margin-top: 0.25rem; }
.search-loading, .search-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--docs-text-muted);
}
.docs-layout.no-toc .docs-main { max-width: none; }

/* ---- Home directory grid (SupDoc-inspired, gray/white) ---- */
.sg-home-hero .article-description {
  max-width: 40rem;
  color: var(--docs-text-secondary);
  font-size: 1.05rem;
  line-height: 1.65;
}

.sg-home-dirs {
  margin-top: 1.75rem;
}

.sg-home-dirs-head {
  margin-bottom: 1rem;
}

.sg-home-dirs-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--docs-text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: -0.01em;
}

.sg-home-dirs-title i {
  color: var(--docs-text-muted);
  font-size: 1.15rem;
}

.sg-dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.sg-dir-card,
.article-content a.sg-dir-card,
.article-content a.sg-dir-card:hover,
.article-content a.sg-dir-card:focus,
.article-body a.sg-dir-card,
.article-body a.sg-dir-card:hover {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--docs-border-primary, #e5e7eb);
  border-radius: 12px;
  background: var(--docs-bg-primary, #fff);
  color: inherit;
  text-decoration: none !important;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.2s ease,
    box-shadow 0.22s ease,
    transform 0.2s ease,
    background-color 0.2s ease;
  min-height: 148px;
  outline: none;
}

.sg-dir-card *,
.sg-dir-card:hover *,
.article-content a.sg-dir-card:hover * {
  text-decoration: none !important;
}

.sg-dir-card:hover,
.article-content a.sg-dir-card:hover,
.article-content a.sg-dir-card:focus-visible,
.article-body a.sg-dir-card:hover {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow:
    0 12px 28px rgba(37, 99, 235, 0.12),
    0 2px 8px rgba(15, 23, 42, 0.06);
  transform: translateY(-3px);
  color: inherit;
  text-decoration: none !important;
}

.sg-dir-card:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
}

.sg-dir-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(59, 130, 246, 0.16) 100%);
  color: #2563eb;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sg-dir-card:hover .sg-dir-card-icon {
  transform: scale(1.06);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16) 0%, rgba(59, 130, 246, 0.28) 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
}

.sg-dir-card-icon i {
  font-size: 1.35rem;
}

.sg-dir-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  flex: 1;
}

.sg-dir-card-title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--docs-text-primary, #0f172a);
  text-decoration: none !important;
  transition: color 0.18s ease;
}

.sg-dir-card:hover .sg-dir-card-title {
  color: #1d4ed8;
}

.sg-dir-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--docs-text-muted, #64748b);
  text-decoration: none !important;
}

.sg-dir-card-meta code {
  font-size: 0.78em;
  background: var(--docs-bg-secondary, #f1f5f9);
  padding: 0.15em 0.45em;
  border-radius: 6px;
  color: var(--docs-text-secondary, #475569);
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sg-dir-card:hover .sg-dir-card-meta code {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(147, 197, 253, 0.7);
  color: #1e40af;
}

.sg-dir-card-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #2563eb;
  margin-top: auto;
  text-decoration: none !important;
  transition: gap 0.18s ease, color 0.18s ease;
}

.sg-dir-card:hover .sg-dir-card-action {
  color: #1d4ed8;
  gap: 0.45rem;
}

.sg-dir-card-action i {
  transition: transform 0.18s ease;
}

.sg-dir-card:hover .sg-dir-card-action i {
  transform: translateX(3px);
}

.sg-home-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1.25rem;
  border: 1px dashed var(--docs-border-primary);
  border-radius: 12px;
  color: var(--docs-text-muted);
  background: var(--docs-bg-secondary, #f8fafc);
}

.sg-home-empty i {
  font-size: 2.25rem;
  opacity: 0.4;
  display: block;
  margin-bottom: 0.65rem;
}

.sg-home-empty p {
  margin: 0;
  font-size: 0.9375rem;
}

/* Search page — sticky search bar (fixed when scrolled past top nav) */
.sg-search-sticky-ph {
  display: none;
  width: 100%;
  pointer-events: none;
}

.sg-search-sticky {
  position: relative;
  z-index: 40;
  margin: 1rem 0 1.25rem;
  padding: 0.65rem 0 0.75rem;
  background: var(--docs-bg-body);
  border-bottom: 1px solid transparent;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.3s ease;
  box-sizing: border-box;
}

.sg-search-sticky.is-fixed {
  position: fixed;
  top: var(--top-nav-height, 50px);
  margin: 0;
  border-bottom-color: var(--docs-border-primary);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.sg-search-form {
  display: flex;
  gap: 0.65rem;
  margin: 0;
  flex-wrap: wrap;
}

.sg-search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.sg-search-input-wrap > i {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--docs-text-muted);
  font-size: 1.15rem;
  pointer-events: none;
}

.sg-search-input-wrap .form-control {
  padding-left: 2.5rem;
  border-radius: 10px;
  border-color: var(--docs-border-primary);
  min-height: 44px;
}

.sg-search-form .btn-primary {
  border-radius: 10px;
  padding: 0.55rem 1.15rem;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  border: none;
  white-space: nowrap;
}

.sg-search-query-hint {
  font-size: 0.9rem;
  color: var(--docs-text-muted);
  margin-bottom: 1rem;
}

.sg-search-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sg-search-result {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--docs-border-primary);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sg-search-result:hover {
  border-color: #93c5fd;
  background: var(--docs-bg-highlight, rgba(37, 99, 235, 0.04));
  text-decoration: none;
  color: inherit;
}

.sg-search-result-title {
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--docs-text-primary);
  letter-spacing: -0.01em;
}

.sg-search-result-title mark,
.sg-search-result-desc mark {
  background: var(--docs-warning-bg, #fef3c7);
  color: var(--docs-warning-text, #92400e);
  padding: 0.05rem 0.2rem;
  border-radius: 0.25rem;
  font-weight: 600;
}

.sg-search-result-path {
  font-size: 0.8rem;
  color: var(--docs-text-muted);
  font-family: Consolas, Monaco, monospace;
}

.sg-search-result-desc {
  font-size: 0.875rem;
  color: var(--docs-text-secondary);
  margin-top: 0.15rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme="dark"] .sg-dir-card,
[data-theme="dark"] .article-content a.sg-dir-card {
  background: var(--docs-bg-primary, #1e293b);
  box-shadow: none;
}

[data-theme="dark"] .sg-dir-card:hover,
[data-theme="dark"] .article-content a.sg-dir-card:hover,
[data-theme="dark"] .sg-search-sticky.is-fixed {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  border-bottom-color: var(--docs-border-primary);
}

[data-theme="dark"] .sg-search-result:hover {
  border-color: rgba(148, 163, 184, 0.28);
  background: linear-gradient(180deg, rgba(51, 65, 85, 0.9) 0%, rgba(30, 41, 59, 1) 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .sg-dir-card-icon {
  background: rgba(148, 163, 184, 0.12);
  color: #93c5fd;
}

[data-theme="dark"] .sg-dir-card:hover .sg-dir-card-icon {
  background: rgba(147, 197, 253, 0.16);
  box-shadow: none;
}

[data-theme="dark"] .sg-dir-card:hover .sg-dir-card-title {
  color: #93c5fd;
}

[data-theme="dark"] .sg-dir-card:hover .sg-dir-card-meta code {
  background: rgba(147, 197, 253, 0.1);
  border-color: rgba(148, 163, 184, 0.35);
  color: #bfdbfe;
}

[data-theme="dark"] .sg-dir-card-action,
[data-theme="dark"] .sg-dir-card:hover .sg-dir-card-action {
  color: #93c5fd;
}

@media (max-width: 576px) {
  .sg-dir-grid {
    grid-template-columns: 1fr;
  }
  .sg-search-form .btn-primary {
    width: 100%;
  }
}

/* Home sidebar: click-to-open hint sits tight under the product list */
.docs-nav--home {
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
  box-sizing: border-box;
}

.docs-nav--home > .nav-list {
  flex-shrink: 0;
}

.sg-home-nav-hint {
  margin: 0.35rem 0.75rem 0.75rem;
  padding: 0.85rem 0.85rem 1rem;
  border-radius: 0.65rem;
  border: 1px dashed var(--docs-border-primary, #e2e8f0);
  background: var(--docs-bg-secondary, #f8fafc);
  text-align: center;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  color: var(--docs-text-muted, #64748b);
  position: relative;
}

.sg-home-nav-hint::before {
  content: "";
  position: absolute;
  top: -0.45rem;
  left: 1.35rem;
  width: 0.7rem;
  height: 0.7rem;
  border-left: 1px dashed var(--docs-border-primary, #e2e8f0);
  border-top: 1px dashed var(--docs-border-primary, #e2e8f0);
  background: var(--docs-bg-secondary, #f8fafc);
  transform: rotate(45deg);
}

.sg-home-nav-hint-visual {
  position: relative;
  width: 2.75rem;
  height: 3.1rem;
  margin-bottom: 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.sg-home-nav-hint-arrow {
  position: relative;
  z-index: 2;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--docs-primary, #3b82f6);
  animation: sg-home-nav-arrow 1.2s ease-in-out infinite;
}

.sg-home-nav-hint-pulse {
  position: absolute;
  left: 50%;
  top: 1.15rem;
  width: 2.1rem;
  height: 2.1rem;
  margin-left: -1.05rem;
  border-radius: 999px;
  background: rgba(var(--docs-primary-rgb, 59, 130, 246), 0.16);
  animation: sg-home-nav-pulse 2s ease-out infinite;
}

.sg-home-nav-hint-icon {
  position: relative;
  z-index: 1;
  margin-top: -0.15rem;
  font-size: 1.55rem;
  color: var(--docs-primary, #3b82f6);
  transform-origin: 30% 80%;
  animation: sg-home-nav-point 1.2s ease-in-out infinite;
}

.sg-home-nav-hint-title {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--docs-text-primary, #0f172a);
  line-height: 1.35;
}

.sg-home-nav-hint-desc {
  margin: 0;
  max-width: 13rem;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--docs-text-muted, #64748b);
}

@keyframes sg-home-nav-pulse {
  0% { transform: scale(0.72); opacity: 0.7; }
  70% { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}

@keyframes sg-home-nav-point {
  0%, 100% { transform: translateY(2px) rotate(-18deg); }
  50% { transform: translateY(-3px) rotate(-8deg); }
}

@keyframes sg-home-nav-arrow {
  0%, 100% { transform: translateY(3px); opacity: 0.55; }
  50% { transform: translateY(-2px); opacity: 1; }
}

[data-theme="dark"] .sg-home-nav-hint {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(51, 65, 85, 0.45);
}

[data-theme="dark"] .sg-home-nav-hint::before {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(51, 65, 85, 0.9);
}

[data-theme="dark"] .sg-home-nav-hint-title {
  color: #e2e8f0;
}

[data-theme="dark"] .sg-home-nav-hint-desc {
  color: #94a3b8;
}

@media (prefers-reduced-motion: reduce) {
  .sg-home-nav-hint-pulse,
  .sg-home-nav-hint-icon,
  .sg-home-nav-hint-arrow {
    animation: none;
  }
}
