/* Diff page layout */
.diff-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 80px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

/* Header */
.diff-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid #d2d2d7;
  padding: 16px 0 12px;
  margin-bottom: 24px;
  z-index: 100;
}

/* Row 1: breadcrumb + source link */
.diff-header-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.diff-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.diff-home-link {
  font-size: 20px;
  font-weight: 400;
  color: #d2691e;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.diff-home-link:hover {
  color: #b45309;
}

.diff-home-icon {
  flex-shrink: 0;
}

.diff-breadcrumb-sep {
  font-size: 20px;
  color: #d2d2d7;
  font-weight: 300;
}

.diff-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.diff-header h1 a {
  color: inherit;
  text-decoration: none;
}

.diff-header h1 a:hover {
  color: #0066cc;
}

.diff-source-link {
  font-size: 13px;
  color: #0066cc;
  text-decoration: none;
  white-space: nowrap;
}

.diff-source-link:hover {
  text-decoration: underline;
}

/* Row 2: selectors + meta + jump button */
.diff-header-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 0;
  gap: 12px;
}

.diff-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: #6e6e73;
  margin: 8px 0 0;
}

.diff-meta-item em {
  font-style: italic;
  color: #1d1d1f;
}

/* Version selector dropdowns */
.diff-selectors {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-selector-label {
  font-size: 13px;
  color: #6e6e73;
}

.diff-selectors select {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
}

/* Jump to first change button — orange accent */
.diff-jump-first {
  font-size: 13px;
  color: #d2691e;
  background: none;
  border: 1px solid #d2691e;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  margin-left: auto;
}

.diff-jump-first:hover {
  background: #d2691e;
  color: #fff;
}

/* Diff content area */
.diff-content {
  position: relative;
  line-height: 1.6;
}

ins {
  background: #d4edda;
  text-decoration: none;
  border-radius: 2px;
  padding: 0 1px;
}

del {
  background: #f8d7da;
  text-decoration: line-through;
  border-radius: 2px;
  padding: 0 1px;
}

ins.diff-highlighted,
del.diff-highlighted {
  outline: 2px solid #0066cc;
  outline-offset: 1px;
}

/* Loading overlay */
.diff-loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 50;
}

.diff-loading-overlay.active {
  display: block;
}

/* Change navigator — orange accent */
.diff-navigator {
  position: fixed;
  bottom: 20px;
  right: 40px;
  background: #fff;
  border: 1px solid #e0cfc0;
  border-top: 2px solid #d2691e;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  z-index: 200;
  font-size: 13px;
}

.diff-nav-summary {
  color: #6e6e73;
  white-space: nowrap;
}

.diff-nav-position {
  color: #b45309;
  font-weight: 500;
  white-space: nowrap;
}

.diff-navigator button {
  background: #fdf8f4;
  border: 1px solid #e0cfc0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  color: #1d1d1f;
}

.diff-navigator button:hover {
  background: #f5ebe0;
}

.diff-navigator button:active {
  background: #e8ddd0;
}

/* Scroll minimap */
.diff-minimap {
  position: fixed;
  top: 0;
  right: 0;
  width: 14px;
  height: 100vh;
  z-index: 150;
  background: #f5f5f7;
  border-left: 1px solid #e8e8ed;
  cursor: pointer;
}

.diff-minimap-viewport {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  pointer-events: none;
  min-height: 20px;
}

.diff-minimap-marker {
  position: absolute;
  left: 2px;
  right: 2px;
  min-height: 2px;
  border-radius: 1px;
  pointer-events: auto;
  cursor: pointer;
}

.diff-minimap-ins {
  background: #28a745;
}

.diff-minimap-del {
  background: #dc3545;
}

.diff-minimap-marker:hover {
  opacity: 0.7;
  left: 0;
  right: 0;
}

.diff-minimap-mod {
  background: #f0ad4e;
}

/* Multi-page breadcrumb */
.diff-breadcrumb-link {
  font-size: 16px;
  color: #0066cc;
  text-decoration: none;
  white-space: nowrap;
}

.diff-breadcrumb-link:hover {
  text-decoration: underline;
}

.diff-breadcrumb-page {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
  white-space: nowrap;
}

/* Page navigator dropdown */
.diff-page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-page-nav select {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
  max-width: 300px;
}

/* Version summary page */
.vs-summary-box {
  background: #fdf8f4;
  border: 1px solid #e0cfc0;
  border-left: 3px solid #d2691e;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 24px;
}

.vs-summary-count {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
}

/* Hierarchy tree */
.vs-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.vs-tree ul {
  list-style: none;
  padding-left: 20px;
  margin: 0;
}

/* Section headers */
.vs-tree-section > .vs-tree-header {
  font-size: 12px;
  font-weight: 600;
  color: #6e6e73;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px 12px 6px;
  border-bottom: 1px solid #e8e8ed;
  background: #f9f9fb;
}

/* Subsection headers */
.vs-tree-subsection > .vs-tree-header {
  font-size: 12px;
  font-weight: 500;
  color: #86868b;
  letter-spacing: 0.3px;
  padding: 10px 12px 4px;
  border-bottom: 1px solid #e8e8ed;
  background: #fcfcfd;
}

/* Leaf page items */
.vs-tree-leaf {
  padding: 6px 12px;
  border-bottom: 1px solid #f0f0f2;
  font-size: 14px;
}

.vs-tree-link {
  color: #0066cc;
  text-decoration: none;
}

.vs-tree-link:hover {
  text-decoration: underline;
}

.vs-tree-text {
  color: #6e6e73;
}

/* Changed page: highlighted row with button-like link */
.vs-tree-leaf-changed {
  background: #fdf8f4;
  border-bottom-color: #e0cfc0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vs-tree-changed-link {
  color: #b45309;
  font-weight: 500;
  background: #fff3cd;
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid #e0cfc0;
  text-decoration: none;
}

a.vs-tree-changed-link:hover {
  background: #ffe8a3;
  border-color: #d2691e;
}

/* Removed pages section */
.vs-tree-removed-section {
  margin-top: 24px;
}

.vs-tree-removed-header {
  font-size: 12px;
  font-weight: 600;
  color: #721c24;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 12px 6px;
  border-bottom: 1px solid #f8d7da;
}

.vs-tree-leaf-removed {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fef2f2;
  border-bottom-color: #f8d7da;
}

/* Change type badges */
.vs-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.vs-badge-modified {
  background: #fff3cd;
  color: #856404;
}

.vs-badge-added {
  background: #d4edda;
  color: #155724;
}

.vs-badge-removed {
  background: #f8d7da;
  color: #721c24;
}

/* Change counts in summary */
.vs-additions {
  color: #28a745;
  font-size: 13px;
  font-weight: 500;
}

.vs-deletions {
  color: #dc3545;
  font-size: 13px;
  font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .diff-header-top {
    flex-direction: column;
  }

  .diff-meta {
    flex-direction: column;
    gap: 4px;
  }

  .diff-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .diff-selectors {
    flex-wrap: wrap;
  }

  .diff-jump-first {
    margin-left: 0;
  }

  .diff-navigator {
    left: 20px;
    right: 40px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .diff-minimap {
    width: 10px;
  }
}
