/* ============================================================
   pdf-tools.css — PDFツール用コンポーネント（tiptools デザイン）
   style.css の :root 変数を利用（必ず style.css の後に読み込む）
   ============================================================ */

/* ツールページのリード文 */
.tool-lead { color: var(--muted); margin: 0 0 18px; }

/* ドロップゾーン（強化版） */
.dropzone__icon { font-size: 2rem; color: var(--primary); line-height: 1; margin-bottom: 6px; }
.dropzone__or { color: var(--muted); font-size: .82rem; margin: 8px 0; }
.dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }

/* ボタン種別 */
.btn-ghost {
  display: inline-block; background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 20px;
  font-size: 1rem; font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { background: #f1f5f9; }
.btn-primary { /* style.css の .btn と同等 */ }
.btn-icon {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  width: 30px; height: 28px; border-radius: 7px; cursor: pointer; font-size: .9rem;
  line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }
.btn-icon:disabled { opacity: .4; cursor: not-allowed; }
.btn-icon--del:hover:not(:disabled) { background: #fde8e8; color: var(--danger); border-color: var(--danger); }

/* ページ一覧 */
.list-wrap { margin-top: 20px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.list-head__count { font-size: .92rem; color: var(--muted); }
.list-head__count b { color: var(--text); font-size: 1.05rem; }
.list-hint { color: var(--muted); font-size: .82rem; margin-top: 12px; }

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
}
.page-card {
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  overflow: hidden; display: flex; flex-direction: column; user-select: none;
}
.page-card.is-dragging { opacity: .4; }
.page-card.is-drop-target { outline: 2px dashed var(--primary); outline-offset: -2px; }
.page-card.is-selectable { cursor: pointer; }
.page-card.is-selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.page-card.is-part1 { box-shadow: inset 0 0 0 2px #16a34a; }
.page-card.is-part2 { box-shadow: inset 0 0 0 2px #f59e0b; }

.page-card__thumb {
  position: relative; background: #f1f5f9; aspect-ratio: 3 / 4;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.page-card__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.page-card__thumb.is-empty { color: var(--muted); font-size: .85rem; }
.page-card__no {
  position: absolute; top: 4px; left: 4px; background: rgba(31,41,51,.78); color: #fff;
  font-size: .7rem; line-height: 1; padding: 3px 6px; border-radius: 6px;
}
.page-card__check {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border); color: transparent;
  display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
}
.page-card.is-selected .page-card__check { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-card__bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--border); }
.page-card__label { flex: 1; font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-card__ctrl { display: flex; gap: 4px; }

/* セグメント（分割モード切替） */
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.seg__btn {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  padding: 9px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .9rem;
}
.seg__btn.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }

/* 強度ボタン（圧縮） */
.cpreset { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.cpreset-btn {
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  padding: 10px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .88rem; text-align: center;
}
.cpreset-btn small { display: block; font-weight: 400; font-size: .72rem; }
.cpreset-btn.is-on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }

/* 範囲指定・操作行 */
.tool-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.tool-row input[type="text"], .tool-row input[type="number"] {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: .95rem;
}
.tool-row input[type="number"] { width: 90px; }
.muted { color: var(--muted); font-size: .9rem; }

.file-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.file-meta__name { font-weight: 600; word-break: break-all; }

/* 処理中オーバーレイ */
.pk-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
}
.pk-overlay[hidden] { display: none; }
.pk-overlay__box {
  background: #fff; border-radius: 12px; padding: 24px 30px; text-align: center;
  box-shadow: var(--shadow); min-width: 200px;
}
.pk-spinner {
  width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: pk-spin .8s linear infinite;
}
@keyframes pk-spin { to { transform: rotate(360deg); } }
.pk-overlay__text { font-size: .92rem; color: var(--text); }

/* トースト */
.pk-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #1f2933; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0;
  transition: opacity .2s, transform .2s; z-index: 1100; max-width: 90vw; text-align: center;
}
.pk-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.pk-toast.is-error { background: var(--danger); }

/* モーダル（alert/confirm） */
.pk-modal {
  border: none; border-radius: 12px; padding: 0; max-width: 420px; width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.pk-modal::backdrop { background: rgba(15,23,42,.5); }
.pk-modal__body { padding: 24px 24px 8px; white-space: pre-wrap; line-height: 1.7; }
.pk-modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 20px; }
