/* ═══════════════════════════════════════════════════════════════════
   diff-tool.css  -  Text Diff Checker  |  Scoped under #dft-root
   Theme: Indigo Night × Electric Cyan - Premium SaaS
   Font: Syne (display) + IBM Plex Mono (code) + Inter (body)
═══════════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────────── */
#dft-root {
  --dft-bg:           #070b14;
  --dft-surface:      #0d1220;
  --dft-surface2:     #131929;
  --dft-surface3:     #1a2235;
  --dft-surface4:     #1f2840;
  --dft-border:       #1e2d47;
  --dft-border2:      #2a3d5c;

  --dft-accent:       #3b82f6;
  --dft-accent-soft:  rgba(59,130,246,0.14);
  --dft-accent2:      #60a5fa;
  --dft-cyan:         #22d3ee;
  --dft-cyan-soft:    rgba(34,211,238,0.12);
  --dft-glow:         rgba(59,130,246,0.3);

  --dft-add:          rgba(34,197,94,0.18);
  --dft-add-bd:       rgba(34,197,94,0.5);
  --dft-add-text:     #4ade80;
  --dft-add-strong:   rgba(34,197,94,0.32);

  --dft-del:          rgba(239,68,68,0.18);
  --dft-del-bd:       rgba(239,68,68,0.5);
  --dft-del-text:     #f87171;
  --dft-del-strong:   rgba(239,68,68,0.32);

  --dft-eq:           transparent;
  --dft-eq-ln:        #3d5068;

  --dft-text:         #d8e4f0;
  --dft-text2:        #8fa8c0;
  --dft-muted:        #4a6278;
  --dft-faint:        #1e2d47;

  --dft-ok:           #34d399;
  --dft-err:          #f87171;
  --dft-warn:         #fbbf24;

  --dft-radius:       14px;
  --dft-radius-sm:    8px;
  --dft-radius-xs:    5px;
  --dft-shadow:       0 4px 24px rgba(0,0,0,0.5);
  --dft-shadow-sm:    0 2px 10px rgba(0,0,0,0.3);

  --dft-font:         'Inter', system-ui, sans-serif;
  --dft-font-display: 'Syne', sans-serif;
  --dft-font-mono:    'IBM Plex Mono', 'Fira Code', monospace;

  --dft-transition:   0.2s ease;
}

/* ── Reset ─────────────────────────────────────────────────────── */
#dft-root *, #dft-root *::before, #dft-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#dft-root {
  font-family: var(--dft-font);
  background: var(--dft-bg);
  color: var(--dft-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Hero ──────────────────────────────────────────────────────── */
.dft-hero {
  text-align: center;
  padding: 52px 24px 40px;
  background: linear-gradient(180deg, rgba(59,130,246,0.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--dft-border);
  position: relative;
  overflow: hidden;
}

.dft-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(59,130,246,0.12), transparent);
  pointer-events: none;
}

.dft-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--dft-font);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dft-accent2);
  background: var(--dft-accent-soft);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 100px;
  padding: 5px 14px;
  margin-bottom: 22px;
}

.dft-hero-badge svg {
  width: 13px;
  height: 13px;
}

.dft-hero h1 {
  font-family: var(--dft-font-display);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--dft-text);
  margin-bottom: 14px;
  line-height: 1.15;
}

.dft-hero h1 span {
  background: linear-gradient(135deg, var(--dft-accent), var(--dft-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dft-hero p {
  font-size: 15.5px;
  color: var(--dft-text2);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── App Container ─────────────────────────────────────────────── */
.dft-app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* ── Options Bar ───────────────────────────────────────────────── */
.dft-options-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--dft-surface);
  border: 1px solid var(--dft-border);
  border-radius: var(--dft-radius);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.dft-options-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dft-options-sep {
  width: 1px;
  height: 22px;
  background: var(--dft-border2);
  margin: 0 4px;
  flex-shrink: 0;
}

.dft-options-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dft-muted);
  white-space: nowrap;
}

/* Toggle Chip */
.dft-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--dft-font);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--dft-text2);
  background: var(--dft-surface2);
  border: 1px solid var(--dft-border);
  border-radius: var(--dft-radius-xs);
  padding: 5px 11px;
  cursor: pointer;
  transition: all var(--dft-transition);
  white-space: nowrap;
  user-select: none;
}

.dft-chip:hover {
  border-color: var(--dft-border2);
  color: var(--dft-text);
}

.dft-chip.is-active {
  background: var(--dft-accent-soft);
  border-color: rgba(59,130,246,0.4);
  color: var(--dft-accent2);
}

.dft-chip svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* View Mode Switcher */
.dft-view-switcher {
  display: flex;
  background: var(--dft-surface2);
  border: 1px solid var(--dft-border);
  border-radius: var(--dft-radius-xs);
  padding: 3px;
  gap: 2px;
  margin-left: auto;
}

.dft-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--dft-font);
  font-size: 12px;
  font-weight: 500;
  color: var(--dft-muted);
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all var(--dft-transition);
  white-space: nowrap;
}

.dft-view-btn svg {
  width: 13px;
  height: 13px;
}

.dft-view-btn:hover {
  color: var(--dft-text);
  background: var(--dft-surface3);
}

.dft-view-btn.is-active {
  background: var(--dft-accent);
  color: #fff;
}

/* ── Input Row ─────────────────────────────────────────────────── */
.dft-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.dft-panel {
  background: var(--dft-surface);
  border: 1px solid var(--dft-border);
  border-radius: var(--dft-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--dft-transition);
}

.dft-panel:focus-within {
  border-color: var(--dft-border2);
}

.dft-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: var(--dft-surface2);
  border-bottom: 1px solid var(--dft-border);
  flex-shrink: 0;
}

.dft-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dft-panel-title svg {
  width: 14px;
  height: 14px;
}

.dft-panel-title.is-original { color: var(--dft-del-text); }
.dft-panel-title.is-modified { color: var(--dft-add-text); }

.dft-panel-meta {
  font-size: 11px;
  color: var(--dft-muted);
  font-family: var(--dft-font-mono);
}

.dft-textarea {
  flex: 1;
  width: 100%;
  min-height: 260px;
  max-height: 380px;
  padding: 16px;
  background: transparent;
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--dft-font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--dft-text);
  tab-size: 2;
  caret-color: var(--dft-accent2);
}

.dft-textarea::placeholder {
  color: var(--dft-muted);
}

.dft-textarea::-webkit-scrollbar { width: 6px; }
.dft-textarea::-webkit-scrollbar-track { background: transparent; }
.dft-textarea::-webkit-scrollbar-thumb { background: var(--dft-border2); border-radius: 10px; }

/* ── Action Row ────────────────────────────────────────────────── */
.dft-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.dft-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--dft-font);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  border-radius: var(--dft-radius-sm);
  padding: 10px 20px;
  cursor: pointer;
  transition: all var(--dft-transition);
  text-decoration: none;
  white-space: nowrap;
}

.dft-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.dft-btn-primary {
  background: linear-gradient(135deg, var(--dft-accent), #2563eb);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.3), 0 4px 16px rgba(59,130,246,0.25);
}

.dft-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(59,130,246,0.5), 0 6px 20px rgba(59,130,246,0.35);
}

.dft-btn-primary:active {
  transform: translateY(0);
}

.dft-btn-ghost {
  background: var(--dft-surface2);
  color: var(--dft-text2);
  border: 1px solid var(--dft-border);
}

.dft-btn-ghost:hover {
  border-color: var(--dft-border2);
  color: var(--dft-text);
  background: var(--dft-surface3);
}

.dft-btn-swap {
  background: var(--dft-cyan-soft);
  color: var(--dft-cyan);
  border: 1px solid rgba(34,211,238,0.2);
}

.dft-btn-swap:hover {
  background: rgba(34,211,238,0.2);
  border-color: rgba(34,211,238,0.4);
}

/* Keyboard shortcut hint */
.dft-shortcut {
  font-size: 10.5px;
  font-family: var(--dft-font-mono);
  color: var(--dft-muted);
  background: var(--dft-surface3);
  border: 1px solid var(--dft-border);
  border-radius: 4px;
  padding: 1px 6px;
  opacity: 0.7;
}

.dft-action-spacer { margin-left: auto; }

/* ── Stats Bar ─────────────────────────────────────────────────── */
.dft-stats-bar {
  display: none;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--dft-surface);
  border: 1px solid var(--dft-border);
  border-radius: var(--dft-radius-sm);
  padding: 12px 18px;
  margin-bottom: 16px;
}

.dft-stats-bar.is-visible {
  display: flex;
}

.dft-stat {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
}

.dft-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dft-stat-dot.is-add { background: var(--dft-add-text); }
.dft-stat-dot.is-del { background: var(--dft-del-text); }
.dft-stat-dot.is-eq  { background: var(--dft-muted); }

.dft-stat-val {
  font-family: var(--dft-font-mono);
  font-weight: 700;
  font-size: 14px;
}

.dft-stat-val.is-add { color: var(--dft-add-text); }
.dft-stat-val.is-del { color: var(--dft-del-text); }
.dft-stat-val.is-eq  { color: var(--dft-text2); }

.dft-stat-lbl {
  color: var(--dft-muted);
  font-size: 12px;
}

.dft-stats-export {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ── Output Area ───────────────────────────────────────────────── */
.dft-output-wrap {
  display: none;
}

.dft-output-wrap.is-visible {
  display: block;
}

.dft-output-card {
  background: var(--dft-surface);
  border: 1px solid var(--dft-border);
  border-radius: var(--dft-radius);
  overflow: hidden;
}

.dft-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--dft-surface2);
  border-bottom: 1px solid var(--dft-border);
}

.dft-output-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dft-text2);
}

/* ── Inline Diff ───────────────────────────────────────────────── */
#dft-inline-view {
  overflow-x: auto;
}

.dft-diff-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--dft-font-mono);
  font-size: 13px;
  line-height: 1.65;
}

.dft-diff-table tr {
  transition: background 0.1s;
}

.dft-diff-table tr:hover {
  filter: brightness(1.05);
}

.dft-ln {
  width: 52px;
  min-width: 52px;
  padding: 3px 12px 3px 8px;
  text-align: right;
  color: var(--dft-eq-ln);
  user-select: none;
  font-size: 11.5px;
  border-right: 2px solid transparent;
  vertical-align: top;
}

.dft-sign {
  width: 24px;
  min-width: 24px;
  padding: 3px 4px;
  text-align: center;
  font-weight: 700;
  vertical-align: top;
}

.dft-code {
  padding: 3px 16px 3px 8px;
  white-space: pre-wrap;
  word-break: break-all;
  vertical-align: top;
}

/* Row types */
.dft-row-add {
  background: var(--dft-add);
}
.dft-row-add .dft-ln {
  color: var(--dft-add-text);
  border-right-color: var(--dft-add-bd);
}
.dft-row-add .dft-sign { color: var(--dft-add-text); }
.dft-row-add .dft-code { color: var(--dft-text); }

.dft-row-del {
  background: var(--dft-del);
}
.dft-row-del .dft-ln {
  color: var(--dft-del-text);
  border-right-color: var(--dft-del-bd);
}
.dft-row-del .dft-sign { color: var(--dft-del-text); }
.dft-row-del .dft-code { color: var(--dft-text); }

.dft-row-eq .dft-ln { color: var(--dft-eq-ln); }
.dft-row-eq .dft-sign { color: var(--dft-faint); }

/* Word/char level highlights inside rows */
.dft-hl-add {
  background: var(--dft-add-strong);
  border-radius: 2px;
  outline: 1px solid var(--dft-add-bd);
  padding: 0 1px;
}
.dft-hl-del {
  background: var(--dft-del-strong);
  border-radius: 2px;
  outline: 1px solid var(--dft-del-bd);
  padding: 0 1px;
  text-decoration: line-through;
  text-decoration-color: var(--dft-del-text);
}

/* Ellipsis row for collapsed unchanged */
.dft-row-ellipsis td {
  padding: 6px 16px;
  color: var(--dft-muted);
  font-size: 12px;
  text-align: center;
  border-top: 1px dashed var(--dft-border);
  border-bottom: 1px dashed var(--dft-border);
  cursor: pointer;
  background: var(--dft-surface2);
  transition: background var(--dft-transition);
}
.dft-row-ellipsis td:hover { background: var(--dft-surface3); }

/* ── Side-by-side View ─────────────────────────────────────────── */
#dft-side-view {
  display: none;
}

#dft-side-view.is-active {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.dft-side-pane {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 520px;
}

.dft-side-pane::-webkit-scrollbar { width: 6px; height: 6px; }
.dft-side-pane::-webkit-scrollbar-track { background: transparent; }
.dft-side-pane::-webkit-scrollbar-thumb { background: var(--dft-border2); border-radius: 10px; }

.dft-side-pane + .dft-side-pane {
  border-left: 1px solid var(--dft-border);
}

.dft-side-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--dft-surface2);
  border-bottom: 1px solid var(--dft-border);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dft-side-header.is-original { color: var(--dft-del-text); }
.dft-side-header.is-modified { color: var(--dft-add-text); }

.dft-side-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--dft-font-mono);
  font-size: 13px;
  line-height: 1.65;
}

.dft-side-table .dft-row-add { background: var(--dft-add); }
.dft-side-table .dft-row-del { background: var(--dft-del); }

/* ── Empty / Identical State ───────────────────────────────────── */
.dft-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 52px 24px;
  text-align: center;
}

.dft-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--dft-surface2);
  border: 1px solid var(--dft-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dft-muted);
}

.dft-empty-icon svg { width: 26px; height: 26px; }

.dft-empty-state h3 {
  font-family: var(--dft-font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--dft-text2);
}

.dft-empty-state p {
  font-size: 13.5px;
  color: var(--dft-muted);
  max-width: 360px;
}

/* Identical badge */
.dft-identical-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dft-ok);
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.3);
  border-radius: var(--dft-radius-sm);
  padding: 10px 20px;
}

.dft-identical-badge svg { width: 16px; height: 16px; }

/* ── SEO Content ───────────────────────────────────────────────── */
.dft-seo {
  max-width: 860px;
  margin: 56px auto 0;
  padding: 0 20px;
}

.dft-seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.dft-seo-card {
  background: var(--dft-surface);
  border: 1px solid var(--dft-border);
  border-radius: var(--dft-radius);
  padding: 22px;
}

.dft-seo-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--dft-accent-soft);
  border: 1px solid rgba(59,130,246,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dft-accent2);
  margin-bottom: 14px;
}

.dft-seo-card-icon svg { width: 18px; height: 18px; }

.dft-seo-card h3 {
  font-family: var(--dft-font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--dft-text);
}

.dft-seo-card p {
  font-size: 13.5px;
  color: var(--dft-text2);
  line-height: 1.7;
}

.dft-seo h2 {
  font-family: var(--dft-font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--dft-text);
  margin-bottom: 12px;
}

.dft-seo-prose {
  font-size: 14px;
  color: var(--dft-text2);
  line-height: 1.85;
  margin-bottom: 36px;
}

/* FAQ */
.dft-faq { margin-bottom: 56px; }

.dft-faq-item {
  border-bottom: 1px solid var(--dft-border);
}

.dft-faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  color: var(--dft-text);
  list-style: none;
  transition: color var(--dft-transition);
}

.dft-faq-q:hover { color: var(--dft-accent2); }
.dft-faq-q::-webkit-details-marker { display: none; }

.dft-faq-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--dft-muted);
  transition: transform var(--dft-transition);
}

details[open] .dft-faq-chevron {
  transform: rotate(180deg);
}

.dft-faq-a {
  font-size: 13.5px;
  color: var(--dft-text2);
  line-height: 1.8;
  padding: 0 0 16px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  #dft-side-view.is-active {
    grid-template-columns: 1fr;
  }

  .dft-side-pane + .dft-side-pane {
    border-left: none;
    border-top: 1px solid var(--dft-border);
  }
}

@media (max-width: 768px) {
  .dft-hero {
    padding: 36px 20px 28px;
  }

  .dft-app {
    padding: 20px 14px 48px;
  }

  .dft-input-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dft-textarea {
    min-height: 180px;
    max-height: 260px;
  }

  .dft-options-bar {
    gap: 8px;
    padding: 12px 14px;
  }

  .dft-options-sep {
    display: none;
  }

  .dft-view-switcher {
    margin-left: 0;
    width: 100%;
  }

  .dft-view-btn {
    flex: 1;
    justify-content: center;
  }

  .dft-action-row {
    gap: 8px;
  }

  .dft-btn {
    font-size: 13px;
    padding: 9px 15px;
  }

  .dft-btn-primary {
    width: 100%;
    justify-content: center;
  }

  .dft-action-spacer { display: none; }
  .dft-shortcut { display: none; }

  .dft-stats-export {
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
    justify-content: flex-end;
  }

  .dft-stats-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* ── Scrollbar global ──────────────────────────────────────────── */
#dft-root ::-webkit-scrollbar { width: 6px; height: 6px; }
#dft-root ::-webkit-scrollbar-track { background: transparent; }
#dft-root ::-webkit-scrollbar-thumb { background: var(--dft-border2); border-radius: 10px; }

/* ── Loading pulse ─────────────────────────────────────────────── */
@keyframes dft-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.dft-computing {
  animation: dft-pulse 1.2s ease-in-out infinite;
  pointer-events: none;
}
