*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(96,120,255,0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(95,125,255,0.08), transparent 28%),
    #080a13;
  color: #e0e0e0;
  display: flex;
  align-items: stretch;
}

.container {
  display: grid;
  grid-template-columns: 300px 1fr;
  width: 100%;
  height: 100vh;
}

/* ---- Sidebar ---- */
.panel {
  background: rgba(12,16,34,0.98);
  border-right: 1px solid rgba(70,80,150,0.18);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.panel-header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(71,88,197,0.2);
  background: linear-gradient(180deg, rgba(30,37,74,0.98), rgba(11,14,30,0.98));
  flex-shrink: 0;
}

.brand-title { display: flex; align-items: center; gap: 18px; }

.brand-logo {
  width: 96px; height: auto; min-width: 96px;
  border-radius: 18px; padding: 8px;
  filter: drop-shadow(0 0 18px rgba(95,125,255,0.35));
}

.brand-label {
  font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: #8ea0ff; margin-bottom: 4px;
}

.panel-header h1 {
  font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.3px; margin: 0;
}

.tool-tagline { margin: 6px 0 0; font-size: 12px; color: #b5bfff; }

.panel-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: #2a2a2a transparent;
}
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }

.section-title {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: #444; margin-bottom: 8px;
}

textarea {
  width: 100%;
  background: #111420;
  border: 1px solid #1e2340;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 11px;
  font-family: 'Menlo','Monaco','Courier New',monospace;
  padding: 8px 10px;
  resize: none;
  height: 120px;
  outline: none;
  transition: border-color .15s;
  line-height: 1.6;
}
textarea:focus { border-color: #3a4070; }

hr { border: none; border-top: 1px solid #1c1c1c; }

/* ---- Options ---- */
.option-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.option-row:last-child { margin-bottom: 0; }
.option-row label:first-child { flex: 1; font-size: 12px; color: #888; }

.toggle {
  position: relative; display: inline-block;
  width: 36px; height: 20px; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #1e1e1e; border: 1px solid #2a2a2a;
  border-radius: 20px; transition: background .2s;
}
.slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 2px; top: 50%;
  transform: translateY(-50%);
  background: #444; border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle input:checked + .slider { background: rgba(95,125,255,0.25); border-color: #5f7dff; }
.toggle input:checked + .slider::before { transform: translate(16px,-50%); background: #5f7dff; }

/* ---- Compare button ---- */
.compare-btn {
  background: #5f7dff; color: #fff; border: none;
  border-radius: 9px; padding: 10px; font-size: 13px;
  font-weight: 600; cursor: pointer; width: 100%;
  transition: background .15s, transform .15s;
}
.compare-btn:hover { background: #718cff; transform: translateY(-1px); }

/* ---- Output side ---- */
.output-side { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.output-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(70,80,150,0.18);
  background: rgba(10,13,28,0.8);
  flex-shrink: 0; gap: 10px;
}

.status-badge {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
}
.status-badge.idle    { background: rgba(100,100,120,0.2); color: #555; border: 1px solid #222; }
.status-badge.same    { background: rgba(0,200,120,0.12); color: #00c878; border: 1px solid rgba(0,200,120,0.25); }
.status-badge.changed { background: rgba(255,160,0,0.12); color: #ffa040; border: 1px solid rgba(255,160,0,0.25); }

.diff-legend { display: flex; gap: 14px; }
.legend-item { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.legend-item.removed   { color: #ff6060; }
.legend-item.added     { color: #00c878; }
.legend-item.unchanged { color: #444; }

/* ---- Diff area ---- */
.diff-area {
  flex: 1; overflow-y: auto; padding: 0;
  scrollbar-width: thin; scrollbar-color: #1e1e1e transparent;
}
.diff-area::-webkit-scrollbar { width: 6px; }
.diff-area::-webkit-scrollbar-thumb { background: #1e1e1e; border-radius: 4px; }

.empty-state {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
}
.empty-state p { font-size: 13px; color: #2a2a3a; }

/* ---- Diff table ---- */
.diff-table {
  width: 100%;
  font-family: 'Menlo','Monaco','Courier New',monospace;
  font-size: 12px;
  line-height: 1.7;
  border-collapse: collapse;
}

.diff-table tr { border-bottom: 1px solid rgba(255,255,255,0.02); }

.diff-table td { padding: 1px 0; vertical-align: top; }

.line-num {
  width: 44px;
  text-align: right;
  padding: 0 10px 0 4px;
  color: #2a2a3a;
  user-select: none;
  font-size: 11px;
  border-right: 1px solid #111;
  flex-shrink: 0;
}

.line-sign {
  width: 20px;
  text-align: center;
  font-weight: 700;
  user-select: none;
  padding: 0 2px;
}

.line-content {
  padding: 0 16px 0 4px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Row types */
.line-removed { background: rgba(255, 80, 80, 0.08); }
.line-removed .line-sign    { color: #ff6060; }
.line-removed .line-content { color: #ffaaaa; }
.line-removed .line-num     { color: #3a1a1a; }

.line-added { background: rgba(0, 200, 120, 0.07); }
.line-added .line-sign    { color: #00c878; }
.line-added .line-content { color: #88ddb8; }
.line-added .line-num     { color: #0a2a1a; }

.line-unchanged .line-sign    { color: #2a2a3a; }
.line-unchanged .line-content { color: #556; }

.line-spacer td { height: 8px; background: transparent; }

/* ---- Mobile ---- */
@media (max-width: 700px) {
  html, body { overflow: auto; height: auto; }
  .container { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .panel { height: auto; overflow: visible; border-right: none; border-bottom: 1px solid rgba(70,80,150,0.18); }
  .panel-body { overflow: visible; }
  .output-side { height: auto; min-height: 400px; }
}
