/**
 * docsify-custom-sidebar-plugin 像素风样式
 * 与 Script Graph 项目整体风格统一
 */

/* 自定义侧边栏样式 */
.custom-sidebar {
  font-family: 'Ark Pixel 12px', 'Courier New', monospace;
  padding-bottom: 3rem;
}

/* 搜索框容器 */
.sidebar-search {
  padding: 1rem;
  border-bottom: 2px solid rgba(64, 64, 64, 0.6);
}

/* 搜索输入框 */
.sidebar-search .search-input {
  width: 100%;
  background: #1a1a1a !important;
  border: 3px solid rgba(64, 64, 64, 0.8) !important;
  color: var(--base-color) !important;
  border-radius: 4px !important;
  padding: 0.6rem 0.6rem 0.6rem 2.5rem !important;
  font-family: 'Ark Pixel 12px', 'Courier New', monospace !important;
  box-shadow: 3px 3px 0 0 #000 !important;
  transition: all 0.2s !important;
  font-size: 0.9rem;
}

.sidebar-search .search-input:focus {
  border-color: var(--accent-color) !important;
  box-shadow: 3px 3px 0 0 #000, 0 0 10px rgba(253, 230, 138, 0.3) !important;
  outline: none !important;
}

.sidebar-search .search-input::placeholder {
  color: rgba(224, 224, 224, 0.4) !important;
}

.sidebar-search {
  position: relative;
}

.sidebar-search::before {
  content: '';
  position: absolute;
  left: 1.7rem;
  top: 1.8rem;
  width: 16px;
  height: 16px;
  background: url('images/search-icon.svg') center center / contain no-repeat;
  filter: brightness(0) saturate(100%) invert(50%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(90%) contrast(90%);
  opacity: 0.6;
  pointer-events: none;
}

/* Logo 和项目名称 */
.app-name-link {
  display: block;
  text-decoration: none;
  transition: all 0.2s;
}

.app-name-link:hover {
  transform: translateY(-2px);
}

.app-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--theme-color);
  text-shadow: 3px 3px 0 #000;
  font-family: 'Ark Pixel 12px', 'Courier New', monospace;
  padding: 1.5rem 1rem;
  border-bottom: 3px solid rgba(64, 64, 64, 0.6);
  background: rgba(64, 64, 64, 0.15);
  position: relative;
  display: flex;
  align-items: center;
}

.app-logo {
  display: inline-block;
  width: 30px;
  height: 30px;
  background: url('images/logo.webp') center center / contain no-repeat;
  margin-right: 0.8rem;
  filter: drop-shadow(2px 2px 0 #000);
}

.app-name-link:hover .app-name {
  background: rgba(253, 230, 138, 0.1);
}

/* 侧边栏滚动条样式 - 与主题保持一致 */

.sidebar::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.sidebar::-webkit-scrollbar-track {
  background: #1a1a1a !important;
  border: 2px solid rgba(64, 64, 64, 0.6) !important;
  border-radius: 2px !important;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(96, 96, 96, 0.8) !important;
  border: 2px solid #000 !important;
  border-radius: 2px !important;
  position: relative;
  background-image:
    repeating-linear-gradient(45deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px) !important;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color) !important;
  background-image:
    repeating-linear-gradient(45deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px) !important;
}

.sidebar::-webkit-scrollbar-corner {
  background: #1a1a1a;
}

/* 分类容器 */
.sidebar-category {
  margin-bottom: 0.5rem;
  border-bottom: 2px solid rgba(64, 64, 64, 0.3);
  padding-bottom: 0.5rem;
}

.sidebar-category:last-child {
  border-bottom: none;
}

/* 分类标题 */
.category-header {
  display: flex;
  align-items: center;
  padding: 0.8rem 1rem;
  cursor: url('images/cusor-pointer.png'), pointer !important;
  color: var(--accent-color);
  font-weight: bold;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  position: relative;
  text-shadow: 1px 1px 0 #000;
}

.category-header:hover {
  background: rgba(253, 230, 138, 0.1);
  border-left-color: var(--accent-color);
}

/* 分类名称 */
.category-name {
  flex: 1;
}

/* 展开/折叠图标 */
.category-toggle {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: url('images/right-arrow.svg') center center / contain no-repeat;
  transition: transform 0.3s;
  filter: brightness(0) saturate(100%) invert(87%) sepia(21%) saturate(434%) hue-rotate(359deg) brightness(103%) contrast(98%);
  opacity: 0.8;
}

.sidebar-category.expanded .category-toggle {
  transform: rotate(90deg);
}

/* 分类条目列表 */
.category-items {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.1s;
}

.sidebar-category.expanded .category-items {
  max-height: 2000px;
  transition: max-height 0.5s;
}

/* 侧边栏条目 */
.sidebar-item {
  margin: 0;
  padding: 0;
}

/* 条目链接 */
.item-link {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  color: var(--base-color);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  position: relative;
}

.item-link:hover {
  color: var(--accent-color);
  background: rgba(253, 230, 138, 0.08);
  border-left-color: var(--accent-color);
  text-shadow: 1px 1px 0 #000;
}

/* 激活状态 */
.sidebar-item.active > .item-link {
  color: var(--accent-color);
  background: rgba(253, 230, 138, 0.1);
  border-left-color: var(--accent-color);
  font-weight: bold;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* 子章节列表 */
.item-subsections {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px dotted rgba(64, 64, 64, 0.4);
  margin-left: 2.5rem;
}

.item-subsections:empty {
  display: none;
}

/* 子章节条目 */
.subsection-item {
  margin: 0;
  padding: 0;
}

/* 子章节链接 */
.subsection-link {
  display: flex;
  align-items: center;
  padding: 0.4rem 1rem;
  color: var(--base-color);
  text-decoration: none;
  font-size: 0.9em;
  opacity: 0.8;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

.subsection-link:hover {
  color: var(--accent-color);
  opacity: 1;
  background: rgba(253, 230, 138, 0.05);
  border-left-color: var(--accent-color);
}

.subsection-link.active {
  color: var(--accent-color);
  opacity: 1;
  font-weight: bold;
  border-left-color: var(--accent-color);
}

/* 子章节图标 */
.subsection-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.1rem;
  opacity: 0.5;
}

.subsection-link:hover .subsection-icon,
.subsection-link.active .subsection-icon {
  opacity: 1;
}

/* 条目标题 */
.item-title {
  flex: 1;
}

/* 子章节文本 */
.subsection-text {
  flex: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .category-header {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  .item-link {
    padding: 0.5rem 0.8rem 0.5rem 1.5rem;
    font-size: 0.9rem;
  }

  .sidebar-search {
    padding: 0.8rem;
  }

  .app-name {
    padding: 1.2rem 0.8rem;
    font-size: 1.1rem;
  }
}
