/* ============================================================
   assets/css/modal.css
   弹出层样式（居中卡片 · 双栏布局）
   ============================================================ */

/* 小屏彻底禁用模态 */
@media (max-width: 1023px) {
  .zl-modal,
  .zl-modal.open { display: none !important; }
}

/* ---------- 遮罩 ---------- */
.zl-modal {
  position: fixed; inset: 0;
  z-index: 9999;
  display: none;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow: hidden;
}
.zl-modal.open {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px;
  animation: zlModalFadeIn .25s ease;
}
@keyframes zlModalFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 卡片容器 ---------- */
.zl-modal-panel {
  position: relative;
  width: 100%; max-width: 1200px;
  max-height: calc(100vh - 64px);
  background: var(--bg);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .4);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: zlModalSlideUp .3s cubic-bezier(.2, .8, .2, 1);
}
@keyframes zlModalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 顶部工具栏 ---------- */
.zl-modal-toolbar {
  flex-shrink: 0;
  height: 56px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.zl-modal-close {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: .2s; cursor: pointer;
}
.zl-modal-close:hover { color: var(--accent); border-color: var(--accent); }
.zl-modal-title {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 600;
  color: var(--text-2);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; text-align: center;
}
.zl-modal-toolbar-actions { display: flex; gap: 6px; }
.zl-modal-nav {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: .2s;
}
.zl-modal-nav:hover:not(.disabled) {
  color: var(--accent); border-color: var(--accent);
}
.zl-modal-nav.disabled { opacity: .35; cursor: not-allowed; }

/* ---------- 主体滚动区 ---------- */
.zl-modal-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.zl-modal-body::-webkit-scrollbar { width: 8px; }
.zl-modal-body::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 4px;
}
.zl-modal-body::-webkit-scrollbar-track { background: transparent; }

/* ---------- 双栏布局 ---------- */
.zl-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  padding: 36px 44px 52px;
}
.zl-modal-main { min-width: 0; }
.zl-modal-side {
  display: flex; flex-direction: column; gap: 14px;
}

.zl-side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.zl-side-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.zl-side-head h4 {
  font-size: 14px; font-weight: 700;
  margin: 0; letter-spacing: -.01em;
}
.zl-comments-count {
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}

/* ---------- 左栏：文章头部 ---------- */
.zl-post-header { margin-bottom: 28px; }
.zl-post-title {
  font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.28; letter-spacing: -.03em;
  margin: 12px 0 0;
}
.zl-post-meta {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-top: 22px;
  padding-bottom: 22px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; color: var(--text-3);
}
.zl-meta-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.zl-meta-author { color: var(--text); font-weight: 600; }

/* ---------- 左栏：正文 ---------- */
.zl-modal .article-content {
  font-size: 16.5px; line-height: 1.9; max-width: none;
}
.zl-modal .article-content h2 { font-size: 24px; }
.zl-modal .article-content h3 { font-size: 19px; }

/* ---------- 左栏：标签与操作 ---------- */
.zl-post-tags {
  margin-top: 36px; padding-top: 24px;
  border-top: 1px solid var(--border);
}
.zl-post-actions { margin-top: 18px; }
.zl-post-nav { margin-top: 28px; }

/* ---------- 相关文章 ---------- */
.zl-related {
  margin-top: 40px; padding-top: 28px;
  border-top: 1px solid var(--border);
}
.zl-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.zl-section-head h3 {
  font-size: 16px; font-weight: 700;
  margin: 0;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: -.01em;
}
.zl-section-head h3::before {
  content: ''; width: 4px; height: 14px;
  border-radius: 2px; background: var(--accent);
}
.zl-related-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.zl-related-item { list-style: none; margin: 0; padding: 0; }
.zl-related-item a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  transition: .22s; height: 100%; min-height: 68px;
}
.zl-related-item a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.zl-related-thumb {
  flex-shrink: 0; width: 48px; height: 48px;
  border-radius: 8px; overflow: hidden;
  background: var(--surface-2); display: block;
}
.zl-related-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.zl-thumb-fallback {
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), #ffd9c8);
  color: var(--accent);
  font-family: var(--font-serif);
  font-weight: 700; font-size: 18px;
}
.zl-related-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.zl-related-title {
  font-size: 13.5px; font-weight: 600;
  line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  transition: .2s;
}
.zl-related-item a:hover .zl-related-title { color: var(--accent); }
.zl-related-date { font-size: 11.5px; color: var(--text-3); }

/* ---------- 右栏：作者卡片 ---------- */
.zl-author-card { flex-shrink: 0; padding: 16px 18px; }
.zl-author-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.zl-author-identity {
  display: flex; align-items: center; gap: 12px;
  min-width: 0; flex: 1;
}
.zl-author-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.zl-author-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.zl-author-name {
  font-size: 15px; font-weight: 600;
  margin: 0; letter-spacing: -.01em;
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zl-author-role {
  font-size: 11.5px; font-weight: 600;
  color: var(--accent); margin: 0; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zl-author-bio {
  font-size: 11.5px; line-height: 1.5;
  color: var(--text-3); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 1;
  -webkit-box-orient: vertical; overflow: hidden;
}
.zl-author-link {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  padding: 7px 16px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 12.5px; font-weight: 600;
  line-height: 1; border: 0;
  transition: .22s; white-space: nowrap;
}
.zl-author-link:hover {
  background: var(--accent-2); color: #fff;
  transform: translateY(-1px);
}

/* ---------- 右栏：评论卡片（sticky） ---------- */
.zl-comments-card {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 240px);
  padding: 16px 18px;
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: max-height .25s ease;
  will-change: max-height;
}
.zl-comments-card .zl-side-head {
  flex-shrink: 0;
  margin-bottom: 10px;
  padding-bottom: 10px;
}
.zl-comments-body {
  flex: 1 1 auto;
  min-height: 40px;
  max-height: none;
  overflow-y: auto; overflow-x: hidden;
  margin: 0 -6px 10px; padding: 0 6px;
  overscroll-behavior: contain;
}
.zl-comments-body::-webkit-scrollbar { width: 5px; }
.zl-comments-body::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 3px;
}
.zl-comments-body::-webkit-scrollbar-track { background: transparent; }

.zl-comments-empty {
  flex: 1 1 auto;
  min-height: 60px;
  display: flex; align-items: center; justify-content: center;
  padding: 20px 0; text-align: center;
  font-size: 13px; color: var(--text-3);
}
.zl-comments-closed {
  flex-shrink: 0; padding: 12px;
  text-align: center; font-size: 13px;
  color: var(--text-3);
  background: var(--surface-2); border-radius: 10px;
}

/* 弹层评论分页 */
.zl-comments-pagination-slot {
  flex-shrink: 0;
  padding: 4px 0 8px;
}
.zl-comments-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.zl-comments-page {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: .2s;
  line-height: 1.4;
  font-family: inherit;
}
.zl-comments-page:hover:not(.is-disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.zl-comments-page.is-disabled {
  opacity: .45;
  cursor: not-allowed;
}
.zl-comments-pager-info {
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ---------- 弹层评论列表 ---------- */
.zl-modal-comment-list {
  list-style: none; margin: 0; padding: 0;
}
.zl-modal-comment-list > li {
  list-style: none; padding: 10px 0;
}
.zl-modal-comment-list > li:first-child { padding-top: 0; }
.zl-modal-comment-list > li + li {
  border-top: 1px solid var(--border);
}

.zl-modal-comment .comment-inner {
  display: flex; gap: 10px;
}
.zl-modal-comment .comment-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border-radius: 50%;
  line-height: 0;
  background: var(--surface-2);
}
.zl-modal-comment .comment-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 50%;
  margin: 0;
}
.zl-modal-comment .comment-avatar .zl-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}
.zl-modal-comment .children .comment-avatar {
  width: 24px;
  height: 24px;
}
.zl-modal-comment .children .comment-avatar .zl-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.zl-modal-comment .comment-main { flex: 1; min-width: 0; }
.zl-modal-comment .comment-header {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 3px; flex-wrap: wrap;
}
.zl-modal-comment .comment-name {
  font-size: 12.5px; font-weight: 600; line-height: 1.4;
}
.zl-modal-comment .comment-name a { color: var(--text); }
.zl-modal-comment .comment-name a:hover { color: var(--accent); }
.zl-modal-comment .comment-badge {
  padding: 1px 6px; border-radius: 999px;
  font-size: 10px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  line-height: 1.4;
}
.zl-modal-comment .comment-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-left: auto;
  flex-shrink: 0;
}
.zl-modal-comment .comment-text {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.zl-modal-comment .comment-text p { margin: 0 0 .45em; }
.zl-modal-comment .comment-text p:last-child { margin-bottom: 0; }
.zl-modal-comment .comment-text a {
  color: var(--accent);
  border-bottom: 1px solid rgba(228, 87, 46, .3);
}
.zl-modal-comment .comment-text code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--code-bg);
  padding: .06em .28em;
  border-radius: 3px;
  color: var(--accent);
}

.zl-modal-comment .children {
  list-style: none;
  margin: 8px 0 0;
  padding-left: 30px;
  position: relative;
}
.zl-modal-comment .children::before {
  content: '';
  position: absolute;
  left: 10px; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
}
.zl-modal-comment .children > li {
  list-style: none; padding: 6px 0;
}
.zl-modal-comment .children > li:first-child { padding-top: 0; }
.zl-modal-comment .children > li + li {
  border-top: 1px solid var(--border);
}
.zl-modal-comment .children .children {
  margin-top: 6px; padding-left: 24px;
}
.zl-modal-comment .children .children::before { left: 8px; }
.zl-modal-comment .children .children > li { padding: 5px 0; }

.zl-modal-comment .children .comment-inner { gap: 8px; }
.zl-modal-comment .children .comment-name { font-size: 12px; }
.zl-modal-comment .children .comment-text { font-size: 12px; line-height: 1.6; }

/* 待审核 */
.zl-modal-comment .comment-badge-pending {
  background: #fff8e1;
  color: #b45309;
}
.zl-modal-comment .zl-comment-awaiting {
  font-size: 11.5px;
  color: #b45309;
  margin: 4px 0 0;
  line-height: 1.5;
}

/* ---------- 弹层评论表单 ---------- */
.zl-comments-form-wrap {
  flex-shrink: 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.zl-modal-comment-form {
  display: flex; flex-direction: column; gap: 8px;
}
.zl-form-logged { font-size: 12.5px; color: var(--text-3); margin: 0; }

.zl-form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.zl-form-field {
  position: relative;
  display: flex; flex-direction: column;
}
.zl-form-field-full { width: 100%; }

.zl-modal-comment-form input[type="text"],
.zl-modal-comment-form input[type="email"],
.zl-modal-comment-form input[type="url"],
.zl-modal-comment-form textarea {
  width: 100%;
  padding: 7px 22px 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  font-family: inherit; font-size: 12.5px;
  outline: none; transition: .2s; line-height: 1.5;
}
.zl-modal-comment-form textarea {
  min-height: 64px;
  padding: 9px 22px 9px 10px;
  resize: vertical;
  line-height: 1.6;
}
.zl-modal-comment-form input:focus,
.zl-modal-comment-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.zl-modal-comment-form input::placeholder,
.zl-modal-comment-form textarea::placeholder {
  color: var(--text-3);
  font-size: 12.5px;
}

.zl-required-mark {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  pointer-events: none;
  line-height: 1;
}
.zl-required-mark-textarea {
  top: 12px;
  transform: none;
}

/* 验证码行：输入框 + 图片 + 提交按钮 */
.zl-captcha-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.zl-captcha-row-admin {
  justify-content: flex-end;
}
.zl-captcha-input {
  flex: 1 1 60px;
  min-width: 0;
  height: 32px;
  padding: 6px 10px !important;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px !important;
  letter-spacing: 1px;
  outline: none;
  transition: .2s;
  line-height: 1.4;
}
.zl-captcha-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.zl-captcha-input::placeholder {
  letter-spacing: 0;
  color: var(--text-3);
  font-size: 12px;
}
.zl-captcha-img {
  flex-shrink: 0;
  height: 32px;
  width: auto;
  min-width: 82px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: block;
  background: var(--surface-2);
  transition: .2s;
  object-fit: cover;
}
.zl-captcha-img:hover {
  border-color: var(--accent);
}

.zl-form-submit {
  flex-shrink: 0;
  height: 32px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  transition: .25s;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.zl-form-submit:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.zl-form-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.zl-comment-tip {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
}
.zl-comment-tip-success {
  background: rgba(47, 158, 99, .12);
  color: #2f9e63;
}
.zl-comment-tip-error {
  background: rgba(228, 87, 46, .12);
  color: var(--accent);
}

/* ---------- 加载 / 错误 ---------- */
.zl-modal-loading {
  display: grid; place-items: center;
  min-height: 40vh; padding: 60px 0;
}
.zl-modal-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: zlSpin .8s linear infinite;
}
@keyframes zlSpin { to { transform: rotate(360deg); } }
.zl-modal-error {
  text-align: center; padding: 80px 20px;
  color: var(--text-3); font-size: 15px;
}
.zl-modal-error a { color: var(--accent); text-decoration: underline; }

/* ---------- 悬浮箭头 ---------- */
.zl-modal-float {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  box-shadow: var(--shadow-md);
  cursor: pointer; transition: .25s; z-index: 11;
}
.zl-modal-float:hover:not(.disabled) {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
  transform: translateY(-50%) scale(1.08);
}
.zl-modal-float.disabled { opacity: 0; pointer-events: none; }
.zl-modal-float-prev { left: -56px; }
.zl-modal-float-next { right: -56px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1300px) {
  .zl-modal-float-prev { left: 8px; }
  .zl-modal-float-next { right: 8px; }
}
@media (max-width: 1200px) {
  .zl-modal-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px; padding: 32px 32px 44px;
  }
}
@media (max-width: 1100px) {
  .zl-modal-layout {
    grid-template-columns: 1fr;
    gap: 28px; padding: 28px 28px 40px;
  }
  .zl-modal-side {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  }
  .zl-comments-card {
    position: static; max-height: none; overflow: visible;
  }
  .zl-comments-body { flex: none; max-height: 380px; }
  .zl-comments-empty { flex: none; min-height: 80px; }
}
@media (max-width: 900px) {
  .zl-modal-float { display: none; }
  .zl-modal-side { grid-template-columns: 1fr; }
  .zl-related-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .zl-modal.open { padding: 16px; }
  .zl-modal-layout { padding: 24px 20px 36px; }
  .zl-modal-close span { display: none; }
  .zl-modal-close {
    padding: 8px; width: 34px; height: 34px;
    justify-content: center;
  }
}
/* 弹层评论表单：已登录用户信息行 */
.zl-form-logged-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 2px;
}
.zl-form-logged-user .zl-avatar,
.zl-form-logged-user .zl-avatar-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.zl-form-logged-user .zl-avatar-img {
  object-fit: cover;
  display: block;
}
.zl-form-logged-user .zl-form-logged {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.4;
}
.zl-modal-comment .comment-name .comment-author-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: .2s;
}
.zl-modal-comment .comment-name .comment-author-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
/* 弹层新评论高亮 */
.zl-modal-comment-list > li.zl-comment-new {
  animation: zlCommentHighlight 2.4s ease;
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
}

@keyframes zlCommentHighlight {
  0% {
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent-soft);
  }
  60% {
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent-soft);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 2px transparent;
  }
}