/* ============================================
   PDF MERGER — Ci Tech Studio
   Design: Dark Industrial / Utilitarian
   ============================================ */

:root {
  --bg-primary: #0e0e10;
  --bg-secondary: #16161a;
  --bg-card: #1c1c21;
  --bg-hover: #222228;
  --bg-accent: #252530;

  --border: rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.13);
  --border-accent: rgba(255,255,255,0.22);

  --text-primary: #f0efe8;
  --text-secondary: #9896a0;
  --text-muted: #5a5860;

  --accent: #e8e038;
  --accent-dim: rgba(232,224,56,0.12);
  --accent-hover: #f5ec4a;

  --danger: #e84848;
  --danger-dim: rgba(232,72,72,0.12);
  --danger-border: rgba(232,72,72,0.3);

  --success: #3ec96e;
  --success-dim: rgba(62,201,110,0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-display: 'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
}

.logo-icon {
  color: var(--accent);
  display: flex;
  align-items: center;
}

.logo-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  line-height: 1.1;
}

.logo-by {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  flex-shrink: 0;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── CONTAINER ── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  flex: 1;
}

/* ── DROP ZONE ── */
.drop-section {
  margin-bottom: 28px;
  animation: fadeUp 0.4s ease both;
}

#drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  background: var(--bg-secondary);
  position: relative;
  outline: none;
}

#drop-zone:hover,
#drop-zone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-2px);
}

#drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: scale(1.01);
}

#file-input { display: none; }

.drop-content { pointer-events: none; }

.drop-icon-wrap {
  color: var(--accent);
  margin-bottom: 16px;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.drop-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.drop-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

.drop-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  animation: fadeUp 0.3s ease both;
}

.toolbar-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #0e0e10;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) { transform: scale(0.97); }

.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.btn-ghost:hover {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-dim);
}

/* ── PROGRESS ── */
.progress-wrap {
  margin-bottom: 20px;
  animation: fadeUp 0.3s ease both;
}

.progress-bar-outer {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.25s ease;
  box-shadow: 0 0 8px var(--accent);
}

.progress-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── FILE LIST ── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── FILE CARD ── */
.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition);
  animation: fadeUp 0.25s ease both;
}

.file-card:hover { border-color: var(--border-strong); }
.file-card.drag-over-card { border-color: var(--accent); background: var(--accent-dim); }
.file-card.dragging-card { opacity: 0.35; }

.file-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: default;
}

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  padding: 4px 2px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color var(--transition);
}

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

.file-pdf-icon {
  color: var(--danger);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.file-info { flex: 1; min-width: 0; }

.file-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.badge-pages {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}

.badge-removed {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

.icon-btn.danger:hover {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-dim);
}

.icon-btn.expand-btn.open svg {
  transform: rotate(180deg);
}

.icon-btn svg { transition: transform var(--transition); }

/* ── PAGE PREVIEWS ── */
.pages-preview {
  display: none;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-wrap: wrap;
  gap: 8px;
}

.pages-preview.open { display: flex; }

.page-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
}

.page-thumb.removed .canvas-wrap {
  opacity: 0.25;
  border-color: var(--danger-border);
}

.page-thumb.removed .page-num { color: var(--danger); }

.canvas-wrap {
  width: 82px;
  height: 112px;
  background: #fff;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: opacity var(--transition), border-color var(--transition);
}

.canvas-wrap canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.canvas-wrap.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.page-num {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── EMPTY HINT ── */
.empty-hint {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
  animation: fadeUp 0.3s ease both;
}

.empty-hint svg { margin: 0 auto 12px; display: block; color: var(--text-muted); }
.empty-hint p { font-size: 13px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease both;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 740px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
  background: var(--bg-hover);
}

.modal-sub {
  padding: 10px 20px 0;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-hint {
  padding: 8px 20px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.modal-hint strong { color: var(--danger); }

.modal-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-page-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform var(--transition);
}

.modal-page-thumb:hover { transform: translateY(-2px); }

.modal-page-thumb .canvas-wrap {
  width: 88px;
  height: 118px;
  border-radius: 4px;
  transition: all var(--transition);
}

.modal-page-thumb .canvas-wrap:hover { border-color: var(--danger-border); }

.modal-page-thumb.selected .canvas-wrap {
  border: 2px solid var(--danger);
  opacity: 0.4;
}

.modal-page-thumb.selected .page-num { color: var(--danger); }

.modal-page-thumb .remove-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: var(--danger);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-page-thumb.selected .remove-x { display: flex; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  gap: 12px;
}

.removed-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  margin-top: auto;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.footer-brand {
  margin-bottom: 4px;
}

.footer-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  transition: color var(--transition);
}

.footer-logo-link:hover { color: var(--accent); }

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-copy a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-copy a:hover { color: var(--accent); }

.footer-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ── UTILITIES ── */
.hidden { display: none !important; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .header-badge { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .toolbar-stats { justify-content: center; }
  .toolbar-actions { flex-direction: column; }
  .btn-primary, .btn-ghost { width: 100%; justify-content: center; }
  .modal { max-height: 90vh; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-accent); }
