/* ==========================================================================
   壁纸页样式 — app/static/js/pages/wallpaper.js 专用
   由 index.html 在 app.css 之后引入；所有选择器都以 .wall-page 作用域限定，
   即使 app.css 里的旧 .wall-* 规则被删除或调整，这一页也能独立成立。

   新增类清单（wallpaper.js 使用）：
   - 布局：wall-page / wall-workspace / wall-library / wall-library-head /
           wall-library-title / wall-head-actions / wall-library-note / wall-empty
   - 轮换：wall-rotation / wall-rotate-row / wall-rotate-label /
           wall-rotate-interval / wall-rotate-note / wall-rotate-folder
   - 文件夹：wall-folders / wall-folders-head / wall-folder-list / wall-folder /
             wall-folder-name / wall-folder-create
   - 上传：wall-drop（与 .dropzone 同用）/ wall-drop-key / wall-drop-text /
           wall-drop-target / wall-file-input
   - 批量：wall-bulk / wall-move-folder / wall-select
   - 卡片：wall-grid / wall-card（is-current / is-off / is-selected / is-selecting）/
           wall-thumb / wall-thumb-img / wall-thumb-tags / wall-card-tools /
           wall-rot / wall-more-btn / wall-menu / wall-menu-item / wall-menu-danger /
           wall-card-foot / wall-title / wall-set
   - 编辑抽屉：wall-edit-compare / wall-bar-label / wall-edit-fields /
               wall-edit-note / wall-edit-actions
   ========================================================================== */

/* ---------------------------------------------------------------- 布局 */
.wall-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wall-page .wall-workspace {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.wall-page .wall-library { min-width: 0; }

.wall-page .wall-library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.wall-page .wall-library-title { min-width: 0; }
.wall-page .wall-library-title h2 { font-size: 16px; margin: 0 0 2px; }
.wall-page .wall-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wall-page .wall-library-note { margin: 16px 0 0; }
.wall-page .wall-empty { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- 轮换 */
.wall-page .wall-rotation { margin: 0; }
.wall-page .wall-rotate-row { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.wall-page .wall-rotate-label { font-size: 10px; letter-spacing: 0.16em; color: var(--ink-3); text-transform: uppercase; }
.wall-page .wall-rotate-folder { width: auto; min-width: 170px; max-width: 280px; }
.wall-page .wall-rotate-interval .input { width: 82px; }
.wall-page .wall-rotate-note { margin: 10px 0 0; overflow-wrap: anywhere; }

/* -------------------------------------------------------------- 文件夹 */
.wall-page .wall-folders {
  position: sticky;
  top: 16px;
  padding: 14px 0 8px;
}

.wall-page .wall-folders-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 12px;
}

.wall-page .wall-folders-head h3 { font-size: 13px; }
.wall-page .wall-folder-list { display: flex; flex-direction: column; gap: 3px; padding: 0 6px; }

.wall-page .wall-folder {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.wall-page .wall-folder:hover { background: var(--paper-sunken); }
.wall-page .wall-folder.active { background: var(--ink); color: var(--paper-raised); }
.wall-page .wall-folder .mono { font-size: 10px; opacity: 0.7; }
.wall-page .wall-folder:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wall-page .wall-folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wall-page .wall-folder-create { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.wall-page .wall-folder-create .input { width: 100%; min-width: 0; }

/* ---------------------------------------------------------------- 上传 */
.wall-page .dropzone.wall-drop {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin: 0 0 14px;
  padding: 9px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.16);
  text-align: left;
  cursor: pointer;
}

.wall-page .dropzone.wall-drop:hover,
.wall-page .dropzone.wall-drop.over { border-color: var(--accent); background: var(--accent-wash); }
.wall-page .wall-drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wall-page .wall-drop .wall-drop-key {
  flex: none;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--ink-4);
}

.wall-page .wall-drop .wall-drop-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--ink-2);
}

.wall-page .wall-drop .wall-drop-target {
  flex: none;
  max-width: 42%;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--ink-3);
}

.wall-page .wall-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 批量 */
.wall-page .wall-bulk {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--ink-3);
  border-radius: var(--radius);
  background: var(--paper-raised);
}

.wall-page .wall-bulk[hidden] { display: none; }
.wall-page .wall-move-folder { width: auto; max-width: 190px; }

/* -------------------------------------------------------------- 卡片网格 */
.wall-page .wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.wall-page .wall-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 80ms linear, box-shadow 80ms linear;
}

.wall-page .wall-card:hover,
.wall-page .wall-card:focus-within { z-index: 3; }
.wall-page .wall-card.dragging { opacity: 0.45; }
.wall-page .wall-card.is-current { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); }
.wall-page .wall-card.is-selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.wall-page .wall-card.is-selecting { cursor: pointer; }
.wall-page .wall-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.wall-page .wall-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--device-light);
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}

.wall-page .wall-thumb-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.wall-page .wall-card.is-off .wall-thumb-img { opacity: 0.5; }

.wall-page .wall-thumb-tags {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.wall-page .wall-thumb-tags .tag { position: static; background: var(--paper-raised); }

.wall-page .wall-card-tools {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  display: flex;
  gap: 4px;
}

/* 「⋯」常态隐藏（桌面悬停/聚焦出现），触屏常显 */
.wall-page .wall-more-btn { opacity: 0; }
.wall-page .wall-card:hover .wall-more-btn,
.wall-page .wall-card:focus-within .wall-more-btn { opacity: 1; }

.wall-page .wall-rot,
.wall-page .wall-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper-raised) 88%, transparent);
  color: var(--ink-2);
  font-family: var(--mono);
  line-height: 1;
  cursor: pointer;
  transition: opacity 80ms linear, border-color 80ms linear, background 80ms linear;
}

.wall-page .wall-rot:hover,
.wall-page .wall-more-btn:hover { border-color: var(--ink-4); background: var(--paper-raised); }
.wall-page .wall-rot[disabled],
.wall-page .wall-more-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.wall-page .wall-rot:focus-visible,
.wall-page .wall-more-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 参与轮换：实心点 = 开，空心点 = 关 */
.wall-page .wall-rot::after {
  content: "";
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--ink-4);
  border-radius: 50%;
  background: transparent;
}

.wall-page .wall-rot[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.wall-page .wall-rot[aria-pressed="true"]::after { border-color: var(--accent); background: var(--accent); }
.wall-page .wall-more-btn { padding-bottom: 4px; font-size: 14px; letter-spacing: 0; }

.wall-page .wall-menu {
  position: absolute;
  top: 30px;
  right: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  width: 104px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: 0 10px 28px rgba(43, 48, 42, 0.18);
}

.wall-page .wall-menu[hidden] { display: none; }

.wall-page .wall-menu-item {
  display: block;
  width: 100%;
  padding: 6px 9px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.wall-page .wall-menu-item:hover:not([disabled]) { background: var(--paper-sunken); }
.wall-page .wall-menu-item[disabled] { opacity: 0.45; cursor: not-allowed; }
.wall-page .wall-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wall-page .wall-menu-danger { color: var(--danger); }

.wall-page .wall-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
}

.wall-page .wall-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}

.wall-page .wall-set {
  flex: none;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.wall-page .wall-set:hover:not([disabled]) { border-color: var(--ink-4); color: var(--ink); }
.wall-page .wall-set[disabled] { opacity: 0.45; cursor: not-allowed; }
.wall-page .wall-set:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wall-page .wall-card.is-selecting .wall-card-tools { display: none; }

/* ------------------------------------------------------------ 编辑抽屉 */
.wall-edit-compare { margin-top: 16px; }
.wall-edit-fields { margin-top: 20px; }
.wall-edit-note { margin-top: 16px; }
.wall-edit-actions { margin-top: 20px; }

.wall-bar-label {
  position: absolute;
  top: 3px;
  left: 6px;
  color: var(--device-light);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------- 手机 */
@media (max-width: 860px) {
  .wall-page { gap: 16px; }
  .wall-page .wall-workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .wall-page .wall-folders { position: static; padding-bottom: 10px; }
  .wall-page .wall-folder-list { flex-direction: row; overflow-x: auto; padding: 0 6px 2px; scrollbar-width: thin; }
  .wall-page .wall-folder { width: auto; flex: 0 0 auto; max-width: 210px; }
  .wall-page .wall-folder-create { max-width: 380px; }

  /* U10：手机每行两张，标题保持单行 */
  .wall-page .wall-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .wall-page .wall-card-foot { gap: 6px; padding: 7px 8px; }
  .wall-page .wall-title { font-size: 12px; }
  .wall-page .wall-more-btn { opacity: 1; }

  .wall-page .wall-rotate-row { gap: 10px; }
  .wall-page .wall-rotate-folder { flex: 1 1 140px; min-width: 0; max-width: none; }
  .wall-page .wall-library-head { align-items: flex-start; }
  .wall-page .wall-drop { gap: 8px; padding: 9px 10px; }
  .wall-page .wall-drop .wall-drop-key { display: none; }
  .wall-page .wall-drop .wall-drop-text { font-size: 12px; }
}

@media (hover: none) {
  .wall-page .wall-more-btn { opacity: 1; }
}

/* Selection checkbox overlay (kept from the previous implementation). */
.wall-select { position: absolute; right: 8px; top: 8px; padding: 6px; border-radius: 3px; background: var(--paper-raised); box-shadow: 0 0 0 1px var(--line); }
