/* ========== 字体定义 ========== */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

/* ========== 基础样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #818cf8;
  --accent: #ec4899;
  --accent-hover: #db2777;
  --text: #0f172a;
  --text-light: #64748b;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body {
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== Hero ========== */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  max-height: 1080px;
  overflow: hidden;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.85);
  transition: transform 0.3s ease;
}

.hero:hover .hero-image {
  transform: scale(1.02);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.4) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.hero-title {
  color: #fff;
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== 导航 ========== */
.nav {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: transform 0.2s;
}

.nav-logo:hover {
  transform: scale(1.05);
}

.nav-link {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--bg-secondary);
}

/* ========== 文章列表 ========== */
.articles {
  padding: 80px 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-secondary) 100%);
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 48px;
  color: var(--text);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60%;
  height: 4px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 40px;
}

.article-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--shadow);
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.article-card-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  transition: transform 0.3s ease;
}

.article-card:hover .article-card-image {
  transform: scale(1.05);
}

.article-card-body {
  padding: 24px;
}

.article-card-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
  color: var(--text);
}

.article-card-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.article-card-pin {
  background: var(--gradient-accent);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
}

/* ========== 文章详情 ========== */
.article-detail {
  padding: 80px 0;
  max-width: 800px;
  margin: 0 auto;
}

.article-detail h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.3;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.article-detail-meta {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 2px solid var(--border);
  font-weight: 500;
}

.article-detail-cover {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 48px;
  box-shadow: var(--shadow-md);
}

.article-detail-content {
  font-size: 1.1rem;
  line-height: 1.9;
  color: var(--text);
}

.article-detail-content p {
  margin-bottom: 1.8em;
}

.article-detail-content img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 32px 0;
  box-shadow: var(--shadow-md);
}

/* ========== 评论区 ========== */
.comments-section {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 0 100px;
  border-top: 2px solid var(--border);
}

.comments-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--text);
}

.comment-form {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  padding: 32px;
  border-radius: var(--radius);
  margin-bottom: 40px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.form-group {
  margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.3s;
  background: var(--bg);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 12px;
  font-weight: 500;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.comment-item {
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.comment-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.comment-author {
  font-weight: 700;
  color: var(--primary);
}

.comment-date {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
}

.comment-content {
  line-height: 1.8;
  color: var(--text);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(102, 102, 234, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(102, 102, 234, 0.4);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  background: var(--text-light);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
}

/* ========== 后台管理 ========== */
.admin-login {
  max-width: 450px;
  margin: 120px auto;
  text-align: center;
}

.admin-login h2 {
  margin-bottom: 32px;
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-form {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.error {
  color: #f5576c;
  font-size: 0.9rem;
  margin-top: 16px;
  font-weight: 600;
  padding: 12px;
  background: rgba(245, 87, 108, 0.1);
  border-radius: var(--radius-sm);
}

.admin-panel {
  padding: 60px 0;
}

.admin-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}

.admin-tab {
  padding: 12px 24px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s;
  font-family: 'JetBrains Mono', monospace;
}

.admin-tab:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.admin-tab.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(102, 102, 234, 0.3);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.panel-header h3 {
  font-size: 1.25rem;
}

/* 文章列表（后台） */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius);
  gap: 20px;
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.article-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  transform: translateX(4px);
}

.article-item-info {
  flex: 1;
  min-width: 0;
}

.article-item-title {
  font-weight: 700;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 1.05rem;
}

.article-item-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
}

.article-item-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* 评论列表（后台） */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comment-item-admin {
  padding: 24px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.comment-item-admin:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.comment-item-admin .comment-article {
  font-size: 0.8rem;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 700;
  padding: 6px 12px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.comment-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* 上传 */
.upload-form {
  max-width: 600px;
}

.upload-area {
  border: 3px dashed var(--border);
  border-radius: var(--radius);
  padding: 80px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  transform: scale(1.02);
}

.upload-preview {
  margin-bottom: 24px;
}

.upload-preview img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.uploaded-images {
  margin-top: 60px;
}

.uploaded-images h4 {
  margin-bottom: 24px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  transition: all 0.3s;
}

.image-item:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-item-actions {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s;
  padding: 12px;
}

.image-item:hover .image-item-actions {
  opacity: 1;
}

.image-copy-btn,
.image-delete-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  width: 100%;
}

.image-copy-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
}

.image-copy-btn:hover {
  background: #fff;
  transform: translateY(-2px);
}

.image-delete-btn {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.image-delete-btn:hover {
  background: rgb(220, 38, 38);
  transform: translateY(-2px);
}

/* ========== 弹窗 ========== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  background: var(--bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 2px solid var(--border);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
  transition: all 0.3s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  color: var(--text);
  background: var(--bg-secondary);
  transform: rotate(90deg);
}

#article-form {
  padding: 32px;
}

#article-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 0.95rem;
}

#article-form textarea {
  resize: vertical;
  min-height: 350px;
}

.form-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
}

/* ========== 通用 ========== */
.loading {
  text-align: center;
  padding: 60px;
  color: var(--text-light);
  font-size: 1.1rem;
  font-weight: 600;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
  font-size: 1.1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius);
  margin: 40px 0;
}

/* ========== Footer ========== */
.footer {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 60px 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.footer p {
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
    letter-spacing: 0.1em;
  }

  .article-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .article-detail h1 {
    font-size: 2rem;
  }

  .article-detail-content {
    font-size: 1rem;
  }

  .article-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-item-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .nav .container {
    height: 64px;
  }

  .nav-logo {
    font-size: 1.25rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .modal-content {
    max-width: 95%;
  }

  .modal-header {
    padding: 20px 24px;
  }

  #article-form {
    padding: 24px;
  }

  .comment-form {
    padding: 24px;
  }

  .admin-nav {
    gap: 8px;
  }

  .admin-tab {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
}

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

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ========== 选中文本样式 ========== */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text);
}

::-moz-selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text);
}

/* ========== 平滑滚动 ========== */
html {
  scroll-behavior: smooth;
}

/* ========== 焦点可见性 ========== */
*:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
