/* ============================================================
   CSS 层 —— 全局样式 & 金水元素隐晦体现
   - 不得出现"金""水"文字
   - 主色调：黑、白、深灰、深蓝（水属性），点缀金色（金属性）
   - 背景有波浪纹理 + 金色细线/光晕
   - 右上角金色光晕，左下角水蓝色光晕
   - 圆形装饰 + 斜向/矩形线条装饰
============================================================ */
:root {
  --bg-deep: #0a0e14;
  --bg-card: #131820;
  --text-primary: #e0e0e0;
  --text-secondary: #9ca3af;
  --accent-gold: #c9a96e;
  --accent-gold-light: #d4b87a;
  --accent-blue: #1e3a5f;
  --accent-blue-light: #2c5f8a;
  --border-subtle: rgba(201, 169, 110, 0.15);
  --border-blue: rgba(44, 95, 138, 0.25);
  --shadow-gold: 0 0 60px rgba(201, 169, 110, 0.08);
  --shadow-blue: 0 0 80px rgba(30, 58, 95, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.7;
}

/* ---- 背景装饰层：波浪纹理（水）---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.06;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(30, 58, 95, 0.5) 3px,
      rgba(30, 58, 95, 0.5) 3.5px
    ),
    radial-gradient(ellipse at 50% 0%, transparent 40%, rgba(44, 95, 138, 0.08) 100%);
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

/* 波浪纹理叠加层 */
.wave-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 60px,
    rgba(44, 95, 138, 0.6) 60px,
    rgba(44, 95, 138, 0.6) 61px
  ),
  radial-gradient(circle at 30% 70%, rgba(44, 95, 138, 0.3) 0%, transparent 50%),
  radial-gradient(circle at 70% 30%, rgba(44, 95, 138, 0.2) 0%, transparent 40%);
}

/* ---- 金色光晕（右上）---- */
.glow-gold {
  position: fixed;
  top: -120px;
  right: -80px;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 169, 110, 0.12) 0%, rgba(201, 169, 110, 0.04) 40%, transparent 70%);
  z-index: 0;
  pointer-events: none;
  filter: blur(40px);
}

/* ---- 蓝色光晕（左下）---- */
.glow-blue {
  position: fixed;
  bottom: -100px;
  left: -100px;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(44, 95, 138, 0.15) 0%, rgba(30, 58, 95, 0.05) 45%, transparent 70%);
  z-index: 0;
  pointer-events: none;
  filter: blur(50px);
}

/* ---- 金色细线装饰（左上区域）---- */
.decor-lines {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 300px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.25;
  background:
    linear-gradient(135deg, transparent 48%, rgba(201, 169, 110, 0.3) 48%, rgba(201, 169, 110, 0.3) 49%, transparent 49%),
    linear-gradient(150deg, transparent 55%, rgba(212, 184, 122, 0.2) 55%, rgba(212, 184, 122, 0.2) 56%, transparent 56%),
    linear-gradient(120deg, transparent 70%, rgba(201, 169, 110, 0.15) 70%, rgba(201, 169, 110, 0.15) 71%, transparent 71%);
}

/* ---- 圆形装饰（水属性）---- */
.decor-circles {
  position: fixed;
  bottom: 60px;
  right: 40px;
  width: 180px;
  height: 180px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.12;
  border: 1px solid rgba(44, 95, 138, 0.5);
  border-radius: 50%;
  box-shadow:
    0 0 30px rgba(44, 95, 138, 0.2),
    inset 0 0 30px rgba(44, 95, 138, 0.1);
}

.decor-circles::after {
  content: '';
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(44, 95, 138, 0.3);
  border-radius: 50%;
}

/* ---- 主布局 ---- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

/* ========== 顶部导航栏 ========== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 16px;
}

.nav-brand {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-gold);
  position: relative;
}

.nav-brand::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 36px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-gold), transparent);
  border-radius: 1px;
}

/* 用户信息区域 */
.user-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), #8b7340);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1a1a1a;
  flex-shrink: 0;
  border: 2px solid rgba(201, 169, 110, 0.4);
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.user-bio {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(201, 169, 110, 0.08);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--accent-gold-light);
  font-size: 1rem;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(201, 169, 110, 0.18);
  border-color: rgba(201, 169, 110, 0.35);
}

/* ========== 文章列表 ========== */
.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding-left: 12px;
  border-left: 3px solid var(--accent-gold);
  letter-spacing: 1px;
}

.loading-indicator {
  text-align: center;
  padding: 48px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.loading-indicator .spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(201, 169, 110, 0.2);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

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

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.35s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.article-card:hover {
  border-color: rgba(201, 169, 110, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), var(--shadow-gold);
}

/* 卡片上的金色细线装饰 */
.article-card::after {
  content: '';
  position: absolute;
  top: 14px;
  right: 14px;
  width: 24px;
  height: 1px;
  background: rgba(201, 169, 110, 0.3);
  transform: rotate(-30deg);
  transition: width 0.3s;
}

.article-card:hover::after {
  width: 40px;
}

.card-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(201, 169, 110, 0.1);
  color: var(--accent-gold-light);
  letter-spacing: 1px;
  border: 1px solid rgba(201, 169, 110, 0.2);
  align-self: flex-start;
}

.card-image {
  width: 100%;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(28, 42, 62, 0.8), rgba(18, 28, 44, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-image svg,
.card-svg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-excerpt {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 8px;
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-stats {
  display: flex;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.like-btn {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s, transform 0.15s;
}
.like-btn:hover {
  transform: scale(1.15);
}
.like-btn:active {
  transform: scale(0.95);
}

.read-more {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--accent-gold-light);
  font-weight: 500;
  letter-spacing: 1px;
  transition: letter-spacing 0.3s;
}

.article-card:hover .read-more {
  letter-spacing: 2px;
}

/* ========== 文章详情弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

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

.modal-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 36px 32px;
  position: relative;
  animation: slideUp 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(201, 169, 110, 0.15);
  color: var(--accent-gold-light);
  border-color: rgba(201, 169, 110, 0.3);
}

.modal-tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(201, 169, 110, 0.1);
  color: var(--accent-gold-light);
  letter-spacing: 1px;
  border: 1px solid rgba(201, 169, 110, 0.2);
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 14px;
  line-height: 1.4;
}

.modal-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(201, 169, 110, 0.12);
  flex-wrap: wrap;
}

.modal-image {
  margin: 16px 0 20px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.modal-image .card-svg-img {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: cover;
  display: block;
}

.modal-body {
  font-size: 0.92rem;
  line-height: 2;
  color: #c8ccd4;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-body p {
  margin-bottom: 1em;
}

/* ========== 分页导航 ========== */
.modal-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(201, 169, 110, 0.1);
}

.page-btn {
  padding: 8px 20px;
  border-radius: 20px;
  background: rgba(201, 169, 110, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--accent-gold-light);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 1px;
  font-family: inherit;
}

.page-btn:hover:not([disabled]) {
  background: rgba(201, 169, 110, 0.2);
  border-color: rgba(201, 169, 110, 0.35);
}

.page-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 56px;
  text-align: center;
  letter-spacing: 1px;
}

/* ========== 底部信息 ========== */
.modal-stats {
  display: flex;
  gap: 20px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(201, 169, 110, 0.12);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ========== 页脚 ========== */
.footer {
  text-align: center;
  padding: 32px 0 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  margin-top: 48px;
}

/* ========== 卡片操作按钮 ========== */
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(201, 169, 110, 0.08);
}

.card-edit-btn,
.card-del-btn {
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 0.72rem;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(201, 169, 110, 0.06);
  color: var(--accent-gold-light);
  font-family: inherit;
  transition: all 0.2s;
}

.card-edit-btn:hover {
  background: rgba(201, 169, 110, 0.18);
  border-color: rgba(201, 169, 110, 0.35);
}

.card-del-btn {
  background: rgba(220, 80, 80, 0.06);
  border-color: rgba(220, 80, 80, 0.15);
  color: #d47070;
}

.card-del-btn:hover {
  background: rgba(220, 80, 80, 0.18);
  border-color: rgba(220, 80, 80, 0.35);
}

.card-actions .read-more {
  margin-left: auto;
}

/* 本地文章卡片占位图 */
.card-image-placeholder {
  height: 140px;
  background: linear-gradient(135deg, rgba(201,169,110,0.08), rgba(44,95,138,0.08));
  border-bottom: 1px solid var(--border-subtle);
}

/* ========== 文章编辑器弹窗 ========== */
.editor-panel {
  max-width: 700px;
}

.editor-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.editor-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.editor-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.editor-input:focus {
  border-color: var(--accent-gold-light);
}

.editor-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.editor-content {
  min-height: 200px;
  line-height: 1.8;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
}

.editor-btn {
  padding: 10px 28px;
  border-radius: 20px;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  border: 1px solid var(--border-subtle);
}

.editor-btn-cancel {
  background: transparent;
  color: var(--text-secondary);
}

.editor-btn-cancel:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.editor-btn-save {
  background: rgba(201, 169, 110, 0.15);
  color: var(--accent-gold-light);
  border-color: rgba(201, 169, 110, 0.3);
  font-weight: 600;
}

.editor-btn-save:hover {
  background: rgba(201, 169, 110, 0.28);
  border-color: rgba(201, 169, 110, 0.5);
}

.editor-btn-del:hover {
  background: rgba(220, 80, 80, 0.22) !important;
  border-color: rgba(220, 80, 80, 0.5) !important;
}

/* ========== 草稿管理列表 ========== */
.draft-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.draft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s;
}

.draft-item:hover {
  border-color: rgba(201, 169, 110, 0.25);
}

.draft-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.draft-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.draft-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.draft-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 16px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .app-container { padding: 14px 14px 40px; }
  .navbar { gap: 10px; }
  .nav-brand { font-size: 1.3rem; }
  .article-grid { grid-template-columns: 1fr; }
  .modal-panel { padding: 24px 18px; }
  .modal-title { font-size: 1.2rem; }
  .user-bio { display: none; }
}

@media (max-width: 400px) {
  .card-meta { flex-direction: column; align-items: flex-start; }
}
