/* ============================================================
   Hakimi 博客 - 全局样式
   ============================================================ */

/* ---------- 自定义字体 ---------- */
@font-face {
  font-family: "HakimiFont";
  src: url("../1.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

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

input, textarea, select, button, select option {
  font-family: "HakimiFont", -apple-system, BlinkMacSystemFont, sans-serif;
}

input::placeholder, textarea::placeholder {
  font-family: "HakimiFont", -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: "HakimiFont", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f6f8;
  color: #1a1a2e;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: #2d6ff7;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---------- 导航栏 ---------- */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e2e5ea;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.navbar .brand {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  margin-right: 32px;
  white-space: nowrap;
}
.navbar .brand:hover {
  text-decoration: none;
}
.navbar nav {
  display: flex;
  gap: 4px;
  flex: 1;
}
.navbar nav a {
  padding: 6px 16px;
  border-radius: 6px;
  color: #555;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.navbar nav a:hover {
  background: #eef2ff;
  color: #2d6ff7;
  text-decoration: none;
}
.navbar nav a.active {
  background: #eef2ff;
  color: #2d6ff7;
  font-weight: 600;
}
.navbar .user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.navbar .user-area .unread-badge {
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  display: none;
}
.navbar .user-area .unread-badge.show {
  display: inline-block;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
  color: #333;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  border-color: #2d6ff7;
  box-shadow: 0 0 0 3px rgba(45,111,247,0.12);
  text-decoration: none;
}
.btn:focus {
  outline: 2px solid #2d6ff7;
  outline-offset: 2px;
}
.btn-primary {
  background: #2d6ff7;
  color: #fff;
  border-color: #2d6ff7;
}
.btn-primary:hover {
  background: #1a5ae0;
  border-color: #1a5ae0;
  box-shadow: 0 0 0 3px rgba(45,111,247,0.2);
}
.btn-danger {
  background: #e53e3e;
  color: #fff;
  border-color: #e53e3e;
}
.btn-danger:hover {
  background: #c53030;
  border-color: #c53030;
  box-shadow: 0 0 0 3px rgba(229,62,62,0.2);
}
.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 6px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- 容器 ---------- */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}
.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ---------- 卡片 ---------- */
.card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e5ea;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: box-shadow 0.15s;
}
.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ---------- 表单 ---------- */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  background: #fff;
  color: #1a1a2e;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #2d6ff7;
  box-shadow: 0 0 0 3px rgba(45,111,247,0.1);
}
.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* ---------- Toast 提示 ---------- */
.toast {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 999;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  animation: toastIn 0.25s ease;
  max-width: 360px;
}
.toast-success { background: #e6fffa; color: #234e52; border: 1px solid #81e6d9; }
.toast-error   { background: #fff5f5; color: #822727; border: 1px solid #feb2b2; }
.toast-info    { background: #ebf4ff; color: #2a4365; border: 1px solid #90cdf4; }

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

/* ---------- 加载动画 ---------- */
.loading {
  text-align: center;
  padding: 32px;
  color: #888;
}
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid #e2e5ea;
  border-top-color: #2d6ff7;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden {
  display: none;
}
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.modal-box h2 {
  font-size: 18px;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: #eef2ff;
  color: #2d6ff7;
  margin-right: 6px;
  margin-bottom: 4px;
}

/* ---------- 下拉菜单 ---------- */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid #e2e5ea;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  min-width: 180px;
  padding: 6px 0;
  z-index: 150;
  display: none;
}
.dropdown-menu.show {
  display: block;
}
.dropdown-menu a,
.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  font-size: 14px;
  color: #1a1a2e;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.dropdown-menu a:hover,
.dropdown-menu button:hover {
  background: #f5f6f8;
  text-decoration: none;
}

/* ---------- 文章列表项 ---------- */
.article-item h3 {
  font-size: 17px;
  margin-bottom: 6px;
}
.article-item h3 a {
  color: #1a1a2e;
}
.article-item h3 a:hover {
  color: #2d6ff7;
  text-decoration: none;
}
.article-meta {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}
.article-excerpt {
  font-size: 14px;
  color: #555;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-tags {
  margin-bottom: 8px;
}

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #999;
  font-size: 14px;
}

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}
.pagination button {
  padding: 6px 14px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.pagination button:hover {
  border-color: #2d6ff7;
}
.pagination button.active {
  background: #2d6ff7;
  color: #fff;
  border-color: #2d6ff7;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .container, .container-wide { padding: 16px 12px; }
  .navbar { padding: 0 12px; }
  .navbar .brand { margin-right: 16px; font-size: 16px; }
  .navbar nav a { padding: 6px 10px; font-size: 13px; }
}
