/* ===== DESIGN TOKENS ===== */
:root {
  --accent: #e8372a;
  --accent-dark: #c42d21;
  --accent-light: rgba(232, 55, 42, 0.08);
  --accent-glow: rgba(232, 55, 42, 0.25);
  --delete-red: #ef4444;
  --delete-red-dark: #dc2626;
  --delete-bg: rgba(239, 68, 68, 0.12);
  --delete-overlay: rgba(239, 68, 68, 0.65);
  --keep-green: #10b981;
  --keep-green-dark: #059669;
  --keep-bg: rgba(16, 185, 129, 0.1);
  --font-heading: "Sora", sans-serif;
  --font-body: "DM Sans", sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --transition: 0.2s ease;
  --max-w: 1200px;
  --nav-h: 68px;
}

[data-theme="light"] {
  --bg: #f8f7f5;
  --surface: #ffffff;
  --surface-2: #f2f1ef;
  --surface-3: #eae9e6;
  --border: #e4e2de;
  --border-focus: #c8c5be;
  --text: #1a1917;
  --text-2: #4a4845;
  --text-3: #7a7875;
  --nav-bg: rgba(248, 247, 245, 0.92);
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
  --modal-overlay: rgba(15, 15, 15, 0.65);
}

[data-theme="dark"] {
  --bg: #111110;
  --surface: #1c1b1a;
  --surface-2: #252422;
  --surface-3: #2e2c2a;
  --border: #333230;
  --border-focus: #4a4845;
  --text: #f0ede8;
  --text-2: #b5b0a8;
  --text-3: #7a7875;
  --nav-bg: rgba(17, 17, 16, 0.92);
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --modal-overlay: rgba(0, 0, 0, 0.82);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  background: none;
}

ol,
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ===== NAVBAR ===== */
.site-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: contain;
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.logo-text span {
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Header Buttons */
.theme-toggle,
.recovery-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, border-color 0.3s, transform 0.2s, color 0.2s;
  color: var(--text-2);
  flex-shrink: 0;
  cursor: pointer;
}

.theme-toggle:hover,
.recovery-btn:hover {
  background: rgba(232, 55, 42, 0.07);
  border-color: rgba(232, 55, 42, 0.18);
  color: var(--accent);
  transform: scale(1.08);
}

.theme-toggle svg,
.recovery-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.recovery-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  animation: pulse-badge 2s infinite ease-in-out;
}

@keyframes pulse-badge {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(232, 55, 42, 0.6); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(232, 55, 42, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(232, 55, 42, 0); }
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  gap: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--transition);
}

.hamburger-btn:hover {
  border-color: var(--text-2);
}

.h-bar {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ===== SIDE DRAWER ===== */
.side-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.side-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 310px;
  max-width: 85vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 1200;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.side-menu-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}

.close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-2);
}

.close-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.side-nav {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background var(--transition), color var(--transition);
}

.side-nav a:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.nav-icon {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
}

.side-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-3);
  background: var(--surface);
}

.breadcrumb__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb__item a {
  color: var(--text-3);
  font-size: 0.82rem;
  transition: color var(--transition);
}

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

.breadcrumb__item a span {
  color: inherit;
  font-weight: 400;
}

.breadcrumb__item > span {
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
}

.breadcrumb__sep {
  color: var(--text-3);
  font-size: 0.75rem;
  user-select: none;
}

/* ===== HERO SECTION ===== */
.hero {
  padding: 48px 0 28px;
  text-align: center;
  position: relative;
}

.hero__inner {
  max-width: 800px;
  margin: 0 auto;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
  border: 1px solid rgba(232, 55, 42, 0.18);
}

.hero__title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--text);
}

.hero__title .accent {
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent) 0%, #ff6b4a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__sub {
  font-size: 1.1rem;
  color: var(--text-2);
  margin-bottom: 24px;
  line-height: 1.6;
}

.hero__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
}

.pill svg {
  color: var(--accent);
}

/* ===== TOOL SECTION ===== */
.tool-section {
  padding: 16px 0 54px;
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  outline: none;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(232, 55, 42, 0.08);
}

.upload-zone:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.upload-zone__icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.upload-zone:hover .upload-zone__icon {
  transform: scale(1.1) rotate(5deg);
}

.upload-zone__title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.upload-zone__sub {
  color: var(--text-3);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.upload-zone__formats {
  margin-top: 18px;
  font-size: 0.82rem;
  color: var(--text-3);
}

/* Common Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  padding: 13px 28px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.96rem;
  box-shadow: 0 4px 14px rgba(232, 55, 42, 0.3);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 55, 42, 0.4);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.86rem;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-secondary:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--text-3);
}

.btn-danger {
  background: var(--delete-red);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--delete-red-dark);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-xs {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-xs:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-3);
}

.btn-xs.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

#fileInput {
  display: none;
}

/* ===== WORKSPACE ===== */
.workspace {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.workspace.active {
  display: block;
}

/* File Info Bar */
.file-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.file-info-bar__left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.file-info-bar__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-info-bar__meta {
  min-width: 0;
}

.file-info-bar__name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}

.file-info-bar__size {
  font-size: 0.85rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.badge-low-ram {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(234, 179, 8, 0.15);
  color: #b45309;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

[data-theme="dark"] .badge-low-ram {
  color: #fde047;
}

.badge-ram {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .badge-ram {
  color: #60a5fa;
}

.file-info-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Toolbar & Control Panel */
.deletor-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.range-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-grow: 1;
  max-width: 600px;
}

.range-input-wrapper {
  position: relative;
  flex-grow: 1;
}

.range-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.range-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.range-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.filter-tab {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  color: var(--text-2);
  transition: all var(--transition);
}

.filter-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: all var(--transition);
}

.btn-icon:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-3);
}

.btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Summary Banner */
.summary-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.summary-banner.has-deletions {
  background: var(--delete-bg);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--text);
}

.summary-banner.all-deleted {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--delete-red);
}

.summary-text strong {
  font-weight: 700;
}

.summary-badge-del {
  color: var(--delete-red);
  font-weight: 700;
}

.summary-badge-keep {
  color: var(--keep-green-dark);
  font-weight: 700;
}

[data-theme="dark"] .summary-badge-keep {
  color: #34d399;
}

/* ===== PAGES GRID ===== */
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.pages-grid.grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.pages-grid.grid-lg {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
}

/* Page Card */
.page-card {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  user-select: none;
}

.page-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-hover-shadow);
  border-color: var(--border-focus);
}

.page-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}

.page-card__num {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-card__inspect {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-3);
  transition: all var(--transition);
}

.page-card__inspect:hover {
  background: var(--surface-3);
  color: var(--accent);
}

.page-card__body {
  position: relative;
  aspect-ratio: 1 / 1.414;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.page-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 0.8rem;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.page-card__footer {
  padding: 8px 10px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-action-btn {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.page-action-btn:hover {
  border-color: var(--delete-red);
  color: var(--delete-red);
  background: var(--delete-bg);
}

/* Page Card State: MARKED FOR DELETION */
.page-card.deleted {
  border-color: var(--delete-red);
  background: var(--delete-bg);
}

.page-card.deleted .page-card__head {
  background: rgba(239, 68, 68, 0.15);
  border-bottom-color: rgba(239, 68, 68, 0.3);
  color: var(--delete-red-dark);
}

[data-theme="dark"] .page-card.deleted .page-card__head {
  color: #f87171;
}

.page-card.deleted .page-card__num {
  text-decoration: line-through;
  opacity: 0.85;
}

.page-card.deleted .page-canvas {
  opacity: 0.35;
  filter: grayscale(80%);
}

.page-card__del-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(220, 38, 38, 0.45);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  gap: 6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.page-card.deleted .page-card__del-overlay {
  display: flex;
}

.page-card.deleted .page-action-btn {
  background: var(--delete-red);
  color: #ffffff;
  border-color: var(--delete-red);
}

.page-card.deleted .page-action-btn:hover {
  background: var(--delete-red-dark);
}

/* Page Card Filter Hidden */
.page-card.filter-hidden {
  display: none !important;
}

/* ===== ACTION BAR ===== */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.action-bar__info {
  font-size: 0.95rem;
  color: var(--text-2);
}

.action-bar__btns {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-delete-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--delete-red);
  color: #fff;
  padding: 13px 26px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.96rem;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-delete-main:hover:not(:disabled) {
  background: var(--delete-red-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.btn-delete-main:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== MODAL: LOADING PROGRESS POPUP ===== */
.loading-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.loading-modal-overlay.open {
  display: flex;
}

.loading-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.25s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.loading-modal__icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.loading-modal__title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.loading-modal__sub {
  font-size: 0.88rem;
  color: var(--text-3);
  margin-bottom: 20px;
}

.loading-bar-track {
  width: 100%;
  height: 8px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 12px;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, #ff7354 100%);
  border-radius: var(--radius-full);
  transition: width 0.2s ease;
}

.loading-modal__status {
  font-size: 0.84rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.loading-mode-tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-3);
}

/* Dedicated Resource Render Mode - pauses all animations & compositor layer repaints */
body.rendering-mode * {
  animation-play-state: paused !important;
  transition: none !important;
}
body.rendering-mode .summary-banner,
body.rendering-mode .controls-card,
body.rendering-mode .pages-grid {
  pointer-events: none;
}

/* ===== MODAL: PAGE INSPECTOR ===== */
.inspect-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(5px);
  z-index: 2100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.inspect-modal-overlay.open {
  display: flex;
}

.inspect-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.inspect-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.inspect-modal__title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
}

.inspect-modal__body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  min-height: 380px;
}

.inspect-canvas {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  box-shadow: var(--shadow);
  border-radius: 4px;
  background: #ffffff;
}

.inspect-modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ===== SUCCESS / RESULTS SECTION ===== */
.results-card {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: modal-in 0.3s ease;
  margin-top: 24px;
}

.results-card.active {
  display: block;
}

.results-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: var(--keep-green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.results-sub {
  font-size: 1rem;
  color: var(--text-2);
  margin-bottom: 24px;
}

.results-stats {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 28px;
  font-size: 0.9rem;
}

.results-stat-val {
  font-weight: 700;
  color: var(--text);
}

.results-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  max-width: 420px;
  transform: translateY(30px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast.success {
  border-left: 4px solid var(--keep-green);
}

.toast.error {
  border-left: 4px solid var(--delete-red);
}

.toast.info {
  border-left: 4px solid var(--accent);
}

.toast.warning {
  border-left: 4px solid #f59e0b;
}

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.toast.success .toast-icon {
  color: var(--keep-green);
}

.toast.error .toast-icon {
  color: var(--delete-red);
}

.toast.info .toast-icon {
  color: var(--accent);
}

.toast.warning .toast-icon {
  color: #f59e0b;
}

.toast-btn {
  padding: 4px 10px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: auto;
  flex-shrink: 0;
  transition: background var(--transition);
}

.toast-btn:hover {
  background: var(--accent-dark);
}

/* ===== CONTENT SECTIONS (SEO) ===== */
.section {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.section__header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 48px;
}

.section__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.section__title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.section__sub {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* What is it Grid */
.what-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.what-body {
  font-size: 1rem;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  line-height: 1.7;
}

.what-body strong {
  color: var(--text);
}

.what-visual {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.what-visual__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-page {
  width: 32px;
  height: 42px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  position: relative;
}

.mini-page.del {
  background: var(--delete-bg);
  border-color: var(--delete-red);
  color: var(--delete-red);
  text-decoration: line-through;
}

.mini-page.kept {
  background: var(--keep-bg);
  border-color: var(--keep-green);
  color: var(--keep-green-dark);
}

[data-theme="dark"] .mini-page.kept {
  color: #34d399;
}

.what-visual__arrow {
  font-size: 1.2rem;
  color: var(--text-3);
  padding: 0 4px;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.feature-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.feature-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.feature-card p {
  font-size: 0.92rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* How to Use Steps */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  counter-reset: step-counter;
}

.step-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px 24px;
  box-shadow: var(--shadow-sm);
}

.step-num {
  position: absolute;
  top: -16px;
  left: 24px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(232, 55, 42, 0.35);
}

.step-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
  margin-top: 4px;
}

.step-card p {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* Comparison Table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  text-align: left;
  font-size: 0.92rem;
}

.comparison-table th,
.comparison-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.comparison-table th {
  background: var(--surface-2);
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text);
}

.comparison-table td:first-child {
  font-weight: 600;
  color: var(--text);
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.comparison-table .highlight {
  background: rgba(232, 55, 42, 0.04);
  color: var(--accent);
  font-weight: 700;
}

.tag-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--keep-green-dark);
  font-weight: 700;
}

[data-theme="dark"] .tag-check {
  color: #34d399;
}

.tag-x {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--delete-red);
  font-weight: 700;
}

/* FAQ Accordion */
.faq-list {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.faq-item.open {
  border-color: var(--accent);
}

.faq-q {
  width: 100%;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  background: transparent;
}

.faq-q:hover {
  color: var(--accent);
}

.faq-icon {
  transition: transform 0.3s ease;
  flex-shrink: 0;
  color: var(--text-3);
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  background: var(--surface-2);
}

.faq-item.open .faq-a {
  max-height: 600px;
}

.faq-a-inner {
  padding: 18px 22px 22px;
  font-size: 0.94rem;
  color: var(--text-2);
  line-height: 1.7;
}

.faq-a-inner p + p {
  margin-top: 10px;
}

/* Related Tools Grid */
.tools-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.tool-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.tool-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.tool-card p {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 16px;
  flex-grow: 1;
}

.tool-card__arrow {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Contact Strip */
.contact-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.contact-strip h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.contact-strip p {
  color: var(--text-2);
  margin-bottom: 20px;
  font-size: 1rem;
}

.contact-strip__email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.contact-strip__email:hover {
  background: var(--accent);
  color: #fff;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 56px 0 28px;
  font-size: 0.9rem;
  color: var(--text-2);
  width: 100%;
}

.footer .container {
  max-width: 100%;
  width: 100%;
  padding-left: clamp(16px, 3vw, 40px);
  padding-right: clamp(16px, 3vw, 40px);
  margin: 0 auto;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 40px;
  width: 100%;
}

.footer__brand-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 12px;
  color: inherit;
}

.footer__brand-header img,
.footer__brand img {
  border-radius: 8px;
  width: 36px;
  height: 36px;
  margin-bottom: 0;
  flex-shrink: 0;
  display: block;
}

.footer__brand-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 0;
  line-height: 1.2;
}

.footer__brand-name span {
  color: var(--accent);
}

.footer__brand p {
  font-size: 0.88rem;
  color: var(--text-3);
  line-height: 1.6;
  max-width: 320px;
}

.footer__socials {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.footer__social {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: all var(--transition);
}

.footer__social:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(232, 55, 42, 0.25);
}

.footer__social svg {
  display: block;
}

.footer__col h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 14px;
}

.footer__col ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__col a {
  color: var(--text-3);
  transition: color var(--transition);
  font-size: 0.88rem;
}

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

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-3);
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.footer__badges {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-3);
}

.back-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(232, 55, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.92);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;
  z-index: 1000;
  cursor: pointer;
}

.back-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.back-top:hover {
  background: var(--accent-dark);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 4px 10px rgba(232, 55, 42, 0.45);
}

.back-top svg {
  width: 18px;
  height: 18px;
  stroke: #ffffff;
  stroke-width: 2.8;
  display: block;
}

/* ===== RESPONSIVE MEDIA QUERIES ===== */
@media (max-width: 900px) {
  .what-grid {
    grid-template-columns: 1fr;
  }
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }
  .hero {
    padding: 32px 0 20px;
  }
  .upload-zone {
    padding: 40px 16px;
  }
  .workspace {
    padding: 16px;
  }
  .file-info-bar {
    padding: 12px;
  }
  .file-info-bar__name {
    max-width: 220px;
  }
  .deletor-controls {
    padding: 14px;
  }
  .range-input-group {
    max-width: 100%;
    flex-wrap: wrap;
  }
  .range-input-wrapper {
    width: 100%;
  }
  .pages-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }
  .action-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .action-bar__btns {
    justify-content: center;
  }
  .btn-delete-main {
    width: 100%;
    justify-content: center;
  }
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .footer__bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .back-top {
    bottom: 20px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}
