/* JPG to PDF — .jpdf-* namespace */

.jpdf-tool-wrap {
  max-width: 1060px;
  margin: 0 auto;
  margin: 1.5rem 0;
}

/* ── Drop Zone ─────────────────────────────── */
.jpdf-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface);
  position: relative;
}

.jpdf-drop-zone:hover,
.jpdf-drop-zone:focus-visible {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.04);
  outline: none;
}

.jpdf-drop-zone.jpdf-drag-over {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.jpdf-drop-icon {
  color: var(--primary);
  margin-bottom: 1rem;
}

.jpdf-drop-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.jpdf-drop-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.jpdf-browse-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
  text-decoration: underline;
}

.jpdf-browse-link:hover { color: var(--primary-dark); }

.jpdf-file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ── Files Section ─────────────────────────── */
.jpdf-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.25rem 0 0.75rem;
  gap: 1rem;
}

.jpdf-list-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.jpdf-add-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-height: 44px;
}

.jpdf-add-more-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Image List ────────────────────────────── */
.jpdf-image-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.jpdf-image-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem 0.6rem 0.5rem;
  transition: box-shadow 0.15s, opacity 0.15s, border-color 0.15s;
  cursor: default;
}

.jpdf-image-row.jpdf-dragging {
  opacity: 0.4;
}

.jpdf-image-row.jpdf-drag-target {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.jpdf-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  padding: 0.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s;
  min-width: 28px;
  min-height: 28px;
  font-size: 1rem;
  user-select: none;
}

.jpdf-drag-handle:hover { color: var(--primary); }
.jpdf-drag-handle:active { cursor: grabbing; }

.jpdf-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.jpdf-img-name {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jpdf-img-size {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.jpdf-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  min-width: 30px;
  min-height: 30px;
  font-size: 1.1rem;
  line-height: 1;
}

.jpdf-remove-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* ── Options Panel ─────────────────────────── */
.jpdf-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.jpdf-options .input-group {
  margin-bottom: 0;
}

.jpdf-custom-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.jpdf-custom-inputs .input-field {
  width: 80px;
  text-align: center;
}

.jpdf-custom-inputs span {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ── Actions ───────────────────────────────── */
.jpdf-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.jpdf-convert-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 600;
}

.jpdf-convert-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.jpdf-clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  min-height: 44px;
}

.jpdf-clear-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.06);
}

.jpdf-clear-btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── Progress ──────────────────────────────── */
.jpdf-progress-wrap {
  margin-top: 1.5rem;
  text-align: center;
}

.jpdf-progress-track {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.jpdf-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.jpdf-progress-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Result ────────────────────────────────── */
.jpdf-result {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.jpdf-result-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.jpdf-result-icon {
  color: var(--success);
  flex-shrink: 0;
}

.jpdf-result-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.jpdf-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.jpdf-download-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.jpdf-download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
}

.jpdf-download-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  text-align: left;
}

.jpdf-download-item-size {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 0.8rem;
}

.jpdf-download-item-btn {
  flex-shrink: 0;
  min-height: 36px;
  font-size: 0.8rem;
  padding: 0 0.75rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.jpdf-convert-again-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s;
  min-height: 44px;
}

.jpdf-convert-again-btn:hover { color: var(--primary); }

/* ── Status Messages ───────────────────────── */
.jpdf-status-wrap {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  min-height: 1.25rem;
  text-align: center;
  color: var(--text-muted);
}

.jpdf-status-wrap.jpdf-status-warning { color: var(--warning); }
.jpdf-status-wrap.jpdf-status-error   { color: var(--danger); }
.jpdf-status-wrap.jpdf-status-success { color: var(--success); }

/* ── Filename Row ─────────────────────────── */
.jpdf-options .jpdf-filename-row {
  grid-column: 1 / -1;
}

.jpdf-filename-wrap {
  display: flex;
  align-items: stretch;
}

.jpdf-filename-wrap .input-field {
  border-radius: 6px 0 0 6px;
  flex: 1;
  min-width: 0;
}

.jpdf-filename-ext {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 6px 6px 0;
  padding: 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 640px) {
  .jpdf-drop-zone {
    padding: 2rem 1.25rem;
  }

  .jpdf-options {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .jpdf-thumb {
    width: 36px;
    height: 36px;
  }

  .jpdf-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .jpdf-convert-btn,
  .jpdf-clear-btn {
    width: 100%;
    justify-content: center;
  }

  .jpdf-download-item {
    flex-wrap: wrap;
  }

  .jpdf-download-item-btn {
    width: 100%;
    justify-content: center;
  }
}
