/* /var/www/html/assets/css/text-tools.css
   텍스트·문서 도구 5종 공통 스타일 (글자수/단어수/텍스트 비교/대소문자 변환/줄바꿈 제거).
   textarea 기반 입력 + 통계 카드 + 결과 영역을 공통 컴포넌트로 통일한다.
   색상/버튼은 style.css의 공용 토큰(.btn 등)을 재사용한다. */

/* 도구 작업 영역 */
.tt-tool {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 8px 0 34px;
}

/* 입력/출력 텍스트 영역 */
.tt-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tt-field > label,
.tt-field-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(245, 245, 242, 0.82);
}

.tt-area {
  width: 100%;
  min-height: 220px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tt-area::placeholder {
  color: rgba(245, 245, 242, 0.34);
}

.tt-area:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
}

.tt-area[readonly] {
  background: rgba(255, 255, 255, 0.02);
  color: rgba(245, 245, 242, 0.9);
}

/* 두 개 텍스트 영역 나란히 (텍스트 비교 · 대소문자 변환) */
.tt-panes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

/* 통계 카드 묶음 */
.tt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.tt-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
}

.tt-stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tt-stat-label {
  font-size: 0.86rem;
  color: rgba(245, 245, 242, 0.6);
}

/* 옵션 줄 */
.tt-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* 공통: 기본 체크박스/라디오는 감추고 라벨을 눌러 상태를 바꾼다 */
.tt-check {
  position: relative;
  display: inline-flex;
}

.tt-check input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* 토글 칩 (체크박스 on/off) */
.tt-check > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(245, 245, 242, 0.82);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* 상태 표시 아이콘 (동그라미 → 체크) */
.tt-check > span::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(245, 245, 242, 0.4);
  background: transparent center / 11px 11px no-repeat;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tt-check input:hover:not(:checked) + span {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.tt-check input:checked + span {
  background: #f5f5f2;
  border-color: #f5f5f2;
  color: #141414;
}

.tt-check input:checked + span::before {
  border-color: #141414;
  background-color: #141414;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
}

.tt-check input:focus-visible + span {
  outline: 2px solid #8ab4ff;
  outline-offset: 2px;
}

/* 세그먼트 컨트롤 (라디오 택1) */
.tt-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.tt-segmented .tt-check > span {
  padding: 8px 16px;
  border: 0;
  background: transparent;
}

/* 세그먼트에서는 체크 아이콘 없이 활성 세그먼트만 강조 */
.tt-segmented .tt-check > span::before {
  display: none;
}

.tt-segmented .tt-check input:checked + span {
  background: #f5f5f2;
  color: #141414;
}

.tt-segmented .tt-check input:hover:not(:checked) + span {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* 버튼 툴바 */
.tt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tt-note {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  color: rgba(245, 245, 242, 0.6);
}

.tt-note.is-ok {
  color: #8fe0a8;
}

/* 텍스트 비교 결과 */
.tt-diff {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.tt-diff-empty {
  padding: 22px 18px;
  color: rgba(245, 245, 242, 0.5);
  font-size: 0.95rem;
  text-align: center;
}

.tt-diff-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  color: rgba(245, 245, 242, 0.72);
}

.tt-diff-summary b {
  font-weight: 800;
}

.tt-diff-add-text {
  color: #8fe0a8;
}

.tt-diff-del-text {
  color: #f0a3a3;
}

.tt-diff-lines {
  margin: 0;
  padding: 8px 0;
  max-height: 460px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.diff-line {
  display: flex;
  gap: 10px;
  padding: 1px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-line .diff-sign {
  flex: 0 0 1.2em;
  color: rgba(245, 245, 242, 0.4);
  user-select: none;
}

.diff-line.diff-add {
  background: rgba(76, 175, 111, 0.16);
}

.diff-line.diff-add .diff-sign {
  color: #8fe0a8;
}

.diff-line.diff-del {
  background: rgba(214, 96, 96, 0.16);
}

.diff-line.diff-del .diff-sign {
  color: #f0a3a3;
}

.diff-line .diff-text {
  flex: 1 1 auto;
  min-width: 0;
}

/* 사용법/특징/FAQ 안내 (도구 페이지 공통 톤) */
.tt-guide {
  margin: 34px 0 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.tt-guide h2 {
  margin: 0 0 14px;
  font-size: 1.3rem;
}

.tt-guide h3 {
  margin: 18px 0 6px;
  font-size: 1.02rem;
}

.tt-guide p,
.tt-guide li {
  color: rgba(245, 245, 242, 0.72);
  line-height: 1.7;
}

.tt-guide ol,
.tt-guide ul {
  margin: 0;
  padding-left: 20px;
}

.tt-guide li + li {
  margin-top: 6px;
}

.tt-guide p {
  margin: 0 0 8px;
}

@media (max-width: 560px) {
  .tt-area {
    min-height: 180px;
  }
  .tt-stat-num {
    font-size: 1.45rem;
  }
}
