/* 버튼 ds-btn — 주·보조·위험·주 옅은 면·위험 옅은 면·글자·아이콘(면/투명) · 크기 32/28 · 처리 중 고리 스피너 (DESIGN 6-1-1 · A06 · F10~F13 · G2 · G14) */

/* 무게 — base.css 의 button:is([class^="ds-"]) 리셋(0,1,1)이 단일 클래스를 이기므로, 이 파일의 .ds-btn 선택자는 모두 :is(button, a) 를 붙여 같은 무게 + 뒤 순서로 이긴다 */

/* ── 1. 바탕 — 32 · 모서리 3 · 13/500 ─────────────────────────── */
:is(button, a).ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1-5);
  flex: none;
  height: 32px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--btn2);
  color: var(--text);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  line-height: var(--lh-none);
  white-space: nowrap;
  vertical-align: middle;
  text-decoration: none;
  user-select: none;
  cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-std), color var(--dur-base) var(--ease-std);
}
:is(button, a).ds-btn[hidden] { display: none; }
:is(button, a).ds-btn > .ds-ic { width: 14px; height: 14px; }
/* 아이콘 + 글자 — 앞 아이콘 쪽만 2 줄인다(주 0 14 0 12 · 보조 0 12 0 10 · 28 0 10 0 8) */
:is(button, a).ds-btn:not(.ds-btn--icon) > .ds-ic:first-child { margin-left: -2px; }

/* ── 2. 변형 ────────────────────────────────────────────────────── */
/* 주 — 영역마다 하나 · 600 */
:is(button, a).ds-btn--primary { padding: 0 14px; background: var(--accent); color: var(--on-accent); font-weight: var(--fw-semibold); }
:is(button, a).ds-btn--primary:hover { background: var(--accent-hover); }
:is(button, a).ds-btn--primary:active { background: var(--accent-hover); box-shadow: var(--shadow-press-strong); }

/* 보조 — 채움(셀렉트 흰 면+선과 구분) */
:is(button, a).ds-btn--secondary { background: var(--btn2); color: var(--text); }
:is(button, a).ds-btn--secondary > .ds-ic { color: var(--text3); }
:is(button, a).ds-btn--secondary:hover { background: var(--btn2-hover); }
:is(button, a).ds-btn--secondary:active { background: var(--btn2-hover); box-shadow: var(--shadow-press); }

/* 위험 — 600 */
:is(button, a).ds-btn--danger { background: var(--bad); color: var(--danger-fg); font-weight: var(--fw-semibold); }
:is(button, a).ds-btn--danger:hover { background: var(--danger-hover); }
:is(button, a).ds-btn--danger:active { background: var(--danger-hover); box-shadow: var(--shadow-press-strong); }

/* 역할 색 A(사용자 테스트 2026-10-29 지적 6) — 저장 = 주 · 추가 = 주 옅은 면 · 수정 = 보조 + 주색 아이콘 · 삭제 = 위험 옅은 면 · 닫기·기타 = 보조.
   채움은 영역마다 하나 그대로. 제목 줄 [등록]은 옅은 면이 아니라 주 채움을 쓴다. 토큰은 tokens.css 3절 */
/* 주 옅은 면 — 추가. 면 accent 8% + 안쪽 선 32% · hover 는 선만 56% · 500 */
:is(button, a).ds-btn--tonal { background: var(--btn-tonal-bg); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--btn-tonal-line); }
:is(button, a).ds-btn--tonal:hover { box-shadow: inset 0 0 0 1px var(--btn-tonal-line-hover); }
:is(button, a).ds-btn--tonal:active { box-shadow: inset 0 0 0 1px var(--btn-tonal-line-hover), var(--shadow-press); }

/* 위험 옅은 면 — 행 삭제. 바탕·글자는 배지와 같은 --bad-bg · --bad-text + 안쪽 선 bad 32% · 확인창 [삭제](위험 채움)와 겉모습이 갈린다 */
:is(button, a).ds-btn--danger-soft { background: var(--bad-bg); color: var(--bad-text); box-shadow: inset 0 0 0 1px var(--btn-dsoft-line); }
:is(button, a).ds-btn--danger-soft:hover { box-shadow: inset 0 0 0 1px var(--btn-dsoft-line-hover); }
:is(button, a).ds-btn--danger-soft:active { box-shadow: inset 0 0 0 1px var(--btn-dsoft-line-hover), var(--shadow-press); }

/* 보조 + 주색 아이콘 — 수정. 면·글자는 보조 그대로, 아이콘만 --accent-text. 비활성이면 아이콘도 --faint(4절) */
:is(button, a).ds-btn--secondary.ds-btn--accent-ic:not(:disabled):not([aria-disabled="true"]) > .ds-ic { color: var(--accent-text); }

/* 글자 — 좌우 8. 눌림은 면을 --btn2 로 올리지 않고 hover 면 + 눌림 그림자 — 다크 --btn2 위 --accent-text 가 4.5 미만(인디고 3.96 · 2026-10-30)이라서. 10조합 최저 4.53 */
:is(button, a).ds-btn--text { padding: 0 var(--space-2); background: transparent; color: var(--accent-text); }
:is(button, a).ds-btn--text:hover { background: var(--hover); }
:is(button, a).ds-btn--text:active { background: var(--hover); box-shadow: var(--shadow-press); }

/* 투명 — 아이콘 --muted */
:is(button, a).ds-btn--ghost { background: transparent; color: var(--muted); }
:is(button, a).ds-btn--ghost:hover { background: var(--hover-strong); }
:is(button, a).ds-btn--ghost:active { background: var(--btn2); }

/* 아이콘만 — 정사각(aria-label + data-tip 필수) */
:is(button, a).ds-btn--icon { width: 32px; padding: 0; }

/* ── 3. 작은 크기 28 — 제목 줄 · 도구 줄 · 페이지 ─────────────── */
:is(button, a).ds-btn--sm { height: 28px; padding: 0 var(--space-2-5); font-size: var(--fs-12); }
:is(button, a).ds-btn--sm > .ds-ic { width: 13px; height: 13px; }
:is(button, a).ds-btn--sm.ds-btn--text { padding: 0 var(--space-2); }
:is(button, a).ds-btn--sm.ds-btn--icon { width: 28px; padding: 0; }

/* 셀 안 링크 — 표 셀 값이 상세를 여는 링크일 때. 버튼 모양 없이 머리 글자와 같은 왼쪽선 · 넘치면 말줄임 · hover 밑줄(C25) (DESIGN 8-5) */
:is(button, a).ds-btn--cell { display: block; max-width: 100%; height: auto; padding: 0; border-radius: 0; background: transparent; color: var(--accent-text); font-weight: var(--fw-regular); line-height: var(--lh-base); text-align: inherit; overflow: hidden; text-overflow: ellipsis; }
:is(button, a).ds-btn--cell:hover, :is(button, a).ds-btn--cell:active { background: transparent; text-decoration: underline; }

/* 검색 줄 안 30 — 입력과 같은 문맥 규칙(결정 A07 · G14). 칸 안 작은 버튼 · 달력 팝업(.ds-calendar) 안 버튼은 제외 — 달력 제목 28 은 datepicker.css 가 정한다(2026-10-30 기간 달력 337 → 335) */
.ds-searchbar :is(button, a).ds-btn:not(.ds-btn--sm):not(.ds-input__addon):not(.ds-input__toggle):not(.ds-calendar *) { height: 30px; }
.ds-searchbar :is(button, a).ds-btn--icon:not(.ds-btn--sm):not(.ds-input__addon):not(.ds-input__toggle):not(.ds-calendar *) { width: 30px; }

/* ── 4. 비활성 — opacity 금지(G9) ───────────────────────────────── */
:is(button, a).ds-btn:disabled,
:is(button, a).ds-btn[aria-disabled="true"] { background: var(--disabled-bg); color: var(--faint); box-shadow: none; cursor: not-allowed; }
:is(button, a).ds-btn:disabled > .ds-ic,
:is(button, a).ds-btn[aria-disabled="true"] > .ds-ic { color: var(--faint); }
:is(button, a).ds-btn--text:disabled, :is(button, a).ds-btn--text[aria-disabled="true"],
:is(button, a).ds-btn--ghost:disabled, :is(button, a).ds-btn--ghost[aria-disabled="true"] { background: transparent; }

/* ── 5. 처리 중 — 바탕 고정 · 스피너 13 · 다시 누름 무시(field.js) ── */
:is(button, a).ds-btn[aria-busy="true"] { cursor: progress; box-shadow: none; }
:is(button, a).ds-btn--primary[aria-busy="true"] { background: var(--accent); color: var(--on-accent); }
:is(button, a).ds-btn--secondary[aria-busy="true"] { background: var(--btn2); color: var(--text); }
:is(button, a).ds-btn--danger[aria-busy="true"] { background: var(--bad); color: var(--danger-fg); }
:is(button, a).ds-btn--tonal[aria-busy="true"] { background: var(--btn-tonal-bg); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--btn-tonal-line); }
:is(button, a).ds-btn--danger-soft[aria-busy="true"] { background: var(--bad-bg); color: var(--bad-text); box-shadow: inset 0 0 0 1px var(--btn-dsoft-line); }
:is(button, a).ds-btn--text[aria-busy="true"],
:is(button, a).ds-btn--ghost[aria-busy="true"] { background: transparent; }

/* 버튼 안 고리 스피너 — 고리 기본형은 overlay 의 ds-spinner(6-3-8). 버튼 안은 이 파일만으로 돌게 같은 값으로 둔다 */
:is(button, a).ds-btn > .ds-spinner {
  display: inline-block;
  flex: none;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-round);
  animation: ds-btn-spin var(--dur-spin) var(--ease-linear) infinite;
}
/* 앞 아이콘 자리와 같은 상자(14 · sm 13 · 앞 -2) — 아이콘을 스피너로 바꿔도 버튼 폭이 안 변한다(Code 실측 2026-11-10 검색 중 +15px 흔들림) */
:is(button, a).ds-btn:not(.ds-btn--icon) > .ds-spinner:first-child { width: 14px; height: 14px; margin-left: -2px; }
:is(button, a).ds-btn--sm:not(.ds-btn--icon) > .ds-spinner:first-child { width: 13px; height: 13px; }
@keyframes ds-btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  :is(button, a).ds-btn > .ds-spinner { animation: none; }
}
