/*
 * 侧边目录玻璃拟态样式
 * 作用于 kratos 主题的 .k-main .sidebar .widget 与 ez-toc 目录插件
 * 独立文件挂载，不修改主题源码，主题升级不受影响
 */

/* ---------- 通用 widget 玻璃容器 ---------- */
.k-main .sidebar .widget {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 4px 20px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: box-shadow 0.28s ease, background-color 0.28s ease, transform 0.28s ease;
}

.k-main .sidebar .widget:hover {
  background: rgba(255, 255, 255, 0.72);
  box-shadow:
    0 8px 30px rgba(15, 23, 42, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* 不带背景图的组件（头像框、广告位）保持原样 */
.k-main .sidebar .w-about,
.k-main .sidebar .w-ad {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---------- 目录标题 ---------- */
.k-main .sidebar .widget .title {
  margin: -2px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.18);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 7px;
}

.k-main .sidebar .widget .title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #06b6d4, #3b82f6);
}

/* ez-toc 自己的标题容器 */
.ez-toc-widget-sticky .ez-toc-widget-sticky-title-container,
.ez-toc-widget-sticky .title {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #334155;
}

/* ---------- 目录列表 ---------- */
.k-main .sidebar .widget ul,
.k-main .sidebar .widget ol {
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.k-main .sidebar .widget li {
  position: relative;
  margin: 0 0 2px;
}

.k-main .sidebar .widget li a {
  display: block;
  padding: 5px 10px 5px 12px;
  border-radius: 8px;
  color: #475569;
  font-size: 13.5px;
  line-height: 1.55;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.k-main .sidebar .widget li a:hover {
  background: rgba(6, 182, 212, 0.09);
  color: #0891b2;
  padding-left: 15px;
}

/* 当前高亮项 */
.k-main .sidebar .widget li.active > a,
.k-main .sidebar .widget li.current > a {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.14), rgba(59, 130, 246, 0.05));
  color: #0e7490;
  font-weight: 600;
  box-shadow: inset 2px 0 0 #06b6d4;
}

/* 层级缩进 */
.k-main .sidebar .widget li ul,
.k-main .sidebar .widget li ol {
  margin: 2px 0 4px;
}

.k-main .sidebar .widget li li a {
  padding-left: 24px;
  font-size: 13px;
  color: #64748b;
}

.k-main .sidebar .widget li li li a {
  padding-left: 36px;
  font-size: 12.5px;
}

/* 目录项前面的序号/符号弱化 */
.k-main .sidebar .widget li a::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.34;
  vertical-align: middle;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.k-main .sidebar .widget li a:hover::before,
.k-main .sidebar .widget li.active > a::before {
  opacity: 0.9;
  transform: scale(1.15);
}

/* 移除列表默认标记 */
.k-main .sidebar .widget ul li::marker,
.k-main .sidebar .widget ol li::marker {
  content: none;
}

/* ez-toc 计数器样式覆盖 */
.ez-toc-widget-sticky li a::before {
  display: none;
}

.ez-toc-widget-sticky .ez-toc-widget-sticky-container ul li a {
  border-radius: 8px;
  padding: 5px 10px 5px 12px;
}

.ez-toc-widget-sticky .ez-toc-widget-sticky-container ul li ul a {
  padding-left: 24px;
}

/* ez-toc 自带的高亮色块改用我们的样式 */
.ez-toc-widget-sticky .ez-toc-widget-sticky-container ul li.active > a {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.14), rgba(59, 130, 246, 0.05));
  color: #0e7490;
  font-weight: 600;
}

/* ---------- 标签云 / 其他列表 widget ---------- */
.k-main .sidebar .widget_tags a,
.k-main .sidebar .widget_categories ul li a,
.k-main .sidebar .widget_links ul li a,
.k-main .sidebar .widget_archive ul li a {
  display: inline-block;
  margin: 0 6px 8px 0;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  color: #475569;
  font-size: 13px;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.k-main .sidebar .widget_tags a:hover,
.k-main .sidebar .widget_categories ul li a:hover,
.k-main .sidebar .widget_links ul li a:hover,
.k-main .sidebar .widget_archive ul li a:hover {
  background: rgba(6, 182, 212, 0.16);
  color: #0891b2;
  transform: translateY(-1px);
}

/* ---------- 响应式：窄屏关闭模糊，避免性能问题 ---------- */
@media screen and (max-width: 991px) {
  .k-main .sidebar .widget {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #fff;
  }
}

/* ---------- 无障碍：尊重减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .k-main .sidebar .widget,
  .k-main .sidebar .widget li a,
  .k-main .sidebar .widget li a::before {
    transition: none;
  }
}
