/* PDF 工具箱 — 溫暖簡潔風格 */
:root {
  --bg: #f7f5f1;
  --card: #ffffff;
  --ink: #2d2a26;
  --muted: #8a8378;
  --line: #eae5dd;
  --accent: #d97757;
  --accent-dark: #c05f3f;
  --ok: #3d9a6b;
  --err: #cc4b3d;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(60, 50, 40, .06), 0 6px 18px rgba(60, 50, 40, .05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 20px; font-weight: 700; cursor: pointer; }
.brand span { letter-spacing: .5px; }
.privacy { font-size: 13px; color: var(--muted); }

main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 32px 20px 60px; }

footer { text-align: center; padding: 18px; color: var(--muted); font-size: 12px; }

/* ---------- 首頁 ---------- */
.hero { margin-bottom: 26px; }
.hero h1 { font-size: 26px; margin-bottom: 6px; }
.hero p { color: var(--muted); font-size: 15px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(60,50,40,.08), 0 12px 28px rgba(60,50,40,.08); }
.card .icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
}
.card .t { font-weight: 700; font-size: 15px; }
.card .d { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

/* ---------- 工具頁 ---------- */
.back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--muted);
  font-size: 14px; cursor: pointer; padding: 4px 0; margin-bottom: 14px;
  font-family: inherit;
}
.back:hover { color: var(--ink); }

.tool-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.tool-head .icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.tool-head h1 { font-size: 22px; }
.tool-head p { color: var(--muted); font-size: 14px; margin-top: 3px; }

.dropzone {
  border: 2px dashed #d8d0c4;
  border-radius: var(--radius);
  background: var(--card);
  padding: 42px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 16px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #fdf6f2; }
.dropzone .big { font-size: 34px; margin-bottom: 8px; }
.dropzone .hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

.filelist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.fileitem {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.fileitem .fname { font-size: 14px; font-weight: 600; word-break: break-all; }
.fileitem .fmeta { font-size: 12px; color: var(--muted); }
.fileitem .grow { flex: 1; min-width: 160px; }
.badge {
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.badge.locked { background: #fdeee8; color: var(--err); }
.badge.ok { background: #e8f5ee; color: var(--ok); }

.pwbox { display: flex; gap: 6px; width: 100%; margin-top: 8px; }
.pwbox input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: inherit;
}
.pwbox input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.iconbtn {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  width: 30px; height: 30px; cursor: pointer; font-size: 13px; color: var(--muted);
  flex-shrink: 0;
}
.iconbtn:hover { background: var(--bg); color: var(--ink); }
.iconbtn:disabled { opacity: .3; cursor: default; }

.options {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
}
.opt-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.opt-row label.head { font-size: 14px; font-weight: 600; min-width: 84px; }
.options select, .options input[type=text], .options input[type=password] {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; font-family: inherit; background: #fff; min-width: 180px;
}
.options .note { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.radio-group { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-group label { font-size: 14px; display: flex; align-items: center; gap: 5px; cursor: pointer; }

.gobtn {
  width: 100%;
  background: var(--accent); color: #fff; border: none;
  border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background .15s;
}
.gobtn:hover:not(:disabled) { background: var(--accent-dark); }
.gobtn:disabled { background: #ddd5c9; cursor: default; }

.result {
  margin-top: 16px; border-radius: var(--radius); padding: 16px 18px;
  font-size: 14px; line-height: 1.7; display: none;
}
.result.show { display: block; }
.result.ok { background: #e8f5ee; color: #22593d; }
.result.err { background: #fdeee8; color: #8c3125; }
.result.busy { background: #f0ede7; color: var(--muted); }

@media (max-width: 560px) {
  header { padding: 14px 16px; }
  main { padding: 20px 14px 40px; }
}

/* ---------- 浮水印即時預覽 ---------- */
.wm-preview {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.wm-pv-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.wm-preview img {
  display: block;
  /* 限制高度，讓「設定」和「預覽」能同時出現在畫面上 ——
     不然調滑桿時看不到效果，預覽就白做了 */
  max-height: 58vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: #fff;
}
.wm-pv-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 12px;
}
.wm-pv-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--accent-dark);
  margin-bottom: 8px;
}

/* ---------- 頁面牆 ---------- */
.wall {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.wall-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.wall-bar b { color: var(--ink); }
.linkbtn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
}
.linkbtn:hover { color: var(--accent-dark); text-decoration: underline; }
.wall-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 12px;
}
.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 12px;
}
.pcard {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 8px 6px 6px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .15s, opacity .15s, transform .1s;
  user-select: none;
}
.pcard:hover { border-color: var(--muted); }
.pcard.on { border-color: var(--accent); background: #fdf6f2; }
.pcard.dim { opacity: .32; }
.pcard.dragging { opacity: .4; }
.pcard.over { border-color: var(--accent); transform: scale(1.03); }
.pthumb {
  height: 150px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.pthumb img {
  display: block;
  border: 1px solid var(--line);
  background: #fff;
  transition: transform .18s;
}
.pmeta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.ptag {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 5px;
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ptag.f0 { background: #efe6fb; color: #6b4ea8; }
.ptag.f1 { background: #e3f3e9; color: #2f7a52; }
.ptag.f2 { background: #fdeedd; color: #a8672a; }
.ptag.f3 { background: #e2eefb; color: #33639e; }
.pacts {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 4px;
}
.pacts .iconbtn { width: 26px; height: 24px; font-size: 12px; }

@media (max-width: 560px) {
  /* 手機沒有拖曳，這三顆就是唯一的排序方式，要夠大才點得到 */
  .pacts { gap: 6px; }
  .pacts .iconbtn { width: 42px; height: 36px; font-size: 15px; }
  .wall { padding: 12px; }
  .wall-grid { gap: 10px; }
}
