/* ═══════════════════════════════════════════════════════════════
   pdf-tools.css — Filecompress.app PDF Tools Page
   Extends styles.css — do NOT modify styles.css
   MIT License — open source, no SDK dependency
   ═══════════════════════════════════════════════════════════════ */

/* ── Page shell (same sticky tab pattern as image tools) ─────── */
.page-shell { min-height: 100vh; }

/* ── Tool switcher (inherits .tool-tab from styles.css) ──────── */
.tool-switcher {
  max-width: 1100px;
  margin: 34px auto 0;
  padding: 0 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  position: sticky;
  top: 70px;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding-top: 10px;
  padding-bottom: 14px;
}

/* ── PDF File Info Panel ─────────────────────────────────────── */
/* Shown after a PDF is dropped — displays filename, size, pages  */
.pdf-file-info {
  display: none;
  margin-top: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pdf-file-info.visible { display: flex; }

.pdf-fi-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.pdf-fi-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.pdf-fi-name {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.pdf-fi-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pdf-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.pdf-badge.accent {
  background: var(--accent-dim);
  border-color: var(--accent-glow);
  color: var(--accent);
}

/* ── Page Thumbnails Grid ────────────────────────────────────── */
/* Rendered via PDF.js canvases — shows up to 6 page previews    */
.pdf-thumbs {
  display: none;
  margin-top: 1rem;
  gap: 10px;
  flex-wrap: wrap;
}
.pdf-thumbs.visible { display: flex; }

.pdf-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  transition: border-color 0.18s;
}
.pdf-thumb:hover { border-color: var(--accent-glow); }

.pdf-thumb canvas {
  border-radius: 4px;
  max-width: 100px;
  height: auto;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.pdf-thumb span {
  font-size: 0.68rem;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
}

/* "+N more" overflow tile */
.pdf-thumb-more {
  justify-content: center;
  min-width: 60px;
  min-height: 80px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  cursor: default;
}

/* ── Merge File List ─────────────────────────────────────────── */
/* Drag-in files queue for the Merge PDF tool                     */
.pdf-file-list {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pdf-file-list.visible { display: flex; }

.pdf-file-list-header {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.7;
  margin-bottom: 4px;
}

.pdf-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.55rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.pdf-file-item:hover { border-color: var(--accent-glow); }

.pdf-fi-emoji {
  font-size: 1rem;
  flex-shrink: 0;
}

.pdf-file-item-name {
  flex: 1;
  font-size: 0.84rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.pdf-file-item-size {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
}

.pdf-item-order {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.pdf-file-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px 7px;
  line-height: 1.4;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.pdf-file-remove:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* Merge add-more hint */
.pdf-list-hint {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 0.4rem 0 0.2rem;
  opacity: 0.7;
}

/* ── Range input (Split PDF) ─────────────────────────────────── */
.split-range-group {
  display: none; /* shown via JS when "range" mode selected */
}

.range-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 5px;
  font-family: 'DM Mono', monospace;
  opacity: 0.8;
}

/* ── Info callout (non-blocking note/warning) ────────────────── */
.pdf-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 0.65rem 0.9rem;
  background: rgba(249,115,22,0.06);
  border: 1px solid rgba(249,115,22,0.18);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 0.5rem;
}
.pdf-note-icon { font-size: 0.9rem; flex-shrink: 0; margin-top: 1px; }

/* ── Result banner (extends styles.css .result-banner) ───────── */
/* styles.css already handles display:none → .visible flex layout */
.result-banner .pdf-result-msg {
  flex: 1;
  color: var(--success);
  font-size: 0.85rem;
}

.result-banner .pdf-download-link {
  flex-shrink: 0;
  color: var(--success);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid rgba(34,197,94,0.3);
  padding: 4px 12px;
  border-radius: 6px;
  transition: background 0.15s;
}
.result-banner .pdf-download-link:hover {
  background: rgba(34,197,94,0.08);
  text-decoration: none;
}

/* ── Feature grid (tool intro cards) ────────────────────────── */
.pdf-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 1.5rem;
}

.pdf-feature-card {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.83rem;
  color: var(--muted);
  transition: border-color 0.15s;
}
.pdf-feature-card:hover { border-color: var(--accent-glow); }
.pdf-feature-card .fc-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── Loading spinner (inside thumbnail area while loading) ────── */
.pdf-loading-spinner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.5rem 0;
}
.pdf-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pdfSpin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes pdfSpin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tool-switcher {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 14px;
  }
  .tool-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .pdf-thumbs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .pdf-feature-grid { grid-template-columns: 1fr 1fr; }
  .pdf-file-info { gap: 8px; }
}

@media (max-width: 480px) {
  .tool-switcher { top: 62px; }
  .tool-tab { padding: 10px 14px; font-size: 0.82rem; }
  .pdf-feature-grid { grid-template-columns: 1fr; }
  .pdf-fi-name { font-size: 0.82rem; }
  .header.compact h1 { font-size: 1.45rem; }
}