/* ============================================================
   macOS 风格共享样式（文章 / 帖子相关页面）
   通过 body.mac-theme 作用域隔离，避免影响头部导航与页脚。
   文章系强调色 #16a34a，帖子系强调色 #2563eb（由页面 body 的 --mac-accent 覆盖）。
   ============================================================ */

/* ---------- 基础变量与全局 ---------- */
body.mac-theme {
  --mac-accent: #16a34a;      /* 默认强调色（绿色），帖子页在 body 上覆盖为蓝色 */
  --mac-bg: #f5f5f7;
  --mac-border: rgba(0, 0, 0, 0.06);
  --mac-border-strong: rgba(0, 0, 0, 0.12);
  --mac-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --mac-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.10);
  --mac-radius: 18px;
  --mac-font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
              "PingFang SC", "Segoe UI", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

body.mac-theme {
  font-family: var(--mac-font);
  background-color: var(--mac-bg) !important;
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.mac-theme h1 {
  letter-spacing: -0.02em;
  color: #1d1d1f;
}

/* ---------- 卡片统一风格 ---------- */
body.mac-theme .bg-white.rounded-lg {
  border-radius: var(--mac-radius);
  border: 1px solid var(--mac-border);
  box-shadow: var(--mac-shadow);
}

/* ---------- macOS 窗口红绿灯装饰 ---------- */
body.mac-theme #articles-container,
body.mac-theme #posts-container,
body.mac-theme .bg-white.rounded-lg.shadow-md.mb-6:not(.p-4),
body.mac-theme .bg-white.rounded-lg.shadow-md.p-6.mb-6,
body.mac-theme .bg-white.rounded-lg.shadow-md.p-6:not(.mb-6) {
  position: relative;
  padding-top: 46px;
}
body.mac-theme #articles-container::before,
body.mac-theme #posts-container::before,
body.mac-theme .bg-white.rounded-lg.shadow-md.mb-6:not(.p-4)::before,
body.mac-theme .bg-white.rounded-lg.shadow-md.p-6.mb-6::before,
body.mac-theme .bg-white.rounded-lg.shadow-md.p-6:not(.mb-6)::before {
  content: '';
  position: absolute;
  top: 17px;
  left: 18px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 19px 0 0 #febc2e, 38px 0 0 #28c840;
}

/* ---------- 顶部标签导航（胶囊） ---------- */
body.mac-theme .tab-link {
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  margin: 8px 4px;
  padding: 6px 16px;
  transition: all 0.2s ease;
}
body.mac-theme .tab-link.bg-green-600,
body.mac-theme .tab-link.bg-blue-600 {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
body.mac-theme .tab-link:not(.bg-green-600):not(.bg-blue-600) {
  color: #48484a;
}
body.mac-theme .tab-link:not(.bg-green-600):not(.bg-blue-600):hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
  color: #1d1d1f;
}

/* ---------- 强调色按钮（胶囊 + 柔和阴影） ---------- */
body.mac-theme a.bg-green-600,
body.mac-theme button.bg-green-600,
body.mac-theme a.bg-blue-600,
body.mac-theme button.bg-blue-600 {
  border-radius: 9999px !important;
  box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.30);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
body.mac-theme a.bg-green-600:hover,
body.mac-theme button.bg-green-600:hover,
body.mac-theme a.bg-blue-600:hover,
body.mac-theme button.bg-blue-600:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.35);
}

/* ---------- 输入框 / 下拉框 / 文本域 ---------- */
body.mac-theme input[type="text"],
body.mac-theme input[type="number"],
body.mac-theme input[type="search"],
body.mac-theme select,
body.mac-theme textarea {
  border-radius: 12px !important;
  border-color: var(--mac-border-strong) !important;
  background-color: rgba(0, 0, 0, 0.02) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
body.mac-theme input[type="text"]:focus,
body.mac-theme input[type="number"]:focus,
body.mac-theme input[type="search"]:focus,
body.mac-theme select:focus,
body.mac-theme textarea:focus {
  border-color: var(--mac-accent) !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08) !important;
}

/* ---------- 分页（胶囊） ---------- */
body.mac-theme .pagination-link {
  border-radius: 9999px !important;
  border-color: rgba(0, 0, 0, 0.10) !important;
  min-width: 32px;
  text-align: center;
  transition: all 0.2s ease;
}
body.mac-theme .pagination-link:hover {
  border-color: var(--mac-accent) !important;
  color: var(--mac-accent) !important;
  background-color: rgba(0, 0, 0, 0.03);
}

/* ---------- 文章 / 帖子列表项 ---------- */
body.mac-theme .article-item,
body.mac-theme .post-item {
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}
body.mac-theme .article-item:hover,
body.mac-theme .post-item:hover {
  background-color: #fafafa !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.12);
}
body.mac-theme .article-item img,
body.mac-theme .post-item img {
  border-radius: 12px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
body.mac-theme .divide-gray-200 > * + * {
  border-color: rgba(0, 0, 0, 0.06) !important;
}

/* ---------- 侧栏列表项 ---------- */
body.mac-theme a[class*="hover:bg-gray-50"].block {
  border-radius: 10px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
body.mac-theme a[class*="hover:bg-gray-50"].block:hover {
  background-color: #f5f5f7 !important;
  transform: translateX(2px);
}

/* ---------- 详情页正文排版 ---------- */
body.mac-theme .article-content,
body.mac-theme .post-content {
  font-size: 16px;
  line-height: 1.85;
  color: #3a3a3c;
  word-break: break-word;
}
body.mac-theme .article-content p,
body.mac-theme .post-content p {
  margin-bottom: 1.15em;
}
body.mac-theme .article-content h1,
body.mac-theme .article-content h2,
body.mac-theme .article-content h3,
body.mac-theme .article-content h4,
body.mac-theme .article-content h5,
body.mac-theme .article-content h6,
body.mac-theme .post-content h1,
body.mac-theme .post-content h2,
body.mac-theme .post-content h3,
body.mac-theme .post-content h4,
body.mac-theme .post-content h5,
body.mac-theme .post-content h6 {
  color: #1d1d1f;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
}
body.mac-theme .article-content h1, body.mac-theme .post-content h1 { font-size: 1.6em; }
body.mac-theme .article-content h2, body.mac-theme .post-content h2 { font-size: 1.4em; }
body.mac-theme .article-content h3, body.mac-theme .post-content h3 { font-size: 1.25em; }
body.mac-theme .article-content ul,
body.mac-theme .article-content ol,
body.mac-theme .post-content ul,
body.mac-theme .post-content ol {
  padding-left: 1.4em;
  margin-bottom: 1.15em;
}
body.mac-theme .article-content ul, body.mac-theme .post-content ul { list-style: disc; }
body.mac-theme .article-content ol, body.mac-theme .post-content ol { list-style: decimal; }
body.mac-theme .article-content blockquote,
body.mac-theme .post-content blockquote {
  border-left: 3px solid var(--mac-accent);
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin: 1.2em 0;
  color: #515154;
}
body.mac-theme .article-content pre,
body.mac-theme .post-content pre {
  background-color: #f2f2f4;
  border: 1px solid var(--mac-border);
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 1.2em 0;
}
body.mac-theme .article-content code,
body.mac-theme .post-content code {
  font-family: "SF Mono", "Menlo", Consolas, "Liberation Mono", monospace;
  background-color: rgba(0, 0, 0, 0.06);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 0.9em;
}
body.mac-theme .article-content pre code,
body.mac-theme .post-content pre code {
  background: transparent;
  padding: 0;
}
body.mac-theme .article-content img,
body.mac-theme .post-content img {
  border-radius: 12px;
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
body.mac-theme .article-content a,
body.mac-theme .post-content a {
  color: var(--mac-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.mac-theme .article-content table,
body.mac-theme .post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 14px;
}
body.mac-theme .article-content th,
body.mac-theme .article-content td,
body.mac-theme .post-content th,
body.mac-theme .post-content td {
  border: 1px solid rgba(0, 0, 0, 0.10);
  padding: 8px 12px;
  text-align: left;
}
body.mac-theme .article-content th,
body.mac-theme .post-content th {
  background-color: rgba(0, 0, 0, 0.03);
  font-weight: 600;
}

/* ---------- 评论区 ---------- */
body.mac-theme .rounded-full.bg-gray-200 {
  background: linear-gradient(135deg, #ececf0, #dedee3) !important;
}
body.mac-theme .rounded-full.bg-gray-200 i {
  color: #8e8e93 !important;
}
body.mac-theme .text-gray-500 {
  color: #6e6e73;
}

/* ---------- 发布页编辑器 ---------- */
body.mac-theme #richEditor .bg-gray-100 {
  background-color: #f2f2f4 !important;
  border-color: var(--mac-border-strong) !important;
  border-radius: 12px 12px 0 0 !important;
}
body.mac-theme .editor-content {
  border-color: var(--mac-border-strong) !important;
  border-radius: 0 0 12px 12px !important;
  background-color: #ffffff !important;
  font-size: 15px;
  line-height: 1.7;
}
body.mac-theme .editor-content:focus {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06) !important;
  border-color: var(--mac-accent) !important;
}
body.mac-theme .toolbar-btn {
  border-radius: 8px;
  transition: background-color 0.15s ease;
}
body.mac-theme .toolbar-btn:hover {
  background-color: #e4e4e9 !important;
}
body.mac-theme .toolbar-separator {
  border-left-color: rgba(0, 0, 0, 0.10) !important;
}
body.mac-theme #markdownPreview {
  background-color: #fafafa !important;
}

/* ---------- 页面标题行（移动端换行） ---------- */
body.mac-theme .max-w-6xl.mx-auto > .flex,
body.mac-theme .max-w-4xl.mx-auto > .flex {
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- 滚动条（macOS 风格） ---------- */
body.mac-theme ::-webkit-scrollbar { width: 8px; height: 8px; }
body.mac-theme ::-webkit-scrollbar-track { background: transparent; }
body.mac-theme ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 9999px;
}
body.mac-theme ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); }

/* ============================================================
   通知中心 / 站内信 / 个人中心 扩展样式
   ============================================================ */

/* ---------- 列表容器（通知中心 / 站内信）红绿灯装饰 ---------- */
body.mac-theme .bg-white.rounded-lg.shadow-md.min-h-\[60vh\] {
  position: relative;
  padding-top: 46px;
}
body.mac-theme .bg-white.rounded-lg.shadow-md.min-h-\[60vh\]::before {
  content: '';
  position: absolute;
  top: 17px;
  left: 18px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: 19px 0 0 #febc2e, 38px 0 0 #28c840;
}

/* ---------- 列表项 hover / 未读高亮 ---------- */
body.mac-theme .min-h-\[60vh\] .divide-y > div {
  transition: background-color 0.2s ease;
}
body.mac-theme .min-h-\[60vh\] .divide-y > div:hover {
  background-color: #fafafa !important;
}
body.mac-theme .min-h-\[60vh\] .divide-y > div.bg-blue-50 {
  background-color: #eef6fe !important;
}

/* ---------- 未读提示横幅 ---------- */
body.mac-theme .bg-blue-50.border.border-blue-200 {
  background-color: #eef6fe !important;
  border-color: rgba(37, 99, 235, 0.16) !important;
  border-radius: 14px;
}

/* ---------- 站内信标签页（胶囊化） ---------- */
body.mac-theme .border-b.border-gray-200.mb-4 {
  border-bottom: none !important;
}
body.mac-theme .border-b.border-gray-200.mb-4 nav {
  gap: 6px;
}
body.mac-theme .border-b.border-gray-200.mb-4 nav a {
  border: none !important;
  border-radius: 9999px !important;
  padding: 7px 16px !important;
  margin: 4px 0 !important;
  transition: all 0.2s ease;
  white-space: nowrap;
}
body.mac-theme .border-b.border-gray-200.mb-4 nav a.border-blue-600 {
  background-color: var(--mac-accent);
  color: #ffffff;
}
body.mac-theme .border-b.border-gray-200.mb-4 nav a:not(.border-blue-600) {
  color: #48484a;
}
body.mac-theme .border-b.border-gray-200.mb-4 nav a:not(.border-blue-600):hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
}

/* ---------- 次要按钮（描边 / 灰色）胶囊化 ---------- */
body.mac-theme a.border.border-gray-300,
body.mac-theme button.border.border-gray-300 {
  border-radius: 9999px !important;
  transition: all 0.2s ease;
}
body.mac-theme a.border.border-gray-300:hover,
body.mac-theme button.border.border-gray-300:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
}
body.mac-theme a.bg-gray-200,
body.mac-theme button.bg-gray-200,
body.mac-theme a.bg-gray-600,
body.mac-theme button.bg-gray-600 {
  border-radius: 9999px !important;
  transition: all 0.2s ease;
}
body.mac-theme a.bg-gray-200:hover,
body.mac-theme button.bg-gray-200:hover {
  background-color: #e4e4e9 !important;
}

/* ---------- 消息详情正文 ---------- */
body.mac-theme .prose {
  font-size: 15px;
  line-height: 1.8;
  color: #3a3a3c;
  word-break: break-word;
}
body.mac-theme .prose p { margin-bottom: 1em; }
body.mac-theme .prose img {
  border-radius: 12px;
  max-width: 100%;
  height: auto;
  margin: 14px 0;
}
body.mac-theme .prose a { color: var(--mac-accent); }

/* ---------- 个人中心 ---------- */
body.mac-theme .w-32.h-32.rounded-full {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
}
body.mac-theme .bg-white.rounded-lg.shadow-md.p-4.text-center {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
body.mac-theme .bg-white.rounded-lg.shadow-md.p-4.text-center:hover {
  transform: translateY(-2px);
  box-shadow: var(--mac-shadow-hover);
}
body.mac-theme .bg-white.rounded-lg.shadow-md.p-6 a[class*="font-medium"] {
  transition: color 0.15s ease;
}
body.mac-theme .bg-white.rounded-lg.shadow-md.p-6 a[class*="font-medium"]:hover {
  color: var(--mac-accent) !important;
}

/* ---------- 通知设置开关微调（iOS 风格） ---------- */
body.mac-theme .relative.inline-flex.items-center.cursor-pointer > div {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}
