/* ========================================
   CodeZone 炫彩重构 — CyberGlass 主题
   ======================================== */

/* === Google Fonts === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* === CSS 变量 === */
:root {
  --bg-primary: #08081a;
  --bg-secondary: #0f0f2a;
  --bg-card: rgba(18, 18, 50, 0.6);
  --bg-card-hover: rgba(28, 28, 70, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --text-primary: #e8e8f0;
  --text-secondary: #9494b8;
  --text-muted: #6b6b8a;
  --accent-cyan: #00d4ff;
  --accent-purple: #7c3aed;
  --accent-emerald: #10b981;
  --accent-blue: #3b82f6;
  --gradient-main: linear-gradient(135deg, #00d4ff, #7c3aed);
  --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-green: linear-gradient(135deg, #10b981, #3b82f6);
  --font-sans: 'Inter', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

/* === 全局重置 === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* === 动态背景：网格 + 粒子 === */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: -2;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
  animation: aurora 20s ease-in-out infinite;
}

@keyframes aurora {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -1%) rotate(1deg); }
  66% { transform: translate(-1%, 2%) rotate(-1deg); }
}

/* === 导航栏 === */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(8, 8, 26, 0.75);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.3s;
}

.navbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-purple), transparent);
  opacity: 0.5;
}

.logo {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  text-decoration: none;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity 0.3s;
  position: relative;
}

.logo:hover {
  opacity: 0.85;
}

.logo::before {
  content: '</>';
  font-size: 12px;
  -webkit-text-fill-color: var(--accent-emerald);
  margin-right: 6px;
  opacity: 0.7;
}

/* 搜索框 */
.search-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  padding: 6px 16px;
  transition: all 0.3s;
}

.search-box:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.15);
  background: rgba(0, 212, 255, 0.08);
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
  padding: 6px 8px;
  width: 160px;
  font-size: 13px;
  font-family: var(--font-sans);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  transition: color 0.2s;
}

.search-box button:hover {
  color: var(--accent-cyan);
}

/* 导航链接区域 */
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
  position: relative;
}

.nav-links a:not(.btn):hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s !important;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--gradient-main);
  color: white !important;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary) !important;
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--glass-border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary) !important;
}

.btn-ghost:hover {
  color: var(--text-primary) !important;
  background: rgba(255, 255, 255, 0.06);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white !important;
}

.btn-success {
  background: var(--gradient-green);
  color: white !important;
}

/* 主题切换按钮 */
.theme-toggle {
  cursor: pointer;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  margin-left: 4px;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(15deg);
}

/* 用户名高亮 */
.username-highlight {
  color: var(--accent-emerald) !important;
  font-weight: 600 !important;
}

/* === 主体容器 === */
.container {
  max-width: 860px;
  margin: 40px auto;
  padding: 0 24px;
  animation: fadeInUp 0.6s ease;
}

/* === 页面标题 === */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header .count-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 12px;
  border-radius: 50px;
  border: 1px solid var(--glass-border);
}

/* === 文章卡片 === */
.article-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-main);
  opacity: 0;
  transition: opacity 0.4s;
}

.article-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow), 0 0 30px rgba(0, 212, 255, 0.05);
}

.article-card:hover::before {
  opacity: 1;
}

.article-title {
  margin-bottom: 12px;
}

.article-title a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  transition: color 0.3s;
  display: block;
}

.article-title a:hover {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 封面图片 */
.cover-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin: 12px 0;
  transition: transform 0.5s;
  border: 1px solid var(--glass-border);
}

.article-card:hover .cover-img {
  transform: scale(1.02);
}

/* 文章元信息 */
.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.avatar-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--glass-border);
}

.article-meta .sep {
  color: var(--text-muted);
  opacity: 0.4;
}

/* 文章摘要 */
.article-content {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* === 分页 === */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
}

.page-btn {
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s;
  backdrop-filter: blur(8px);
}

.page-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.page-btn.active {
  background: var(--gradient-main);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.page-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.page-indicator {
  color: var(--text-muted);
  font-size: 13px;
  padding: 0 8px;
}

/* === 通用卡片 === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-glow {
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.05);
}

.label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* === 表单控件 === */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
  margin-bottom: 16px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
  background: rgba(0, 212, 255, 0.05);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* 表单按钮 */
button, .btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--gradient-main);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-sans);
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.35);
}

button:active {
  transform: translateY(0);
}

/* === 链接 === */
a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: #66e5ff;
}

/* === Footer === */
footer {
  text-align: center;
  padding: 24px 0;
  margin-top: 60px;
  border-top: 1px solid var(--glass-border);
  position: relative;
}

footer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: var(--gradient-main);
  opacity: 0.5;
}

footer .footer-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

footer p {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 2;
}

footer a {
  color: var(--text-secondary);
}

footer a:hover {
  color: var(--accent-cyan);
}

/* === 动画 === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 渐变文字工具类 */
.gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === Toast 消息 === */
.toast-message {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  font-size: 14px;
  z-index: 10000;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

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

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* === 高亮代码块 (文章页用) === */
.content pre {
  background: #0d0d1f !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

.content code {
  font-family: var(--font-mono);
  font-size: 13px;
}

.content blockquote {
  border-left: 3px solid var(--accent-cyan);
  margin: 20px 0;
  padding: 12px 20px;
  background: rgba(0, 212, 255, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.content img {
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

/* === 标签 / Tag === */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 50px;
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 500;
}

/* === 响应式 === */
@media (max-width: 768px) {
  .navbar {
    padding: 12px 16px;
  }

  .logo {
    font-size: 18px;
  }

  .search-box {
    display: none;
  }

  .nav-links a:not(.btn) {
    display: none;
  }

  .nav-links a.btn {
    padding: 6px 14px;
    font-size: 12px;
  }

  .container {
    padding: 0 12px;
    margin: 24px auto;
  }

  .article-card {
    padding: 20px;
  }

  .article-title a {
    font-size: 17px;
  }

  .cover-img {
    height: 160px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
