/* PDF Splitter — .ps-* namespace */

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

/* ── Drop Zone ─────────────────────────────────── */
.ps-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);
  outline: none;
}

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

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

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

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

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

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

.ps-browse-link:hover { text-decoration: none; }

.ps-drop-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* ── File bar ─────────────────────────────────── */
.ps-file-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.ps-file-name {
  font-weight: 600;
  color: var(--text);
  flex: 1;
  word-break: break-all;
  min-width: 0;
}

.ps-file-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.ps-page-count {
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
}

.ps-file-size {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ps-change-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ps-change-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.ps-label-hint {
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Thumbnails ──────────────────────────────── */
.ps-thumbs-section {
  margin-bottom: 1.5rem;
}

.ps-thumbs-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.75rem;
}

.ps-thumb-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

.ps-thumb-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ps-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes ps-spin {
  to { transform: rotate(360deg); }
}

.ps-thumbs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.ps-thumbs-grid:empty {
  display: none;
}

.ps-thumb {
  position: relative;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: default;
  transition: transform 0.15s;
}

.ps-thumb:hover { transform: scale(1.05); }

.ps-thumb canvas {
  display: block;
}

.ps-thumb-num {
  position: absolute;
  bottom: 2px;
  right: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--on-primary);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1.4;
  pointer-events: none;
}

.ps-thumb-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.5rem;
  width: 100%;
  margin: 0;
}

/* ── Mode tabs ──────────────────────────────── */
.ps-modes {
  margin-bottom: 1.25rem;
}

.ps-mode-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.ps-mode-tab {
  flex: 1;
  background: var(--surface);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.7rem 0.5rem;
  transition: background 0.15s, color 0.15s;
  text-align: center;
  min-height: 44px;
}

.ps-mode-tab:last-child { border-right: none; }

.ps-mode-tab:hover {
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--text);
}

.ps-mode-tab.active {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}

/* ── Panels ────────────────────────────────── */
.ps-panel {
  padding: 0.25rem 0;
}

.ps-panel label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.ps-range-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0.4rem 0 0;
}

.ps-chunk-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ps-chunk-label {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.ps-chunk-input {
  width: 90px !important;
  text-align: center;
}

.ps-oddeven-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
}

/* ── Output filename row ────────────────────── */
.ps-prefix-row {
  margin-bottom: 1.25rem;
}

.ps-prefix-row label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

/* ── Action buttons ─────────────────────────── */
.ps-action-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ps-action-row .btn {
  min-height: 44px;
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
}

/* ── Progress ───────────────────────────────── */
.ps-progress {
  padding: 2rem 0 1.5rem;
  text-align: center;
}

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

.ps-progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  height: 100%;
  border-radius: 99px;
  transition: width 0.25s ease;
  width: 0%;
}

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

/* ── Results ────────────────────────────────── */
.ps-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.ps-result-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.ps-zip-row {
  margin-bottom: 1rem;
}

.ps-zip-btn {
  min-height: 44px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ps-segment-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.ps-segment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}

.ps-segment-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.ps-segment-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  word-break: break-all;
}

.ps-segment-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ps-dl-btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  min-height: 36px;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.ps-result-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Status (visually hidden live region) ──── */
.ps-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

  .ps-file-bar {
    gap: 0.5rem;
  }

  .ps-file-name {
    font-size: 0.875rem;
  }

  .ps-thumbs-grid {
    max-height: 160px;
  }

  .ps-mode-tab {
    font-size: 0.78rem;
    padding: 0.6rem 0.3rem;
  }

  .ps-action-row {
    flex-direction: column;
  }

  .ps-action-row .btn {
    width: 100%;
    justify-content: center;
  }

  .ps-result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ps-zip-btn {
    width: 100%;
    justify-content: center;
  }

  .ps-segment-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .ps-dl-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
