/* ==========================================================================
   PDFMaster - Compare PDF (Visual & Text PDF Comparison Tool)
   Production-Grade · Clean & Minimal UI/UX · Dark/Light Mode · Low-RAM Architecture
   Diwali Festive Theme Compatible
   ========================================================================== */

/* ===== DESIGN TOKENS ===== */
:root {
  --accent: #e8372a;
  --accent-dark: #c42d21;
  --accent-light: rgba(232, 55, 42, 0.08);
  --accent-glow: rgba(232, 55, 42, 0.25);

  --doc-a-color: #3b82f6;
  --doc-a-bg: rgba(59, 130, 246, 0.08);
  --doc-a-border: rgba(59, 130, 246, 0.35);

  --doc-b-color: #10b981;
  --doc-b-bg: rgba(16, 185, 129, 0.08);
  --doc-b-border: rgba(16, 185, 129, 0.35);

  --diff-del: #ef4444;
  --diff-del-bg: rgba(239, 68, 68, 0.14);
  --diff-del-border: rgba(239, 68, 68, 0.45);

  --diff-add: #10b981;
  --diff-add-bg: rgba(16, 185, 129, 0.14);
  --diff-add-border: rgba(16, 185, 129, 0.45);

  --diff-mod: #f59e0b;
  --diff-mod-bg: rgba(245, 158, 11, 0.14);
  --diff-mod-border: rgba(245, 158, 11, 0.45);

  --font-heading: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, 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: 1280px;
  --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.94);
  --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);
  --badge-bg: #f1f0ee;
  --canvas-bg: #e2e0dc;
  --diff-ident-bg: #f5f4f2;
}

[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.94);
  --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);
  --badge-bg: #272523;
  --canvas-bg: #151413;
  --diff-ident-bg: #1e1d1b;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition), color var(--transition);
  overflow-x: hidden;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

/* ===== CONTAINER ===== */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

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

header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-logo img {
  border-radius: var(--radius-sm);
  display: block;
}

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

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--transition);
}

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

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all var(--transition);
  position: relative;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-focus);
  background: var(--surface-2);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.recovery-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: var(--radius-full);
}

.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 9px;
  color: var(--text);
}

.hamburger-btn .h-bar {
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

/* Side Menu */
.side-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 105;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.side-menu {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 110;
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.side-menu.active {
  right: 0;
}

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

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

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

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

.side-nav-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: 700;
  margin: 16px 0 6px 14px;
}

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

.breadcrumb .container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb a {
  color: var(--text-2);
  transition: color var(--transition);
}

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

.breadcrumb span:last-child {
  color: var(--text);
  font-weight: 600;
}

/* ===== HERO SECTION ===== */
.hero {
  padding: 44px 0 32px;
  text-align: center;
}

.hero-pill-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--accent-glow);
}

.hero-pill.festive-pill {
  background: rgba(255, 179, 0, 0.12);
  color: #ff9100;
  border-color: rgba(255, 179, 0, 0.35);
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.85rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 14px;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.hero p.lead {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--text-2);
  max-width: 720px;
  margin: 0 auto 24px;
  line-height: 1.55;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.hero-badges span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== WORKSPACE CARD ===== */
.compare-workspace {
  margin: 12px 0 60px;
}

.workspace-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  transition: border-color var(--transition);
}

/* Upload Dual Slot Container */
.upload-dual-slot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.upload-slot {
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.upload-slot:hover {
  border-color: var(--border-focus);
  background: var(--surface-3);
}

.upload-slot.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: scale(1.01);
}

.upload-slot.slot-a {
  border-color: var(--doc-a-border);
}

.upload-slot.slot-a:hover {
  border-color: var(--doc-a-color);
}

.upload-slot.slot-b {
  border-color: var(--doc-b-border);
}

.upload-slot.slot-b:hover {
  border-color: var(--doc-b-color);
}

.upload-slot.has-file {
  border-style: solid;
  background: var(--surface);
}

.slot-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.slot-a .slot-badge {
  background: var(--doc-a-bg);
  color: var(--doc-a-color);
  border: 1px solid var(--doc-a-border);
}

.slot-b .slot-badge {
  background: var(--doc-b-bg);
  color: var(--doc-b-color);
  border: 1px solid var(--doc-b-border);
}

.slot-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  transition: transform var(--transition);
}

.slot-a .slot-icon {
  background: var(--doc-a-bg);
  color: var(--doc-a-color);
}

.slot-b .slot-icon {
  background: var(--doc-b-bg);
  color: var(--doc-b-color);
}

.upload-slot:hover .slot-icon {
  transform: translateY(-2px);
}

.slot-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 4px;
}

.slot-subtitle {
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-bottom: 12px;
}

.btn-browse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.btn-browse:hover {
  background: var(--surface-2);
  border-color: var(--border-focus);
}

/* File Loaded Preview within Slot */
.slot-file-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding-top: 20px;
}

.slot-thumb-wrap {
  width: 90px;
  height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--canvas-bg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.slot-thumb-wrap canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.slot-file-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.slot-file-meta {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-bottom: 10px;
}

.slot-actions {
  display: flex;
  gap: 8px;
}

.btn-slot-replace {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface-2);
}

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

/* Swap Button Divider */
.upload-swap-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-swap:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  transform: rotate(180deg);
}

.swap-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

/* Workspace Bottom Control Bar */
.workspace-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sample-files-prompt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.btn-sample {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(255, 179, 0, 0.12);
  border: 1px solid rgba(255, 179, 0, 0.35);
  color: #ff9100;
  font-weight: 600;
  font-size: 0.8125rem;
  transition: all var(--transition);
}

.btn-sample:hover {
  background: rgba(255, 179, 0, 0.22);
  transform: translateY(-1px);
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all var(--transition);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

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

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

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

/* ═══════════════════════════════════════════════════════════════════════════
   COMPARE STUDIO (ACTIVE COMPARISON VIEW)
   ═══════════════════════════════════════════════════════════════════════════ */
.compare-studio {
  display: none;
  margin-top: 24px;
  flex-direction: column;
  gap: 16px;
}

.compare-studio.active {
  display: flex;
}

/* Studio Sticky Top Toolbar */
.studio-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

/* Mode Switcher Tabs */
.mode-tabs {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--transition);
}

.mode-tab:hover {
  color: var(--text);
}

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

/* Toolbar Control Groups */
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all var(--transition);
}

.tool-btn.zoom-btn-label {
  padding: 0 10px;
  font-size: 0.75rem;
}

.tool-btn.nav-diff-btn {
  padding: 0 10px;
  font-size: 0.75rem;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text-2);
}

.tool-btn.nav-diff-btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--accent);
  border-color: var(--accent-glow);
}

.tool-btn.nav-diff-btn svg {
  flex-shrink: 0;
}

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

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

.tool-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.page-indicator {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 4px;
}

.zoom-indicator {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-width: 80px;
  text-align: center;
}

.sync-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-2);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.sync-toggle-wrap:hover {
  background: var(--surface-2);
}

.sync-toggle-wrap input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* Diff Sensitivity Slider */
.sensitivity-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-3);
}

.sensitivity-wrap input[type="range"] {
  width: 80px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Studio Layout Body: Main Viewport + Side Drawer */
.studio-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  position: relative;
}

.studio-body.with-drawer {
  grid-template-columns: 1fr 280px;
}

/* Viewport Containers */
.viewport-panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* 1. Side-by-Side Dual Viewport */
.side-by-side-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  flex: 1;
  width: 100%;
  height: calc(100vh - 280px);
  min-height: 620px;
  overflow: hidden;
}

.pane-column {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 100%;
}

.pane-header {
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

.pane-scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-gutter: stable;
  padding: 8px;
  background: var(--canvas-bg);
  text-align: center;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.canvas-wrapper {
  display: inline-block;
  margin: 0 auto;
  vertical-align: top;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
  background: #ffffff;
  border-radius: 2px;
  text-align: left;
}

.canvas-wrapper canvas {
  display: block;
  border-radius: 2px;
}

.canvas-highlight-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

/* Difference Bounding Highlight Boxes */
.diff-highlight-box {
  position: absolute;
  border-radius: 3px;
  pointer-events: auto;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.diff-box-del {
  background: rgba(239, 68, 68, 0.18);
  border: 2px solid #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

.diff-box-add {
  background: rgba(16, 185, 129, 0.18);
  border: 2px solid #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.diff-box-mod {
  background: rgba(245, 158, 11, 0.18);
  border: 2px solid #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}

.diff-box-tag {
  position: absolute;
  top: -19px;
  left: -2px;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.diff-box-del .diff-box-tag { background: #ef4444; }
.diff-box-add .diff-box-tag { background: #10b981; }
.diff-box-mod .diff-box-tag { background: #f59e0b; }

/* 2. Visual Diff Submode Header & Legend */
.visual-diff-header {
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
}

.diff-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.dot-del { background: var(--diff-del); }
.dot-add { background: var(--diff-add); }
.dot-mod { background: var(--diff-mod); }
.dot-same { background: #888888; }

.diff-view-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.diff-mode-btn {
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  background: transparent;
  border: none;
  transition: background 0.1s ease, color 0.1s ease;
}

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

.diff-mode-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Side Drawer (Change Inspector) */
.changes-drawer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 650px;
}

.drawer-header {
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.875rem;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.drawer-item:hover {
  background: var(--surface-3);
  border-color: var(--border-focus);
}

.drawer-item.active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drawer-page-num {
  font-weight: 600;
  font-size: 0.8125rem;
}

.drawer-badge {
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.badge-identical {
  background: var(--diff-add-bg);
  color: var(--diff-add);
}

.badge-changed {
  background: var(--diff-mod-bg);
  color: var(--diff-mod);
}

/* Studio Bottom Export Bar */
.studio-export-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.export-meta-text {
  font-size: 0.8125rem;
  color: var(--text-2);
}

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

/* Loading Modal */
.loading-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

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

.loading-modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

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

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

.loading-modal-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.loading-modal-sub {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 16px;
}

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

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.loading-modal-pct {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-3);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1050;
  pointer-events: none;
}

.toast-item {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-item.toast-success { border-left: 4px solid #10b981; }
.toast-item.toast-error { border-left: 4px solid #ef4444; }
.toast-item.toast-info { border-left: 4px solid #3b82f6; }

/* Back to Top */
.b2t {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  z-index: 90;
}

.b2t.visible {
  opacity: 1;
  pointer-events: auto;
}

.b2t:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT SECTIONS & RICH EDITORIAL
   ═══════════════════════════════════════════════════════════════════════════ */
.content-section {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

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

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
}

.section-head h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 14px;
}

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

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

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

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

.step-number {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 12px;
  display: block;
}

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

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

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

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow);
}

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

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

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

/* Comparison Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.comp-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9375rem;
}

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

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

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

.comp-table td.highlight {
  color: var(--accent);
  font-weight: 600;
}

/* FAQ Accordion */
.faq-grid {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.faq-q {
  padding: 18px 22px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  user-select: none;
  transition: color var(--transition);
}

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

.faq-arrow {
  transition: transform 0.25s ease;
}

.faq-item.open .faq-arrow {
  transform: rotate(180deg);
}

.faq-a {
  padding: 0 22px 20px;
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.65;
  display: none;
}

.faq-item.open .faq-a {
  display: block;
}

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

.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: all var(--transition);
}

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

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

.related-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-head h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.related-card p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.5;
}

.related-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .upload-dual-slot {
    grid-template-columns: 1fr;
  }
  .upload-swap-col {
    flex-direction: row;
  }
  .side-by-side-wrap {
    grid-template-columns: 1fr;
    height: auto;
  }
  .pane-column {
    height: 450px;
  }
  .studio-body.with-drawer {
    grid-template-columns: 1fr;
  }
  .changes-drawer {
    height: 320px;
  }
  .nav-links {
    display: none;
  }
  .hamburger-btn {
    display: flex;
  }
}

@media print {
  header, .studio-toolbar, .studio-export-bar, .changes-drawer, .site-footer, .breadcrumb, .hero, .content-section, .b2t, .toast-container {
    display: none !important;
  }
  .compare-workspace, .workspace-card, .compare-studio {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .side-by-side-wrap {
    height: auto !important;
    overflow: visible !important;
  }
}
