/* 自定义样式补充 */

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

/* 代码块样式 */
pre {
  overflow-x: auto;
  max-width: 100%;
}

/* 文章正文样式 */
.article-content {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.article-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: inherit;
}

.article-content h3 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: inherit;
}

.article-content p {
  margin-bottom: 1.25rem;
  line-height: 1.8;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.article-content ul {
  list-style-type: disc;
}

.article-content ol {
  list-style-type: decimal;
}

.article-content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.article-content a {
  color: #059669;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dark .article-content a {
  color: #34d399;
}

.article-content blockquote {
  border-left: 4px solid #059669;
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #4b5563;
  overflow-wrap: break-word;
}

.dark .article-content blockquote {
  border-left-color: #34d399;
  color: #9ca3af;
}

.article-content img {
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  max-width: 100%;
  height: auto;
}

.article-content pre {
  background: #1f2937;
  color: #e5e7eb;
  padding: 1.25rem;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.7;
  overflow-x: auto;
  max-width: 100%;
}

.article-content code {
  background: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  word-break: break-word;
}

.dark .article-content code {
  background: #374151;
  color: #e5e7eb;
}

.article-content pre code {
  background: none;
  padding: 0;
}

/* 搜索框动画 */
.search-input:focus {
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

/* 卡片悬停效果 */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
}

/* 标签样式 */
.tag {
  transition: all 0.15s ease;
}

.tag:hover {
  transform: scale(1.05);
}

/* 导航链接下划线动画 */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #059669;
  transition: width 0.2s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* 阅读进度条 */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #059669, #10b981);
  z-index: 60;
  transition: width 0.1s;
}

/* 防止内容撑开页面 */
body {
  overflow-wrap: break-word;
}

/* 自定义滚动条 - 桌面端 */
@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 8px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
  }

  .dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
  }

  .dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
  }
}

/* 移动端隐藏滚动条 */
@media (max-width: 767px) {
  ::-webkit-scrollbar {
    display: none;
  }

  body {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
}

/* 打字机效果光标 */
.typing-cursor::after {
  content: '|';
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* 渐变文字 */
.gradient-text {
  background: linear-gradient(135deg, #059669 0%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 玻璃态效果 */
.glass {
  background: rgba(255, 255, 255, 0.95);
}

@supports (backdrop-filter: blur(8px)) {
  .glass {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

.dark .glass {
  background: rgba(17, 24, 39, 0.95);
}

@supports (backdrop-filter: blur(8px)) {
  .dark .glass {
    background: rgba(17, 24, 39, 0.88);
  }
}

/* 目录固定 */
.toc-fixed {
  position: sticky;
  top: 8rem;
  width: 100%;
}

/* 文章页目录样式 */
.toc-nav {
  position: relative;
}

.toc-nav::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: #e5e7eb;
  border-radius: 1px;
}

.dark .toc-nav::before {
  background: #374151;
}

.toc-nav a {
  position: relative;
  padding-left: 1rem;
  border-left: 2px solid transparent;
  margin-left: 0;
  transition: all 0.2s ease;
}

.toc-nav a:hover {
  color: #059669;
}

.dark .toc-nav a:hover {
  color: #34d399;
}

.toc-nav a.active {
  border-left-color: #059669;
  color: #059669;
  font-weight: 600;
}

.dark .toc-nav a.active {
  border-left-color: #34d399;
  color: #34d399;
}

/* 选中文字样式 */
::selection {
  background: rgba(5, 150, 105, 0.3);
}

/* ==================== emlog 分页样式 ==================== */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.pagination a {
  background: white;
  color: #374151;
  border: 1px solid #e5e7eb;
  text-decoration: none;
}

.dark .pagination a {
  background: #1f2937;
  color: #d1d5db;
  border-color: #374151;
}

.pagination a:hover {
  border-color: #059669;
  color: #059669;
}

.dark .pagination a:hover {
  border-color: #34d399;
  color: #34d399;
}

.pagination span {
  background: #059669;
  color: white;
  border: 1px solid #059669;
}

.dark .pagination span {
  background: #059669;
  border-color: #059669;
}

/* ==================== emlog 评论样式补充 ==================== */
.comment-page {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.comment-page a {
  color: #059669;
  text-decoration: none;
}

.dark .comment-page a {
  color: #34d399;
}

/* ==================== 验证码样式 ==================== */
.captcha-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.captcha-container img {
  border-radius: 0.5rem;
  cursor: pointer;
}

/* ==================== 表情样式 ==================== */
.comment-content img[src*="face"] {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-block;
  vertical-align: middle;
  margin: 0 0.125rem;
}

/* ==================== 表格样式 ==================== */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

.article-content th,
.article-content td {
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  text-align: left;
}

.dark .article-content th,
.dark .article-content td {
  border-color: #374151;
}

.article-content th {
  background: #f9fafb;
  font-weight: 600;
}

.dark .article-content th {
  background: #1f2937;
}

.article-content tr:nth-child(even) {
  background: #f9fafb;
}

.dark .article-content tr:nth-child(even) {
  background: #1f2937;
}

/* ==================== 响应式视频嵌入 ==================== */
.article-content iframe,
.article-content video {
  max-width: 100%;
  border-radius: 0.75rem;
}

/* ==================== 返回顶部按钮 ==================== */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  z-index: 50;
}

.dark #back-to-top {
  background: #1f2937;
  border-color: #374151;
}

#back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* ==================== 认证弹窗样式 ==================== */
.auth-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  z-index: 1090;
  backdrop-filter: blur(2px);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-modal-card {
  width: 100%;
  max-width: 430px;
  background: white;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  padding: 24px;
  position: relative;
}

.dark .auth-modal-card {
  background: #1f2937;
  border-color: #374151;
}

.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #374151;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.dark .auth-modal-close {
  border-color: #374151;
  color: #d1d5db;
}

.auth-modal-close:hover {
  background: #f3f4f6;
}

.dark .auth-modal-close:hover {
  background: #374151;
}

.auth-modal-head h3 {
  margin-bottom: 4px;
  font-size: 22px;
  font-weight: 600;
  color: #111827;
}

.dark .auth-modal-head h3 {
  color: #f9fafb;
}

.auth-modal-head p {
  margin: 0 0 18px 0;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
}

.dark .auth-modal-head p {
  color: #9ca3af;
}

.auth-modal-alert {
  display: none;
  margin-bottom: 14px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: rgba(245, 101, 101, 0.1);
  color: #c53030;
}

.dark .auth-modal-alert {
  background: rgba(252, 129, 129, 0.2);
  color: #feb2b2;
}

.auth-modal-alert.show {
  display: block;
}

.auth-modal-alert.success {
  background: rgba(56, 161, 105, 0.15);
  color: #2f855a;
}

.dark .auth-modal-alert.success {
  background: rgba(72, 187, 120, 0.2);
  color: #9ae6b4;
}

.auth-form-row {
  margin-bottom: 12px;
}

.auth-captcha-row,
.auth-inline-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.auth-captcha-row img {
  width: 110px;
  height: 42px;
  border-radius: 8px;
  cursor: pointer;
  background: #f3f4f6;
}

.dark .auth-captcha-row img {
  background: #374151;
}

.auth-inline-btn {
  margin: 0;
  height: 42px;
  line-height: 1;
  white-space: nowrap;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14px;
}

.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6b7280;
  margin: 2px 0 10px;
  cursor: pointer;
}

.dark .auth-checkbox {
  color: #9ca3af;
}

.auth-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: #059669;
}

.auth-submit {
  width: 100%;
  margin: 4px 0 0;
}

.auth-login-ext {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-login-ext a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.auth-login-ext img {
  display: block;
  max-height: 28px;
}

.auth-submit:disabled,
.auth-inline-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-modal-switch {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
}

.auth-modal-switch a {
  color: #059669;
  text-decoration: none;
}

.dark .auth-modal-switch a {
  color: #34d399;
}

.auth-modal-switch a:hover {
  text-decoration: underline;
}

@media (max-width: 577px) {
  .auth-modal {
    align-items: flex-end;
    padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
  }

  .auth-modal-card {
    max-width: none;
    max-height: min(86vh, 640px);
    border-radius: 16px 16px 12px 12px;
    padding: 18px 16px 16px;
    overflow-y: auto;
  }

  .auth-modal-close {
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
  }

  .auth-captcha-row {
    gap: 8px;
  }

  .auth-captcha-row img {
    width: 96px;
  }

  .auth-inline-row {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-inline-btn {
    width: 100%;
  }

  .auth-login-ext img {
    max-height: 24px;
  }
}

/* ==================== 会员阅读插件兜底样式 ==================== */
.member-read-lock {
  margin: 2rem 0;
  padding: 2rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid #fde68a;
  background: #fffbeb;
  text-align: center;
}

.member-read-lock svg {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: #f59e0b;
}

.member-read-lock h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.member-read-lock p {
  color: #4b5563;
  margin-bottom: 1.5rem;
}

.member-read-lock .member-read-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.member-read-lock .member-read-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.member-read-lock .member-read-actions .btn-login {
  background: #059669;
  color: #fff;
}

.member-read-lock .member-read-actions .btn-login:hover {
  background: #047857;
}

.member-read-lock .member-read-actions .btn-register {
  border: 1px solid #d1d5db;
  color: #374151;
}

.member-read-lock .member-read-actions .btn-register:hover {
  background: #f9fafb;
}

/* dark 模式 */
.dark .member-read-lock {
  background: rgba(120, 53, 15, 0.2);
  border-color: rgba(180, 83, 9, 0.5);
}

.dark .member-read-lock svg {
  color: #fbbf24;
}

.dark .member-read-lock h3 {
  color: #f3f4f6;
}

.dark .member-read-lock p {
  color: #9ca3af;
}

.dark .member-read-lock .member-read-actions .btn-login:hover {
  background: #047857;
}

.dark .member-read-lock .member-read-actions .btn-register {
  border-color: #4b5563;
  color: #d1d5db;
}

.dark .member-read-lock .member-read-actions .btn-register:hover {
  background: #1f2937;
}

@media (min-width: 640px) {
  .member-read-lock .member-read-actions {
    flex-direction: row;
  }
}

/* 会员阅读插件 - 隐藏字数提示 */
.member-read-count {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1.25rem;
}

.member-read-count strong {
  color: #f59e0b;
  font-weight: 600;
}

.dark .member-read-count {
  color: #9ca3af;
}

.dark .member-read-count strong {
  color: #fbbf24;
}
