/* === ilovepdf-core.css ===
   Tool pages inherit dark header from style.css.
   Tool work area uses clean light theme for readability.
   Colors: work area bg #f8f9fa, card #fff, accent #e53e3e
*/

/* style.css already provides light body. Only adjust btn-ghost for light context. */
.btn-ghost { border-color: #e2e8f0; color: #4a5568; background: rgba(0,0,0,.03); }
.btn-ghost:hover { background: #f1f5f9; color: #1a202c; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.ipdf-main { max-width: 960px; margin: 0 auto; padding: 2rem 1rem; }
.ipdf-back {
  color: #718096; text-decoration: none; font-size: .9rem;
  display: inline-flex; align-items: center; gap: .3rem;
  margin-bottom: 1.5rem; transition: color .15s;
}
.ipdf-back:hover { color: #e53e3e; }

/* ── Tool header ─────────────────────────────────────────────────────── */
.ipdf-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.ipdf-header-icon { font-size: 3rem; line-height: 1; }
.ipdf-header h1 { font-size: 1.75rem; font-weight: 700; color: #1a202c; }
.ipdf-header p { color: #718096; margin-top: .25rem; }

/* ── Drop zone ───────────────────────────────────────────────────────── */
.ipdf-dropzone {
  border: 2px dashed #cbd5e0; border-radius: 16px;
  padding: 4rem 2rem; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.ipdf-dropzone:hover,
.ipdf-dropzone.drag-over { border-color: #e53e3e; background: #fff5f5; }
.ipdf-drop-icon { font-size: 4rem; margin-bottom: 1rem; }
.ipdf-drop-label { font-size: 1.1rem; font-weight: 600; color: #2d3748; }
.ipdf-drop-hint { font-size: .85rem; color: #a0aec0; margin-top: .5rem; }
.ipdf-drop-loading { color: #4299e1; margin-top: 1rem; }

/* ── File info bar ───────────────────────────────────────────────────── */
.ipdf-file-info {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: #fff; border: 1px solid #e8ecf1; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.ipdf-file-info-name {
  font-weight: 700; color: #1a202c; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ipdf-file-info-meta { color: #718096; font-size: .85rem; white-space: nowrap; }

/* ── Thumbnail grid ──────────────────────────────────────────────────── */
.ipdf-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.ipdf-thumb-item {
  background: #fff; border-radius: 10px;
  border: 2px solid #e2e8f0; overflow: hidden;
  position: relative; transition: border-color .15s, box-shadow .15s;
  user-select: none; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.ipdf-thumb-item:hover { border-color: #cbd5e0; box-shadow: 0 3px 10px rgba(0,0,0,.1); }
.ipdf-thumb-item.selected { border-color: #e53e3e; box-shadow: 0 0 0 1px #e53e3e; }
.ipdf-thumb-item canvas { width: 100%; height: auto; display: block; }
.ipdf-thumb-label {
  text-align: center; font-size: .72rem; color: #718096; padding: 4px 4px 6px;
}

/* checkbox overlay */
.ipdf-thumb-check {
  position: absolute; top: 5px; right: 5px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.85); border: 2px solid #cbd5e0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.ipdf-thumb-item.selected .ipdf-thumb-check {
  background: #e53e3e; border-color: #e53e3e;
}
.ipdf-thumb-check::after { content: '✓'; font-size: 11px; color: #fff; display: none; }
.ipdf-thumb-item.selected .ipdf-thumb-check::after { display: block; }

/* sortable drag handle */
.ipdf-thumb-drag {
  position: absolute; top: 4px; left: 4px;
  color: #a0aec0; font-size: 14px; cursor: grab; line-height: 1;
}
.ipdf-thumb-item.sortable-ghost { opacity: .4; }

/* non-PDF file card */
.ipdf-file-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 16px; text-align: center;
}
.ipdf-file-card-icon { font-size: 2.5rem; }
.ipdf-file-card-name { font-size: .8rem; color: #2d3748; word-break: break-all; }
.ipdf-file-card-size { font-size: .72rem; color: #a0aec0; }

/* ── Options panel ───────────────────────────────────────────────────── */
.ipdf-options {
  background: #fff; border: 1px solid #e8ecf1; border-radius: 12px;
  padding: 20px; margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.ipdf-options label {
  display: block; font-size: .85rem; color: #4a5568;
  margin-bottom: 4px; margin-top: 12px; font-weight: 600;
}
.ipdf-options label:first-child { margin-top: 0; }
.ipdf-options input[type=text],
.ipdf-options input[type=password],
.ipdf-options input[type=number],
.ipdf-options select {
  width: 100%; background: #f7fafc; border: 1px solid #e2e8f0;
  color: #1a202c; border-radius: 8px; padding: 8px 12px;
  font-size: .95rem; font-family: inherit; box-sizing: border-box;
  transition: border-color .15s;
}
.ipdf-options input:focus,
.ipdf-options select:focus { outline: none; border-color: #e53e3e; box-shadow: 0 0 0 3px rgba(229,62,62,.12); }
.ipdf-options .ipdf-opt-row { display: flex; gap: 12px; }
.ipdf-options .ipdf-opt-row > div { flex: 1; }

/* selection hint */
.ipdf-selected-hint {
  color: #3182ce; font-size: .85rem; margin-bottom: 12px;
  display: none; padding: 6px 10px; background: #ebf8ff;
  border-radius: 6px; border: 1px solid #bee3f8;
}

/* ── Process button ──────────────────────────────────────────────────── */
.ipdf-process-btn {
  width: 100%; padding: 1rem; background: #e53e3e; color: #fff;
  border: none; border-radius: 12px; font-size: 1.15rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background .15s, transform .1s, box-shadow .15s;
  margin-bottom: 8px; box-shadow: 0 4px 14px rgba(229,62,62,.3);
}
.ipdf-process-btn:hover { background: #c53030; box-shadow: 0 6px 20px rgba(229,62,62,.35); }
.ipdf-process-btn:active { transform: scale(.98); }
.ipdf-process-btn:disabled { background: #cbd5e0; box-shadow: none; cursor: not-allowed; }

/* ── Spinner / processing ────────────────────────────────────────────── */
.ipdf-processing { text-align: center; padding: 1.5rem; color: #4299e1; }
.ipdf-spinner {
  width: 48px; height: 48px; border: 4px solid #e2e8f0;
  border-top-color: #e53e3e; border-radius: 50%;
  animation: ipdf-spin 1s linear infinite; margin: 0 auto 12px;
}
@keyframes ipdf-spin { to { transform: rotate(360deg); } }

/* ── Error ───────────────────────────────────────────────────────────── */
.ipdf-error {
  background: #fff5f5; color: #c53030; border: 1px solid #fed7d7;
  border-radius: 8px; padding: 10px 14px; margin-top: 8px;
  font-size: .9rem; display: none;
}
.ipdf-error.show { display: block; }

/* ── Result screen ───────────────────────────────────────────────────── */
.ipdf-result-wrap {
  text-align: center; padding: 2.5rem 2rem;
  background: #fff; border-radius: 16px;
  border: 1px solid #e8ecf1; box-shadow: 0 4px 24px rgba(0,0,0,.07);
}
.ipdf-result-check { font-size: 4rem; margin-bottom: 1rem; }
.ipdf-result-wrap h2 { font-size: 1.6rem; color: #276749; margin-bottom: .5rem; }
.ipdf-result-meta { color: #718096; font-size: .9rem; margin-bottom: 1.75rem; }
.ipdf-result-size {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
}
.ipdf-size-before { color: #e53e3e; text-decoration: line-through; }
.ipdf-size-after { color: #38a169; font-weight: 700; }
.ipdf-size-pct {
  background: #f0fff4; color: #276749; border-radius: 999px;
  padding: 2px 8px; font-size: .8rem; font-weight: 700;
  border: 1px solid #c6f6d5;
}
.ipdf-download-btn {
  display: inline-block; padding: 1rem 2.5rem;
  background: #38a169; color: #fff; text-decoration: none;
  border-radius: 12px; font-size: 1.1rem; font-weight: 700;
  margin-bottom: 1rem; transition: background .15s, box-shadow .15s;
  box-shadow: 0 4px 14px rgba(56,161,105,.3);
}
.ipdf-download-btn:hover { background: #2f855a; box-shadow: 0 6px 20px rgba(56,161,105,.35); }
.ipdf-reset-btn {
  display: block; background: none; border: 1px solid #e2e8f0;
  color: #718096; border-radius: 8px; padding: .6rem 1.5rem;
  cursor: pointer; font-size: .95rem; font-family: inherit;
  margin: 0 auto 1.75rem; transition: border-color .15s, color .15s;
}
.ipdf-reset-btn:hover { border-color: #a0aec0; color: #1a202c; }
.ipdf-next-label { font-size: .85rem; color: #a0aec0; margin-bottom: 8px; }
.ipdf-next-grid { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ipdf-next-link {
  background: #f7fafc; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 8px 14px; text-decoration: none; color: #4a5568;
  font-size: .85rem; transition: all .15s; white-space: nowrap;
}
.ipdf-next-link:hover { background: #fff5f5; border-color: #feb2b2; color: #c53030; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .ipdf-thumb-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .ipdf-dropzone { padding: 2.5rem 1rem; }
  .ipdf-download-btn { padding: .85rem 1.5rem; font-size: 1rem; }
}
