/* ==========================================
   my-theme 自定义样式（Bootstrap 5.3 + Font Awesome 补充层）
   规则：能用 Bootstrap class 做到的，不写 CSS
   ========================================== */

/* ===== 动态渐变背景 ===== */
body {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
  min-height: 100vh;
  position: relative;
}
/* 半透明遮罩让背景柔和不刺眼 */
body::before {
  content: '';
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.75);
  z-index: -1;
  pointer-events: none;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== 动画关键帧 ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-10px); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,152,219,0.4); }
  50%      { box-shadow: 0 0 0 15px rgba(52,152,219,0); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===== Hero 装饰背景 ===== */
.hero-section { animation: fadeIn 0.8s ease forwards; position: relative; }
.hero-subtitle  { animation: fadeInUp 0.6s 0.2s ease both; }

.hero-bg-decor {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: hidden;
}
.hero-dot {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
}
.hero-dot-1 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, #3498db, transparent);
  top: -60px; right: -40px;
  animation: float 6s ease-in-out infinite;
}
.hero-dot-2 {
  width: 150px; height: 150px;
  background: radial-gradient(circle, #e74c3c, transparent);
  bottom: -30px; left: 10%;
  animation: float 8s ease-in-out 1s infinite;
}
.hero-dot-3 {
  width: 100px; height: 100px;
  background: radial-gradient(circle, #2ecc71, transparent);
  top: 40%; left: -30px;
  animation: float 7s ease-in-out 2s infinite;
}

/* ===== 自定义按钮 ===== */
.btn-purple {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white !important;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
}
.btn-purple:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102,126,234,0.45);
  color: white !important;
}
.btn-teal {
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: white !important;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}
.btn-teal:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,184,148,0.45);
  color: white !important;
}
/* 按钮离子效果 */
.btn-purple:active, .btn-teal:active { transform: scale(0.96); }

/* ===== 导航栏增强 ===== */
.navbar {
  background: rgba(255,255,255,0.85) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.3);
}
.navbar-brand { letter-spacing: 0.5px; }
.nav-link {
  position: relative;
  transition: color 0.3s;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  border-radius: 2px;
  transition: transform 0.3s ease;
}
.nav-link:hover::after { transform: translateX(-50%) scaleX(1); }
.nav-link:hover { color: #3498db !important; }

/* ===== 侧边栏 ===== */
.sidebar {
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(15px) saturate(180%);
  -webkit-backdrop-filter: blur(15px) saturate(180%);
  border-right: 1px solid rgba(255,255,255,0.5);
  padding: 20px 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  z-index: 50;
}
.sidebar-header {
  padding: 10px 20px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 10px;
}
.sidebar-header i { color: #3498db; }

/* 分类组 */
.category-group { margin-bottom: 4px; }
.category-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s, padding-left 0.2s;
  user-select: none;
  border-radius: 0 8px 8px 0;
}
.category-group-header:hover { background: rgba(52,152,219,0.06); padding-left: 24px; }
.category-group-name { font-size: 15px; font-weight: 500; color: #2c3e50; }
.category-group-arrow {
  font-size: 12px; color: #999;
  transition: transform 0.3s;
  margin-right: 8px;
}
.category-group.open .category-group-arrow { transform: rotate(90deg); color: #3498db; }

/* 文章列表 */
.category-post-list {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding-left: 0;
}
.category-group.open .category-post-list { max-height: 600px; }
.category-post-item {
  padding: 8px 20px 8px 40px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.category-post-item:hover {
  background: rgba(52,152,219,0.06);
  color: #3498db;
  border-left-color: #3498db;
  padding-left: 44px;
}
.category-post-item.active {
  background: rgba(52,152,219,0.1);
  color: #3498db;
  border-left-color: #3498db;
  font-weight: 500;
}

/* 侧边栏滚动条 */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ===== 右侧主内容 ===== */
.main-area {
  padding: 40px;
  min-width: 0;
}

/* 文章查看器（玻璃拟态） */
.article-viewer {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  border: 1px solid rgba(255,255,255,0.5);
  transition: all 0.3s ease;
}
.article-viewer:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

/* ===== 隐藏的分类数据卡（玻璃拟态升级） ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
}
.category-card {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  border: 1px solid rgba(255,255,255,0.5);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.14);
  border-color: rgba(52,152,219,0.2);
}
/* 光标扫光效果 */
.category-card::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(52,152,219,0.06), transparent);
  transition: left 0.6s;
}
.category-card:hover::before { left: 100%; }
.category-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(0,0,0,0.06);
}
.category-card .card-title {
  font-size: 20px;
  font-weight: 600;
  background: linear-gradient(135deg, #2c3e50, #3498db);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.category-card .card-count {
  font-size: 13px; color: #999;
  background: rgba(0,0,0,0.04);
  padding: 4px 14px;
  border-radius: 20px;
  font-weight: 500;
}
.category-card .card-post-list { list-style: none; padding-left: 0; }
.category-card .card-post-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.06);
}
.category-card .card-post-item:last-child { border-bottom: none; }
.category-card .card-post-item a {
  color: #3498db;
  text-decoration: none;
  font-size: 15px;
  transition: color 0.3s, padding-left 0.2s;
}
.category-card .card-post-item a:hover { color: #2980b9; padding-left: 4px; }
.post-date {
  font-size: 12px; color: #bbb;
  white-space: nowrap;
  margin-left: 10px;
}

/* ===== 文章详情页（玻璃拟态） ===== */
.post-detail {
  border-radius: 20px;
  background: rgba(255,255,255,0.8) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.5) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08) !important;
}
.post-detail .post-title { font-size: 32px; color: #2c3e50; }

.post-content { font-size: 16px; line-height: 1.8; }
.post-content h2 {
  margin: 35px 0 15px;
  padding-bottom: 8px;
  color: #2c3e50;
  border-bottom: 2px solid rgba(52,152,219,0.2);
}
.post-content h3 { margin: 20px 0 10px; color: #34495e; }
.post-content p  { margin-bottom: 15px; }
.post-content code {
  background: rgba(52,152,219,0.08);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "Fira Code","Consolas","Monaco",monospace;
  font-size: 14px;
  color: #e74c3c;
}
.post-content pre {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #e0e0e0;
  padding: 24px;
  border-radius: 14px;
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  position: relative;
}
.post-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 14px;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}
.post-content th, .post-content td {
  border: 1px solid #dee2e6;
  padding: 10px 14px;
  text-align: left;
}
.post-content th {
  background: linear-gradient(180deg, #f8f9fa, #e9ecef);
  font-weight: 600;
}
.post-content tr:hover td { background: rgba(52,152,219,0.03); }
.post-content blockquote {
  border-left: 4px solid #3498db;
  padding: 12px 24px;
  margin: 20px 0;
  background: rgba(52,152,219,0.05);
  border-radius: 0 10px 10px 0;
  color: #555;
}

/* ===== 页脚 ===== */
.site-footer {
  border-top: 1px solid rgba(0,0,0,0.05);
}
.beian a {
  color: #aaa;
  font-size: 12px;
  transition: color 0.3s;
}
.beian a:hover { color: #3498db; text-decoration: none !important; }

/* ===== 回到顶部按钮 ===== */
.scroll-top-btn {
  position: fixed;
  bottom: 30px; right: 30px;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(102,126,234,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
}
.scroll-top-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(102,126,234,0.5);
}
.scroll-top-btn:active { transform: scale(0.92); }

/* ===== AI 对话框（玻璃拟态升级） ===== */
.ai-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease;
}
.ai-overlay.active { display: flex; }
.ai-dialog {
  width: 90%;
  max-width: 520px;
  height: 560px;
  max-height: 85vh;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInUp 0.35s ease;
}
.ai-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: white;
}
.ai-dialog-title { font-size: 16px; font-weight: 600; }
.ai-dialog-close {
  background: none; border: none;
  color: white; font-size: 18px;
  cursor: pointer;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.ai-dialog-close:hover { background: rgba(255,255,255,0.25); transform: rotate(90deg); }
.ai-dialog-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-dialog-body::-webkit-scrollbar { width: 5px; }
.ai-dialog-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
.ai-welcome { text-align: center; padding: 40px 20px; color: #aaa; }
.ai-welcome-icon {
  font-size: 48px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #00b894, #00cec9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ai-welcome p { font-size: 14px; margin: 4px 0; }

/* 消息气泡 */
.ai-message {
  display: flex;
  gap: 8px;
  max-width: 90%;
  animation: fadeInUp 0.3s ease;
}
.ai-message.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-message.bot  { align-self: flex-start; }
.ai-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: #e0e0e0;
  color: white;
}
.ai-message.bot .ai-avatar  { background: linear-gradient(135deg, #00b894, #00cec9); }
.ai-message.user .ai-avatar { background: linear-gradient(135deg, #667eea, #764ba2); }
.ai-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}
.ai-message.bot .ai-bubble {
  background: rgba(255,255,255,0.9);
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.05);
}
.ai-message.user .ai-bubble {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-bottom-right-radius: 4px;
}
.ai-loading { align-self: flex-start; display: flex; gap: 8px; align-items: center; }
.ai-loading .ai-bubble { background: rgba(255,255,255,0.9); padding: 10px 14px; }
.ai-loading-dots { display: flex; gap: 5px; }
.ai-loading-dots span {
  width: 7px; height: 7px;
  background: #00b894;
  border-radius: 50%;
  animation: dotBounce 1.4s infinite ease-in-out;
}
.ai-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* 输入区 */
.ai-dialog-footer {
  display: flex; padding: 12px 16px;
  gap: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.8);
}
.ai-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: all 0.25s;
  background: rgba(0,0,0,0.02);
}
.ai-input:focus {
  border-color: #00b894;
  box-shadow: 0 0 0 3px rgba(0,184,148,0.1);
  background: white;
}
.ai-send-btn {
  padding: 10px 20px;
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: white; border: none;
  border-radius: 24px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.ai-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,184,148,0.4);
}
.ai-send-btn:active { transform: scale(0.96); }

/* ===== 响应式（Bootstrap 断点之外的微调） ===== */
@media (max-width: 768px) {
  .category-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 28px; }
  .post-detail .post-title { font-size: 26px; }
  .post-detail { padding: 20px; }

  .sidebar {
    position: relative; top: 0;
    width: 100%; min-width: 100%;
    height: auto; max-height: 300px;
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }
  .main-area { padding: 20px 12px; }
  .article-viewer { padding: 20px; border-radius: 16px; }
  .ai-dialog { width: 96%; height: 90vh; max-height: 90vh; border-radius: 16px; }
  .scroll-top-btn { bottom: 20px; right: 20px; width: 40px; height: 40px; font-size: 16px; }
}
