/* ==============================
   SPLIT PDF
   ============================== */

.pdf-tools.to-pdf.split .left {
  width: 70%;
}
.range-preview {
  margin-bottom: 28px;
}

.range-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px;
  border: 1px dashed #ccc;
  border-radius: 8px;
  background: #fafafa;
}

.range-page {
  width: 140px;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}

.range-thumb {
  width: 140px;
  text-align: center;
}

.range-thumb img {
  max-width: 100%;
  border-radius: 6px;
}

.range-page canvas {
  width: 100%;
  height: auto;
}

.range-page .page-num {
  margin-top: 6px;
  font-size: 13px;
  color: #555;
}

.pdf-tools.to-pdf.split .right {
  width: 30%;
  padding-left: 24px;
}
.thumb img {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- Tabs ---------- */
.split-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.split-tabs button {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    background: #f8f8f8;
    cursor: pointer;
    margin: 0px;
    font-size: 14px;
    text-transform: capitalize;
    border-radius: 4px;
}

.split-tabs button.active {
  border-color: #e53935;
  color: #e53935;
  background: #fff;
}

/* ---------- Page Preview ---------- */
#pagePreviewList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
}
div#pagePreviewList.is-range {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.page-item {
  position: relative;
  background: #fff;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  border: 2px solid transparent;
}

.page-item.selected {
  border-color: #4caf50;
}

.page-item canvas {
  width: 100%;
  height: auto;
}

.page-item .page-num {
  text-align: center;
  font-size: 12px;
  margin-top: 6px;
}

.page-item .check {
  position: absolute;
  top: 6px;
  left: 6px;
  background: #4caf50;
  color: #fff;
  font-size: 12px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  border-radius: 50%;
  text-align: center;
  display: none;
}

.page-item.selected .check {
  display: block;
}

/* ---------- Range Panel ---------- */
.range-mode {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.range-mode button {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    margin: 0px;
    border-radius: 4px;
    text-transform: capitalize;
    font-size: 14px;
}
div#customRanges label {
    margin: 0px;
}
div#fixedRanges label {
    margin-bottom: 10px;
}
.range-mode button.active {
  border-color: #e53935;
  color: #e53935;
  background: #fff;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0px;
}

.range-row label {
  width: 60px;
}

.range-row input {
    width: 70px;
    padding: 0px 8px;
    margin: 0px;
    border-radius: 4px;
    box-shadow: none;
    font-size: 14px;height: 40px;
}

#addRange {
    background: none;
    border: 1px dashed #e53935;
    color: #e53935;
    padding: 4px 12px;
    cursor: pointer;
    text-transform: capitalize;
    font-size: 15px;
    border-radius: 4px;
}
div#fixedRanges .info-box {
    margin-bottom: 10px;
    border-radius: 4px;
}
/* ---------- Fixed Range ---------- */
#fixedRanges {
  margin-top: 12px;
}

#fixedRanges input {
    width: 70px;
    box-shadow: none;
    border-radius: 4px;
    margin-bottom: 10px;height: 40px;
}
.info-box {
  margin-top: 10px;
  padding: 10px;
  background: #e3f2fd;
  font-size: 13px;
}

/* ---------- Pages Tab ---------- */
.extract-mode {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.extract-mode button {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    margin: 0px;
    border-radius: 4px;
    font-size: 14px;
    text-transform: capitalize;
}

.extract-mode button.active {
  border-color: #e53935;
  color: #e53935;
}

#pagesInput {
    width: 100%;
    padding: 8px;
    margin: 15px 0px 0px;
    border-radius: 4px;
    box-shadow: none;
    height: 40px;
}

#mergeExtracted {
    margin: 0px 8px 0px 0px;
}
div#pagesPanel label {
    font-size: 14px;
    font-weight: 400;
    margin: 20px 0px 10px;
}
#left-pages,
#left-range {
  width: 100%;
}

#rangePreviewList {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
/* ===============================
   RANGE PREVIEW (LEFT)
   =============================== */

#left-range {
  padding: 8px 0;
}

#rangePreviewList {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ----- Range box ----- */
.range-preview {
  border: 2px dashed #cfcfcf;
  border-radius: 10px;
  padding: 14px 16px 18px;
  background: #fafafa;
}

/* ----- Title ----- */
.range-title {
  text-align: center;
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
}

/* ----- Single page ----- */
.range-page {
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  text-align: center;
  width: 160px;
  transition: transform .25s ease, opacity .25s ease;
}

.range-page canvas {
  width: 100%;
  height: auto;
  display: block;
}

.range-page .page-num {
  margin-top: 8px;
  font-size: 13px;
  color: #666;
}

/* ----- Dots ----- */
.range-dots {
    font-size: 14px;
    line-height: 1;
    color: #999;
}

/* ----- Smooth swap ----- */
.range-preview,
.range-page {
  animation: fadeIn .25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* ===============================
   STEP 1 LOADING (SPLIT ONLY)
   =============================== */
.pdf-tools.split .step {
  position: relative;
}

.pdf-tools.split .step-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 10;
}

.pdf-tools.split .step-loading.active {
  display: flex;
}

.pdf-tools.split .step-loading .spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #ddd;
  border-top-color: #e53935;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

.pdf-tools.split .step-loading .loading-text {
  font-size: 14px;
  color: #444;
  font-weight: 500;
}

.pdf-tools.split .upload-btn.loading {
  pointer-events: none;
  opacity: 0.6;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
