/* ============================================================
   咸鱼社区 v2 体验增强样式 enhance.css

   【部署要求】主 Agent 需在 layout_header.php 中引入（style.css 之后）：
     <link rel="stylesheet" href="/static/css/enhance.css?v=4">
   配套 JS：static/js/app.js（v2 增量段）与 static/js/uploader.js
   ============================================================ */

/* ---------- 回顶部按钮（app.js 增量段动态创建） ---------- */
.back-top {
  display: none;
  position: fixed;
  right: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px)); /* 避开移动导航 */
  z-index: 900;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #444;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.back-top.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}
.back-top:hover { background: #fff; color: #111; }
.back-top:active { transform: scale(.94); }

@media (max-width: 768px) {
  .back-top { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- 图片上传 loading 态（编辑器工具栏 [data-wrap=img]） ---------- */
.editor-toolbar button {
  position: relative;
}
.editor-toolbar button.up-loading {
  color: transparent !important;          /* 隐藏文字，露出转圈 */
  pointer-events: none;
  opacity: .85;
}
.editor-toolbar button.up-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--c-accent, #2b5cd9);
  animation: xy-spin .7s linear infinite;
}
@keyframes xy-spin {
  to { transform: rotate(360deg); }
}

/* ---------- 只看楼主隐藏楼层 ---------- */
.floor.hidden-by-op { display: none; }

/* ---------- 只看楼主按钮激活态 ---------- */
#onlyOP.on {
  background: var(--c-accent-soft, #eef3ff);
  color: var(--c-accent, #2b5cd9);
  border-color: var(--c-accent, #2b5cd9);
}

/* ---------- 字数计数超限 ---------- */
#charCount.over { color: var(--c-err, #d93025); font-weight: 600; }

/* ---------- 小屏：编辑器工具栏按钮增大（≥40px 高），减少误触 ---------- */
@media (max-width: 768px) {
  .editor-toolbar button {
    min-height: 40px;
    min-width: 40px;
    padding: 8px 12px;
    font-size: 14px;
  }
  .textarea {
    font-size: 16px; /* ≥16px 防 iOS 聚焦自动放大 */
  }
}

/* ---------- 聚焦键盘相关微调 ---------- */
.textarea:focus,
.input:focus {
  outline: none;
  border-color: var(--c-accent, #2b5cd9);
}
/* 键盘弹起时输入区贴底不留死区 */
#reply { scroll-margin-bottom: 12px; }
.textarea { scroll-margin-bottom: 24px; }
