/* =========================================================
   pdf-tools.css — PDF MERGER & SPLITTER PAGE
   ========================================================= */

/* ---------- PDF Tools Hero ---------- */
.pdf-tools-hero {
  padding: 60px 6vw 70px;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
  background: var(--white);
}
.pdf-tools-hero::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(22,35,63,0.10) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.pdf-tools-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.pdf-tools-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--proof-red);
  padding: 6px 14px;
  border: 1px solid var(--proof-red);
  border-radius: 999px;
  margin-bottom: 22px;
  min-height: 44px;
}
.pdf-tools-eyebrow .dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--proof-red);
  animation: pulseLive 1.8s ease-in-out infinite;
}
@keyframes pulseLive {
  0%,100% { box-shadow: 0 0 0 0 rgba(196,67,43,0.45); }
  50% { box-shadow: 0 0 0 6px rgba(196,67,43,0); }
}

.pdf-tools-h1 {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.04;
  margin: 0 0 16px;
  letter-spacing: -0.015em;
}
.pdf-tools-h1 em {
  font-style: normal;
  color: var(--proof-red);
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

.pdf-tools-lead {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 62ch;
  line-height: 1.6;
  margin: 0 0 28px;
}

.pdf-tools-cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.pdf-tools-stats {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid var(--paper-line);
}
.pdf-tools-stats .stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pdf-tools-stats .stat-num {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  font-size: clamp(24px, 3vw, 36px);
  color: var(--ink);
  line-height: 1;
}
.pdf-tools-stats .stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- App ---------- */
main.app {
  padding: 32px 6vw 70px;
  background: var(--paper);
}
.app-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.app-actions-top {
  display: flex;
  gap: 8px;
}

/* ---------- Mode Tabs ---------- */
.pdf-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 6px;
}
.pdf-mode-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}
.pdf-mode-tab:hover {
  background: var(--panel-bg);
}
.pdf-mode-tab.active {
  background: var(--ink);
  color: var(--paper);
}
.pdf-mode-tab .mode-icon {
  font-size: 18px;
}

.pdf-mode-content.hidden {
  display: none;
}

/* ---------- Upload Zone ---------- */
.upload-zone {
  border: 3px dashed var(--paper-line);
  border-radius: 8px;
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  transition: border-color .2s ease, background .2s ease;
  margin-bottom: 20px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--teal);
  background: var(--panel-bg);
}
.upload-zone.drag-over {
  background: rgba(47,111,98,0.06);
  border-color: var(--teal);
  border-style: solid;
}
.upload-zone .upload-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.upload-zone p {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 500;
}
.upload-zone .upload-hint {
  font-size: 13px;
  color: var(--ink-soft);
  font-family: 'IBM Plex Mono', monospace;
}
.upload-zone input[type="file"] {
  display: none;
}

/* ---------- File List ---------- */
.pdf-file-list {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
  min-height: 100px;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  color: var(--ink-soft);
}
.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.empty-state p {
  margin: 0;
  font-size: 15px;
}
.empty-state .empty-hint {
  font-size: 13px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--ink-soft);
  margin-top: 4px;
}
.empty-state.hidden,
.file-list.hidden {
  display: none;
}

/* ---------- File Row (Merge Mode) ---------- */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.file-row {
  border: 2px solid var(--paper-line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel-bg);
  transition: border-color .2s ease, background .2s ease;
}
.file-row:hover {
  background: var(--white);
}
.file-row-header {
  display: grid;
  grid-template-columns: 32px 40px 1fr 100px 44px;
  gap: 10px;
  align-items: center;
  cursor: default;
  user-select: none;
  padding: 4px 0;
}
.file-row-header .drag-handle {
  color: var(--paper-line);
  font-size: 18px;
  cursor: grab;
  user-select: none;
  text-align: center;
  transition: color .2s ease;
  padding: 4px;
  border-radius: 4px;
}
.file-row-header .drag-handle:hover {
  color: var(--ink-soft);
  background: var(--panel-bg);
}
.file-row-header .file-icon {
  font-size: 24px;
  text-align: center;
}
.file-row-header .file-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.file-row-header .file-size {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: right;
}
.file-row-header .file-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.file-row-header .file-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 16px;
  color: var(--ink-soft);
  transition: color .15s ease, background .15s ease;
  min-height: 32px;
  border-radius: 4px;
}
.file-row-header .file-actions button:hover {
  background: rgba(196,67,43,0.08);
  color: var(--proof-red);
}

/* ---------- Pages Grid (Inside File Row) ---------- */
.file-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--paper-line);
}
.file-pages-grid .page-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 6px;
  background: var(--white);
  border: 2px solid var(--paper-line);
  border-radius: 4px;
  cursor: grab;
  transition: border-color .2s ease, transform .15s ease, box-shadow .15s ease;
  position: relative;
  user-select: none;
}
.file-pages-grid .page-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22,35,63,0.1);
}
.file-pages-grid .page-card.dragging {
  opacity: 0.3;
  transform: scale(0.95);
  cursor: grabbing;
}
.file-pages-grid .page-card.drag-over {
  border-color: var(--teal);
  border-style: dashed;
  background: rgba(47,111,98,0.06);
  transform: scale(1.05);
}
.file-pages-grid .page-card .page-number {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.file-pages-grid .page-card .page-icon {
  font-size: 24px;
  margin: 2px 0;
}
.file-pages-grid .page-card .page-label {
  font-size: 9px;
  color: var(--ink-soft);
  font-family: 'IBM Plex Mono', monospace;
}
.file-pages-grid .page-card .page-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--proof-red);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, background .15s ease;
  padding: 0;
  line-height: 1;
}
.file-pages-grid .page-card .page-remove:hover {
  transform: scale(1.2);
  background: #a8321f;
}
.file-pages-grid .page-card.removed {
  opacity: 0.3;
  border-color: var(--proof-red);
  text-decoration: line-through;
  transform: scale(0.95);
}
.file-pages-grid .page-card.removed .page-remove {
  background: var(--teal);
}
.file-pages-grid .page-card.removed .page-remove:hover {
  background: #1d5a4f;
}

/* ---------- Split Pages Grid ---------- */
.pdf-pages-grid-wrap {
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}
.pdf-pages-grid-wrap.hidden {
  display: none;
}
.pages-grid-title {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  margin: 0 0 14px 0;
  color: var(--ink);
}
.pages-grid-title span {
  color: var(--ink-soft);
  font-weight: 400;
}
.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}
.pdf-pages-grid::-webkit-scrollbar {
  width: 6px;
}
.pdf-pages-grid::-webkit-scrollbar-track {
  background: var(--panel-bg);
  border-radius: 3px;
}
.pdf-pages-grid::-webkit-scrollbar-thumb {
  background: var(--paper-line);
  border-radius: 3px;
}
.pdf-pages-grid::-webkit-scrollbar-thumb:hover {
  background: var(--ink-soft);
}

.pdf-pages-grid .page-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px 10px;
  background: var(--panel-bg);
  border: 2px solid var(--paper-line);
  border-radius: 6px;
  transition: border-color .2s ease, transform .15s ease;
  position: relative;
}
.pdf-pages-grid .page-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}
.pdf-pages-grid .page-card .page-number {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.pdf-pages-grid .page-card .page-icon {
  font-size: 28px;
  margin-bottom: 4px;
}
.pdf-pages-grid .page-card .page-label {
  font-size: 10px;
  color: var(--ink-soft);
  font-family: 'IBM Plex Mono', monospace;
}
.pdf-pages-grid .page-card .page-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--proof-red);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, background .15s ease;
  padding: 0;
  line-height: 1;
}
.pdf-pages-grid .page-card .page-remove:hover {
  transform: scale(1.15);
  background: #a8321f;
}
.pdf-pages-grid .page-card.removed {
  opacity: 0.3;
  border-color: var(--proof-red);
  text-decoration: line-through;
  transform: scale(0.95);
}
.pdf-pages-grid .page-card.removed .page-remove {
  background: var(--teal);
}
.pdf-pages-grid .page-card.removed .page-remove:hover {
  background: #1d5a4f;
}

/* ---------- Actions ---------- */
.pdf-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.pdf-actions .btn {
  min-height: 44px;
}
.pdf-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: 8px;
}
.pdf-status.success {
  color: var(--teal);
}
.pdf-status.error {
  color: var(--proof-red);
}

/* ---------- Features Grid ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--panel-bg);
  border: 1px solid var(--paper-line);
  border-radius: 8px;
  padding: 24px 20px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 0 rgba(22,35,63,0.06);
}
.feature-icon {
  font-size: 32px;
  margin-bottom: 12px;
}
.feature-card h3 {
  font-family: 'Space Mono', monospace;
  font-size: 17px;
  margin: 0 0 8px;
  color: var(--ink);
}
.feature-card p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .file-row-header {
    grid-template-columns: 28px 32px 1fr 70px 36px;
    gap: 6px;
    padding: 6px 10px;
  }
  .file-row-header .file-name {
    font-size: 12px;
  }
  .file-row-header .file-size {
    font-size: 11px;
  }
  .file-pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }
  .pdf-pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

@media (max-width: 700px) {
  .pdf-tools-hero {
    padding: 40px 5vw 50px;
  }
  main.app {
    padding: 24px 5vw 50px;
  }
  .pdf-mode-tabs {
    flex-direction: column;
    padding: 4px;
  }
  .pdf-mode-tab {
    padding: 10px 16px;
    font-size: 12px;
    min-height: 40px;
  }
  .pdf-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .pdf-actions .btn {
    justify-content: center;
  }
  .pdf-status {
    text-align: center;
    margin-left: 0;
  }
  .file-row-header {
    grid-template-columns: 24px 28px 1fr auto;
    gap: 6px;
    padding: 6px 8px;
  }
  .file-row-header .file-size {
    display: none;
  }
  .file-row-header .file-actions {
    grid-column: span 4;
    justify-content: flex-start;
    padding-left: 52px;
  }
  .file-row-header .drag-handle {
    font-size: 14px;
  }
  .file-pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
  .file-pages-grid .page-card .page-number {
    font-size: 10px;
  }
  .file-pages-grid .page-card .page-icon {
    font-size: 18px;
  }
  .pdf-pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
  }
  .pdf-pages-grid .page-card .page-number {
    font-size: 11px;
  }
  .pdf-pages-grid .page-card .page-icon {
    font-size: 22px;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .pdf-tools-stats {
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .upload-zone {
    padding: 30px 14px;
    min-height: 100px;
  }
  .upload-zone .upload-icon {
    font-size: 32px;
  }
  .upload-zone p {
    font-size: 14px;
  }
  .upload-zone .upload-hint {
    font-size: 11px;
  }
  .file-row-header .file-name {
    font-size: 11px;
  }
  .file-row-header .file-actions button {
    font-size: 14px;
    padding: 2px 6px;
    min-height: 28px;
  }
  .file-pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  }
  .file-pages-grid .page-card {
    padding: 6px 2px 4px;
  }
  .file-pages-grid .page-card .page-number {
    font-size: 9px;
  }
  .file-pages-grid .page-card .page-icon {
    font-size: 16px;
  }
  .file-pages-grid .page-card .page-remove {
    width: 16px;
    height: 16px;
    font-size: 9px;
    top: -4px;
    right: -4px;
  }
  .pdf-pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
  .pdf-pages-grid .page-card {
    padding: 8px 4px 6px;
  }
  .pdf-pages-grid .page-card .page-number {
    font-size: 10px;
  }
  .pdf-pages-grid .page-card .page-icon {
    font-size: 18px;
  }
}