/*
 * 雪夜博客 - 自定义DaisyUI主题
 * 参考 chanmufeng.com 的简约风格
 * 支持 xueye（浅色）和 xueye-dark（深色）两个主题
 */

/* ==================== 浅色主题（默认） ==================== */
[data-theme="xueye"] {
  color-scheme: light;
  --b1: 0 0% 100%;
  --b2: 0 0% 98%;
  --b3: 0 0% 96%;
  --p: 220 15% 35%;
  --pc: 0 0% 100%;
  --s: 220 10% 46%;
  --sc: 0 0% 100%;
  --a: 25 85% 57%;
  --ac: 0 0% 100%;
  --n: 220 10% 20%;
  --nc: 0 0% 100%;
  --in: 207 90% 54%;
  --inc: 0 0% 100%;
  --su: 158 64% 42%;
  --suc: 0 0% 100%;
  --wa: 38 92% 50%;
  --wac: 0 0% 100%;
  --er: 0 72% 51%;
  --erc: 0 0% 100%;
  --rounded-box: 0.5rem;
  --rounded-btn: 0.375rem;
  --rounded-badge: 1.9rem;
  --rounded-full: 9999px;
  --animation-btn: 0.25s;
  --animation-input: 0.2s;
  --btn-focus-scale: 0.95;
  --border-btn: 1px;
  --tab-border: 1px;
  --tab-radius: 0.5rem;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 8px 15px -3px rgb(0 0 0 / 0.04), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  /* 语义变量 */
  --surface-1: #ffffff;
  --surface-2: #fafafa;
  --border-subtle: #f0f0f0;
  --border-default: #e5e5e5;
  --text-primary: #222222;
  --text-secondary: #333333;
  --text-muted: #999999;
  --navbar-bg: #ffffff;
  --footer-bg: #fafafa;
  --hover-bg: #f5f5f5;
  --link-color: var(--s);
}

/* ==================== 深色主题 ==================== */
[data-theme="xueye-dark"] {
  color-scheme: dark;
  --b1: 220 15% 12%;
  --b2: 220 12% 15%;
  --b3: 220 10% 18%;
  --p: 210 80% 60%;
  --pc: 0 0% 100%;
  --s: 220 15% 55%;
  --sc: 0 0% 100%;
  --a: 25 85% 60%;
  --ac: 0 0% 100%;
  --n: 220 10% 25%;
  --nc: 0 0% 100%;
  --in: 207 90% 54%;
  --inc: 0 0% 100%;
  --su: 158 64% 45%;
  --suc: 0 0% 100%;
  --wa: 38 92% 50%;
  --wac: 0 0% 100%;
  --er: 0 72% 51%;
  --erc: 0 0% 100%;
  --rounded-box: 0.5rem;
  --rounded-btn: 0.375rem;
  --rounded-badge: 1.9rem;
  --rounded-full: 9999px;
  --animation-btn: 0.25s;
  --animation-input: 0.2s;
  --btn-focus-scale: 0.95;
  --border-btn: 1px;
  --tab-border: 1px;
  --tab-radius: 0.5rem;
  --shadow: 0 2px 8px 0 rgb(0 0 0 / 0.2);
  --shadow-lg: 0 4px 16px 0 rgb(0 0 0 / 0.25);
  --shadow-xl: 0 8px 24px 0 rgb(0 0 0 / 0.3);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  /* 语义变量 */
  --surface-1: rgba(30, 41, 59, 0.85);
  --surface-2: rgba(30, 41, 59, 0.6);
  --border-subtle: rgba(148, 163, 184, 0.1);
  --border-default: rgba(148, 163, 184, 0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --navbar-bg: rgba(15, 23, 42, 0.95);
  --footer-bg: rgba(15, 23, 42, 0.95);
  --hover-bg: rgba(59, 130, 246, 0.1);
  --link-color: #93c5fd;
}

/* ==================== 全局样式（主题感知） ==================== */
body {
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.7;
  color: var(--text-secondary);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

a {
  color: var(--p);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-color);
}

/* 导航栏 */
.navbar {
  background-color: var(--navbar-bg);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: none;
}

.navbar .btn-ghost:hover {
  background-color: var(--hover-bg);
}

/* 卡片 */
.card {
  background-color: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--rounded-box);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: 1.5rem;
}

/* 按钮 */
.btn {
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--p);
  border-color: var(--p);
}

.btn-primary:hover {
  background-color: var(--s);
  border-color: var(--s);
}

.btn-ghost {
  background-color: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--hover-bg);
}

/* 输入框 */
.input {
  border-color: var(--border-default);
  border-radius: var(--rounded-btn);
  background-color: var(--surface-1);
  color: var(--text-primary);
}

.input:focus {
  border-color: var(--p);
  box-shadow: 0 0 0 2px rgb(34 48 75 / 0.1);
}

/* 徽章 */
.badge {
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
}

.badge-outline {
  background-color: transparent;
  border-color: var(--border-default);
  color: var(--text-muted);
}

.badge-outline:hover {
  border-color: var(--p);
  color: var(--p);
}

/* 菜单 */
.menu > li > a {
  border-radius: var(--rounded-btn);
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
}

.menu > li > a:hover {
  background-color: var(--hover-bg);
}

.menu > li > a.active {
  background-color: var(--p);
  color: var(--pc);
}

/* 页脚 */
.footer {
  background-color: var(--footer-bg);
  border-top: 1px solid var(--border-subtle);
}

/* 文章列表项 */
.article-item {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.article-item:last-child {
  border-bottom: none;
}

.article-item:hover {
  background-color: var(--hover-bg);
}

/* 标签云 */
.tag-cloud .badge {
  margin: 0.25rem;
}

/* 侧边栏 */
.sidebar-section {
  padding: 1.25rem;
  background-color: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--rounded-box);
  margin-bottom: 1rem;
}

.sidebar-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* 搜索框 */
.search-form {
  display: flex;
  gap: 0.5rem;
}

.search-form .input {
  flex: 1;
}

.search-form .btn {
  flex-shrink: 0;
}

/* 文章标题 */
.article-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.article-title:hover {
  color: var(--p);
}

/* 文章摘要 */
.article-excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

/* 文章元信息 */
.article-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-meta span {
  margin-right: 1rem;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.pagination .btn {
  min-width: 2.5rem;
}

/* 页面标题 */
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--p);
  display: inline-block;
  color: var(--text-primary);
}

/* 返回链接 */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.back-link:hover {
  color: var(--p);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .navbar { padding: 0.5rem 1rem; }
  .card-body { padding: 1rem; }
  .sidebar-section { padding: 1rem; }
  .article-item { padding: 1rem; }
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--surface-2);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 选中文本 */
::selection {
  background-color: var(--p);
  color: white;
}

/* ==================== 主题切换按钮 ==================== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--rounded-btn);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  color: var(--text-secondary);
}

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

.theme-toggle svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* 浅色显示月亮（点击切深色），深色显示太阳（点击切浅色） */
[data-theme="xueye"] .theme-toggle .icon-sun { display: none; }
[data-theme="xueye"] .theme-toggle .icon-moon { display: inline-block; }
[data-theme="xueye-dark"] .theme-toggle .icon-sun { display: inline-block; }
[data-theme="xueye-dark"] .theme-toggle .icon-moon { display: none; }
