/* 텍스트 비교 (Diff) 전용 스타일 */

/* max-width override: 이 도구는 1100px 사용 */
nav {
  max-width: 1100px;
}

main {
  max-width: 1100px;
}

/* 옵션 행 */
.options-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.option-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.option-label input[type="checkbox"] {
  accent-color: var(--primary);
}

/* 버튼 그룹 */
.btn-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

/* 뷰 모드 토글 */
.view-toggle {
  display: flex;
  gap: 0;
  margin-left: auto;
}

.view-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn:first-child {
  border-radius: 8px 0 0 8px;
}

.view-btn:last-child {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.view-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* 입력 영역 — 좌우 배치 */
.input-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pane {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pane-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
}

.pane-actions {
  display: flex;
  gap: 0.4rem;
}

.btn-small {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-sub);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* 텍스트 입력 */
.pane textarea {
  flex: 1;
  width: 100%;
  min-height: 250px;
  padding: 1rem;
  border: none;
  outline: none;
  resize: vertical;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--surface);
  color: var(--text);
  tab-size: 2;
}

.pane textarea::placeholder {
  color: var(--text-sub);
  opacity: 0.6;
}

/* 통계 바 */
.stats-bar {
  display: flex;
  gap: 1.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  flex-wrap: wrap;
}

.stats-bar[hidden] {
  display: none;
}

.stat-added {
  color: #10b981;
}

.stat-removed {
  color: #ef4444;
}

.stat-unchanged {
  color: var(--text-sub);
}

/* Diff 결과 영역 */
.diff-output {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.diff-output[hidden] {
  display: none;
}

.diff-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.diff-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-sub);
}

/* Diff 테이블 */
.diff-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
  font-size: 0.825rem;
  line-height: 1.6;
  table-layout: fixed;
}

.diff-table td {
  padding: 0 0.75rem;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-table .line-num {
  width: 45px;
  min-width: 45px;
  text-align: right;
  color: var(--text-sub);
  opacity: 0.6;
  user-select: none;
  padding-right: 0.5rem;
  border-right: 1px solid var(--border);
  font-size: 0.75rem;
}

.diff-table .line-content {
  padding-left: 0.75rem;
}

/* 통합 뷰 시 sign 열 */
.diff-table .line-sign {
  width: 20px;
  min-width: 20px;
  text-align: center;
  user-select: none;
  font-weight: 700;
}

/* Side-by-side 뷰 */
.diff-table .side-separator {
  width: 1px;
  min-width: 1px;
  background: var(--border);
  padding: 0;
}

/* 행 배경색 */
.diff-row-added {
  background: #e6ffed;
}

.diff-row-removed {
  background: #ffeef0;
}

.diff-row-equal {
  background: transparent;
}

/* 다크모드 행 배경색 */
@media (prefers-color-scheme: dark) {
  .diff-row-added {
    background: #1b4332;
  }

  .diff-row-removed {
    background: #3d1f28;
  }
}

/* 단어 단위 하이라이트 */
.word-added {
  background: #acf2bd;
  border-radius: 2px;
}

.word-removed {
  background: #fdb8c0;
  border-radius: 2px;
}

@media (prefers-color-scheme: dark) {
  .word-added {
    background: #2d6a4f;
  }

  .word-removed {
    background: #6b2030;
  }
}

/* 빈 결과 메시지 */
.diff-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-sub);
  font-size: 0.9rem;
}

/* 단축키 힌트 */
.shortcut-hint {
  font-size: 0.75rem;
  color: var(--text-sub);
  opacity: 0.7;
}

/* 반응형: 모바일에서 세로 배치 */
@media (max-width: 700px) {
  .input-area {
    grid-template-columns: 1fr;
  }

  .pane textarea {
    min-height: 180px;
  }

  .btn-group {
    gap: 0.4rem;
  }

  .btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }

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

  .view-btn {
    flex: 1;
    text-align: center;
  }

  .stats-bar {
    gap: 0.75rem;
    font-size: 0.8rem;
  }

  .diff-table {
    font-size: 0.75rem;
  }

  .diff-table .line-num {
    width: 30px;
    min-width: 30px;
    font-size: 0.65rem;
  }
}
