/* ============================================================
 * PDF Diff tool — dark theme aligned with MDMS common.css
 * ============================================================ */

.pdfdiff { color: #e2e8f0; }

.pdfdiff__header {
  text-align: center;
  margin-bottom: 28px;
}

.pdfdiff__title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 12px;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pdfdiff__lead {
  margin: 0;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.7;
}

/* ── Card surface ── */

.card {
  background: rgba(16, 20, 30, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px;
}

.pdfdiff__upload {
  margin-bottom: 24px;
}

.pdfdiff__inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 720px) {
  .pdfdiff__inputs { grid-template-columns: 1fr; }
}

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

.pdfdiff__label {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}

.pdfdiff__file {
  width: 100%;
  font-size: 13px;
  color: #94a3b8;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.pdfdiff__file:hover { border-color: rgba(59, 130, 246, 0.4); }
.pdfdiff__file:focus { outline: none; border-color: #3b82f6; }

.pdfdiff__file::file-selector-button {
  margin-right: 12px;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.pdfdiff__file::file-selector-button:hover { background: rgba(59, 130, 246, 0.25); }

.pdfdiff__file--modified::file-selector-button {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}
.pdfdiff__file--modified::file-selector-button:hover { background: rgba(34, 197, 94, 0.25); }

.pdfdiff__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  cursor: pointer;
  transition: 0.15s ease;
  transition-property: background, border-color, color, transform, box-shadow;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.1);
}
.btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.btn--accent {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.25);
}
.btn--accent:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
}

.btn--small { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

.pdfdiff__loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #94a3b8;
  font-size: 13px;
}

.pdfdiff__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: pdfdiff-spin 0.9s linear infinite;
}
@keyframes pdfdiff-spin { to { transform: rotate(360deg); } }

.pdfdiff__error {
  font-size: 13px;
  font-weight: 500;
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.3);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 8px 14px;
}

.is-hidden { display: none !important; }

/* ── Results ── */

.pdfdiff__results-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.pdfdiff__results-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #e2e8f0;
}

.pdfdiff__legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #94a3b8;
}
.pdfdiff__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.pdfdiff__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.pdfdiff__legend-dot--removed {
  background: rgba(239, 68, 68, 0.35);
  border: 1px solid rgba(239, 68, 68, 0.5);
}
.pdfdiff__legend-dot--added {
  background: rgba(34, 197, 94, 0.35);
  border: 1px solid rgba(34, 197, 94, 0.5);
}

.pdfdiff__output {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Result card per pair (collapsible) ── */

.result-card {
  background: rgba(16, 20, 30, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  overflow: hidden;
}

.result-card__head {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(2, 6, 23, 0.5);
  border-bottom: 1px solid transparent;
  font-weight: 700;
  color: #e2e8f0;
  flex-wrap: wrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.result-card__head::-webkit-details-marker { display: none; }
.result-card__head:hover { background: rgba(2, 6, 23, 0.7); }
.result-card[open] > .result-card__head {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.result-card__filename {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.result-card__chevron {
  display: inline-block;
  color: #64748b;
  font-size: 11px;
  transition: transform 0.2s ease;
}
.result-card[open] > .result-card__head .result-card__chevron {
  transform: rotate(90deg);
}

.result-card__head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.result-card__body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Error variant — non-collapsible card shown when a pair fails to process */
.result-card--error { border-color: rgba(239, 68, 68, 0.3); }
.result-card__head--error {
  cursor: default;
  background: rgba(127, 29, 29, 0.2);
  border-bottom: 1px solid rgba(239, 68, 68, 0.25);
}
.result-card__head--error:hover { background: rgba(127, 29, 29, 0.2); }
.result-card__error-msg {
  margin: 0;
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Help section (intro) ── */

.pdfdiff__help { margin-bottom: 24px; padding: 0; }

.pdfdiff__help-toggle {
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 24px;
  border-radius: 16px;
  transition: background 0.15s ease;
}
.pdfdiff__help-toggle::-webkit-details-marker { display: none; }
.pdfdiff__help-toggle:hover { background: rgba(255, 255, 255, 0.03); }
.pdfdiff__help-toggle::before {
  content: '▶';
  font-size: 11px;
  color: #64748b;
  transition: transform 0.2s ease;
}
.pdfdiff__help[open] > .pdfdiff__help-toggle::before { transform: rotate(90deg); }
.pdfdiff__help[open] > .pdfdiff__help-toggle {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px 16px 0 0;
}

.pdfdiff__help-body {
  padding: 4px 24px 24px;
  font-size: 13px;
  line-height: 1.7;
  color: #94a3b8;
}
.pdfdiff__help-body h3 {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  margin: 20px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.pdfdiff__help-body h3:first-child { margin-top: 8px; }
.pdfdiff__help-body ol {
  padding-left: 20px;
  margin: 0 0 8px;
}
.pdfdiff__help-body ol li { margin-bottom: 4px; }
.pdfdiff__help-body p { margin: 0 0 8px; }
.pdfdiff__help-body strong { color: #cbd5e1; font-weight: 600; }

.pdfdiff__help-terms { margin: 0 0 8px; }
.pdfdiff__help-terms dt {
  font-weight: 600;
  color: #93c5fd;
  font-size: 13px;
  margin-top: 8px;
}
.pdfdiff__help-terms dd {
  margin: 2px 0 0 16px;
  color: #94a3b8;
}

.pdfdiff__help-note {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-size: 12px;
}

/* ── Section disclosure ── */

.section {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 20px;
}
.section:first-child { border-top: 0; padding-top: 0; }

.section__summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 8px;
  margin: -6px -8px 12px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.section__summary::-webkit-details-marker { display: none; }
.section__summary:hover { background: rgba(255, 255, 255, 0.04); }

.section__summary-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #e2e8f0;
}

.section__chevron {
  display: inline-block;
  color: #64748b;
  transition: transform 0.2s ease;
  font-size: 11px;
}
.section[open] > .section__summary .section__chevron { transform: rotate(90deg); }

.section__title { font-size: 15px; }
.section__hint {
  font-size: 12px;
  font-weight: 400;
  color: #64748b;
  margin-left: 6px;
}

/* ── Image preview triple-pane ── */

.preview-headers {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
}
.preview-headers__diff { color: #fca5a5; }

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.preview-pane {
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px;
  max-height: 520px;
  overflow-y: auto;
  position: relative;
}
.preview-pane--diff {
  background: rgba(127, 29, 29, 0.15);
  border-color: rgba(239, 68, 68, 0.25);
}

.preview-page { margin-bottom: 16px; }
.preview-page:last-child { margin-bottom: 0; }

.preview-page__marker {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  user-select: none;
}
.preview-page__marker--diff {
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.25);
  border-color: rgba(239, 68, 68, 0.3);
}

.preview-page__canvas {
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: #fff;
  display: block;
}
.preview-page__canvas--diff { border-color: rgba(239, 68, 68, 0.4); }

.preview-page__placeholder {
  width: 100%;
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 13px;
}
.preview-page__placeholder--diff {
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

/* ── Text diff side-by-side ── */

.text-diff-headers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
}

.text-diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.text-pane {
  position: relative;
  padding: 14px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 520px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.diff-added {
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
  padding: 0 3px;
  border-radius: 3px;
  text-decoration: none;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.diff-removed {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
  padding: 0 3px;
  border-radius: 3px;
  text-decoration: line-through;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.diff-added.is-highlight {
  background: rgba(34, 197, 94, 0.45);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.6), 0 0 12px rgba(34, 197, 94, 0.4);
}
.diff-removed.is-highlight {
  background: rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.6), 0 0 12px rgba(239, 68, 68, 0.4);
}

.text-pane__marker {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 8px;
  margin: 12px 0;
  user-select: none;
}

/* ── Diff jump nav ── */

.diff-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 12px;
  color: #94a3b8;
}
.diff-nav__count { font-weight: 600; color: #cbd5e1; }
.diff-nav__btns {
  display: inline-flex;
  gap: 4px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.diff-nav__btn {
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}
.diff-nav__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}
.diff-nav__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.diff-nav__btn--next {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}
.diff-nav__btn--next:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.25);
}

/* ── Summary disclosure (copy panel) ── */

.summary {
  background: rgba(2, 6, 23, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
}

.summary__copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: 0.15s ease;
}
.summary__copy-btn:hover { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; }
.summary__copy-btn.is-success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}
.summary__copy-btn svg { width: 14px; height: 14px; }

.summary__textarea {
  display: block;
  width: 100%;
  min-height: 220px;
  margin-top: 12px;
  padding: 12px;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #cbd5e1;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  resize: vertical;
}
.summary__textarea:focus { outline: none; border-color: rgba(59, 130, 246, 0.4); }

/* ── No-change badge ── */

.no-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 999px;
  padding: 4px 12px;
}
.no-change-badge svg { width: 14px; height: 14px; }
