.diff-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2);
  --diff-body-height: 400px;
}

.diff-drawer.active {
  transform: translateY(0);
}

.diff-drawer-header {
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--pane-header-bg);
  backdrop-filter: var(--backdrop-blur-md);
  -webkit-backdrop-filter: var(--backdrop-blur-md);
}

.diff-resizer-v {
  height: 12px;
  flex: 0 0 12px;
  cursor: ns-resize;
  position: relative;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.06), transparent);
}

.diff-resizer-v::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.2s ease;
}

.diff-resizer-v:hover::after,
.diff-resizer-v.active::after {
  background: var(--accent);
}

.diff-drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

#diff-summary-container {
  flex: 1;
  display: flex;
  gap: 20px;
  align-items: center;
}

.diff-summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.diff-summary-label {
  color: var(--text-subtle);
  font-family: inherit;
}

.diff-summary-value {
  color: var(--text);
  font-weight: 500;
}

.diff-summary-status {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.diff-summary-status.pos {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.diff-summary-status.neg {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.diff-summary-status.modified {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

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

.diff-drawer-body {
  height: var(--diff-body-height, 0);
  overflow: auto;
  overscroll-behavior: contain;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.diff-drawer.expanded .diff-drawer-body {
  height: var(--diff-body-height, 400px);
  overflow: auto;
}

.diff-drawer.expanded #icon-diff-expand {
  transform: rotate(180deg);
}

#diff-visual-container {
  padding: 0;
  background: #1e1e1e;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  min-height: 100%;
}

.diff-split-container {
  display: flex;
  width: 100%;
  overflow: hidden; /* Constrain panes to drawer width */
  border-bottom: 1px solid var(--border);
}

.diff-pane {
  flex: 0 0 var(--diff-left-width, 50%);
  min-width: 0; /* Important for flex children to shrink */
  display: flex;
  flex-direction: column;
}

.diff-pane-left {
  flex: 0 0 var(--diff-left-width, 50%);
}

.diff-pane-right {
  flex: 0 0 var(--diff-right-width, 50%);
}

.diff-resizer-h {
  width: 6px; /* Slightly wider for better touch targets */
  margin: 0 -3px; /* Center the larger hit area */
  cursor: ew-resize;
  background: var(--border);
  transition: background 0.2s, width 0.2s;
  z-index: 10;
  flex: 0 0 6px;
  position: relative;
}

.diff-resizer-h:hover,
.diff-resizer-h.active {
  background: var(--accent);
  width: 6px;
}

/* Add a visual handle line */
.diff-resizer-h::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1px;
}

.diff-line-wrapper {
  display: flex;
  height: 22px;
  line-height: 22px;
  width: 100%;
}

.diff-line-num {
  width: 48px;
  min-width: 48px;
  padding: 0 12px;
  text-align: right;
  color: #6e7681;
  background: rgba(110, 118, 129, 0.05);
  font-size: 11px;
  user-select: none;
  border-right: 1px solid var(--border);
}

.diff-line-content {
  flex: 1;
  padding: 0 12px;
  white-space: pre;
  overflow-x: auto; /* Allow horizontal scroll for long lines */
  scrollbar-width: none; /* Hide scrollbar for cleaner look */
}

.diff-line-content::-webkit-scrollbar {
  display: none;
}

.diff-line-wrapper.removed {
  background: rgba(239, 68, 68, 0.15);
}

.diff-line-wrapper.removed .diff-line-content {
  color: #fecaca;
}

.diff-line-wrapper.removed .diff-line-num {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.diff-line-wrapper.added {
  background: rgba(16, 185, 129, 0.15);
}

.diff-line-wrapper.added .diff-line-content {
  color: #a7f3d0;
}

.diff-line-wrapper.added .diff-line-num {
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
}

.diff-line-wrapper.empty {
  background: rgba(110, 118, 129, 0.03);
}

.diff-line-wrapper.unchanged {
  color: #c9d1d9;
}

.diff-error {
  color: #ef4444;
  padding: 20px;
  background: rgba(239, 68, 68, 0.05);
}
