/* ══════════════════════════════════════════════════
   종합소득세 계산기 전용 (page-income.php)
   ※ 공통(토큰/nav/히어로/섹션/CTA/footer)은 style.css
   ※ 계산기 원본은 --primary 계열 변수명을 쓰므로, 아래에서 테마 토큰에 매핑합니다.
     (원본 CSS를 최대한 그대로 유지해 계산기 UI 변형 위험을 줄이기 위함)
══════════════════════════════════════════════════ */

/* ── 원본 변수명 → 테마 토큰 매핑 ── */
:root{
  --primary:var(--navy-700);
  --primary-hover:var(--navy-600);
  --primary-dark:var(--navy-800);
  --primary-light:var(--navy-50);
  --text-main:var(--ink);
  --bg-light:var(--bg-soft);
  --border-card:var(--border);
  --border-light:#eeeff1;
  --radius-card:var(--r);
  --section-px:var(--px);
  --section-py:var(--py);
  --section-px-mb:var(--px-mb);
  --section-py-mb:var(--py-mb);
  --green:#059669;
  --red:#dc2626;
  --orange:#ea580c;
}

/* ══ CALCULATOR WRAP ══ */
.calc-wrap { background: var(--bg-light); padding: var(--section-py) 0; }
.calc-inner { max-width: 1120px; margin: 0 auto; padding: 0 var(--section-px); }
.calc-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 32px; align-items: start; }

/* ══ 입력 폼 카드 ══ */
.calc-card {
  background: #fff; border-radius: var(--radius-card);
  border: 1px solid var(--border-card); box-shadow: 0 4px 18px rgba(0,0,0,0.04);
  overflow: hidden;
}

/* 스텝 헤더 */
.step-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px; cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s; user-select: none;
  background: #fff;
  width: 100%; text-align: left; border-left: none; border-right: none; border-top: none;
  font-family: inherit;
}
.step-header:hover { background: var(--bg-light); }
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.step-num.done { background: var(--green); }
.step-title { font-size: 14px; font-weight: 700; color: var(--text-main); }
.step-subtitle { font-size: 11px; color: var(--text-light); margin-top: 1px; }
.step-text { flex: 1; min-width: 0; }
.step-chevron {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--border-card);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-left: auto;
  transition: transform 0.25s, background 0.15s;
  color: var(--text-sub); font-size: 13px; font-weight: 700; line-height: 1;
}
.step-header:hover .step-chevron { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.step-header.open .step-chevron { transform: rotate(180deg); }
.step-body { padding: 22px 24px; display: none; }
.step-body.open { display: block; }

/* 계산기 상단 타이틀 / 스텝 가이드 */
.calc-head { padding: 24px 24px 0; }
.calc-head-title {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.calc-head-title strong {
  font-size: 18px; font-weight: 800; color: var(--primary-dark); letter-spacing: -0.5px;
}
.calc-head-year {
  font-size: 11px; background: var(--primary-light); color: var(--primary);
  font-weight: 700; padding: 3px 10px; border-radius: 12px;
}
.step-guide-box {
  display: flex; align-items: center; gap: 0; margin-bottom: 20px;
  background: var(--bg-light); border-radius: 10px; padding: 10px 14px;
  flex-wrap: wrap; row-gap: 6px;
}
.step-guide-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-main); font-weight: 600;
}
.step-guide-item b { font-size: 13px; font-weight: 800; color: var(--primary); }
.step-guide-item.is-last { color: var(--primary); font-weight: 700; }
.step-guide-arrow { color: #9ca3af; font-size: 16px; font-weight: 700; margin: 0 8px; }
.calc-head-divider { height: 1px; background: var(--border-light); margin: 0 -24px; }

/* 폼 요소 */
.form-group { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block; font-size: 13px; font-weight: 700; color: var(--text-main); margin-bottom: 7px;
}
.form-label .hint { color: var(--text-light); font-weight: 400; font-size: 12px; margin-left: 5px; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.form-input {
  width: 100%; padding: 12px 44px 12px 14px; font-size: 15px;
  border: 1px solid #d1d5db; border-radius: 10px;
  color: var(--text-main); font-family: inherit; text-align: right;
  transition: border-color 0.2s, box-shadow 0.2s; background: #fff;
  -moz-appearance: textfield;
}
.form-input::-webkit-outer-spin-button,
.form-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(39,64,110,0.12); }
.form-input:disabled { background: var(--bg-light); color: var(--text-light); cursor: not-allowed; }
.input-unit { position: absolute; right: 14px; font-size: 13px; color: var(--text-sub); pointer-events: none; font-weight: 500; }
.form-select {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1px solid #d1d5db; border-radius: 10px;
  color: var(--text-main); background: #fff; cursor: pointer; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(39,64,110,0.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* 인적공제 카운터 */
.counter-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.counter-row:last-child { border-bottom: none; }
.counter-label { font-size: 13px; color: var(--text-sub); flex: 1; }
.counter-amount { font-size: 12px; color: var(--primary); font-weight: 600; margin-right: 12px; min-width: 70px; text-align: right; }
.counter-ctrl { display: flex; align-items: center; gap: 8px; }
.counter-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border-card);
  background: #fff; font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--primary);
  transition: background 0.15s, border-color 0.15s; font-weight: 700;
  font-family: inherit;
}
.counter-btn:hover { background: var(--primary-light); border-color: var(--primary); }
.counter-val { min-width: 20px; text-align: center; font-size: 15px; font-weight: 700; color: var(--text-main); }

/* 체크박스 */
.check-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--border-light);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  margin-bottom: 10px; user-select: none;
}
.check-row:last-child { margin-bottom: 0; }
.check-row:hover { border-color: var(--primary); background: var(--primary-light); }
.check-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.check-row label { font-size: 13px; font-weight: 600; color: var(--text-main); cursor: pointer; flex: 1; }
.check-row .check-amount { font-size: 12px; color: var(--primary); font-weight: 600; }

/* 경비율 안내 */
.rate-info {
  border-radius: 8px;
  padding: 8px 2px; margin-top: 8px; font-size: 12px; color: #8a5a23;
  display: none; line-height: 1.7;
}
.rate-info.show { display: block; }
.rate-info strong { font-weight: 700; }

/* 빠른금액 버튼 */
.quick-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-btns .qb-plus { font-size: 11px; color: var(--text-light); align-self: center; }
.quick-btn {
  background: var(--primary-light); color: var(--primary); border: 1px solid var(--border-card);
  padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.15s; white-space: nowrap; font-family: inherit;
}
.quick-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* "다음" 버튼 */
.btn-next {
  width: 100%; margin-top: 20px;
  background: var(--bg-light); color: var(--primary);
  border: 1.5px solid var(--border-card);
  padding: 12px; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit;
}
.btn-next:hover { background: var(--primary-light); border-color: var(--primary); }
.btn-next::after { content: '↓'; font-size: 14px; }

/* 계산하기 버튼 깜빡임 */
@keyframes pulse-btn {
  0%   { box-shadow: 0 0 0 0 rgba(39,64,110,0.7), 0 4px 14px rgba(39,64,110,0.35); transform: scale(1); }
  40%  { box-shadow: 0 0 0 10px rgba(39,64,110,0), 0 4px 14px rgba(39,64,110,0.35); transform: scale(1.03); }
  100% { box-shadow: 0 0 0 0 rgba(39,64,110,0), 0 4px 14px rgba(39,64,110,0.35); transform: scale(1); }
}
.btn-calculate.pulse { animation: pulse-btn 0.55s ease-out 3; }

/* 계산 버튼 */
.calc-btn-area { padding: 0 24px 24px; }
.btn-calculate {
  width: 100%; background: var(--primary); color: #fff; padding: 16px;
  border-radius: 12px; font-size: 16px; font-weight: 800; border: none; cursor: pointer;
  transition: background 0.15s, transform 0.1s; letter-spacing: -0.3px;
  box-shadow: 0 4px 14px rgba(39,64,110,0.35);
  font-family: inherit;
}
.btn-calculate:hover { background: var(--primary-hover); transform: translateY(-2px); }
.btn-calculate:active { transform: translateY(0); }
.btn-reset {
  background: none; border: none; color: var(--text-light); font-size: 13px;
  cursor: pointer; text-decoration: underline; padding: 4px 8px; font-family: inherit;
}
.calc-reset-wrap { text-align: center; margin-top: 10px; }

/* ══ 결과 카드 ══ */
.result-card {
  background: #fff; border-radius: var(--radius-card); padding: 32px 28px;
  border: 2px solid var(--primary); box-shadow: 0 8px 32px rgba(39,64,110,0.12);
  position: sticky; top: calc(var(--nav-h) + 20px);
}
.result-badge {
  display: inline-block; background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 20px; margin-bottom: 14px;
}
.result-title { font-size: 17px; font-weight: 800; color: var(--primary-dark); margin-bottom: 20px; }

/* 상세 계산 내역 */
.detail-table { width: 100%; margin-bottom: 20px; }
.detail-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 7px 0; border-bottom: 1px dashed var(--border-light);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .d-label { color: var(--text-sub); display: flex; align-items: center; gap: 4px; }
.detail-row .d-label .d-indent { margin-left: 16px; color: var(--text-light); font-size: 12px; }
.detail-row .d-val { font-weight: 700; color: var(--text-main); text-align: right; }
.detail-row.minus .d-val { color: var(--text-sub); }
.detail-row.equals { border-top: 1.5px solid var(--primary); border-bottom: none; margin-top: 4px; padding-top: 10px; }
.detail-row.equals .d-label { font-weight: 800; color: var(--primary-dark); font-size: 14px; }
.detail-row.equals .d-val { font-size: 15px; color: var(--primary-dark); }
.d-sub { font-size: 12px; color: var(--text-light); }

/* 최종 결과 박스 */
.result-final {
  border-radius: 12px; padding: 22px 20px; text-align: center; margin-bottom: 20px;
  border: 1.5px solid;
}
.result-final.pay { background: #fff7ed; border-color: #fed7aa; }
.result-final.refund { background: #f0fdf4; border-color: #bbf7d0; }
.result-final.zero { background: var(--bg-light); border-color: var(--border-card); }
.result-final .rf-label { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.result-final.pay .rf-label { color: var(--orange); }
.result-final.refund .rf-label { color: var(--green); }
.result-final.zero .rf-label { color: var(--text-sub); }
.result-final .rf-amount { font-size: 32px; font-weight: 800; line-height: 1.2; letter-spacing: -1px; }
.result-final.pay .rf-amount { color: var(--orange); }
.result-final.refund .rf-amount { color: var(--green); }
.result-final.zero .rf-amount { color: var(--text-sub); }
.result-final .rf-unit { font-size: 18px; font-weight: 600; margin-left: 3px; }
.result-final .rf-sub { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* 세율 뱃지 */
.rate-badge {
  display: inline-block; background: #f1f5f9; color: var(--primary-dark);
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px; margin-left: 6px;
}

.result-notice {
  font-size: 11.5px; color: var(--text-light); line-height: 1.7;
  background: #f9fafb; padding: 11px 13px; border-radius: 8px; margin-bottom: 18px;
}
.btn-kakao-full {
  display: flex; justify-content: center; align-items: center; width: 100%;
  background: var(--kakao); color: #1a1a1a; padding: 15px; border-radius: 10px;
  font-size: 15px; font-weight: 700; text-decoration: none; transition: opacity 0.15s;
  gap: 6px;
}
.btn-kakao-full:hover { opacity: 0.88; }

/* 초기 상태 안내 */
.result-empty { text-align: center; padding: 32px 0; color: var(--text-light); }
.result-empty .empty-icon { margin-bottom: 12px; line-height: 1; }
.result-empty p { font-size: 14px; line-height: 1.8; }

/* 구분선 */
.divider { border: none; border-top: 1px solid var(--border-light); margin: 6px 0; }

/* 안내 박스 (표준세액공제 등) */
.calc-info-box {
  background: var(--primary-light); border-radius: 8px; padding: 10px 14px;
  margin-bottom: 18px; font-size: 12px; color: var(--primary-dark);
}
.calc-hint { margin-top: 6px; font-size: 12px; color: var(--text-light); }

/* 유틸: PC/모바일 전용 */
.mobile-only { display: none; }
.pc-only     { display: inline; }

/* ══ 반응형 ══ */
@media (max-width: 768px) {
  .calc-wrap { padding: 24px 0 40px; }
  .calc-inner { padding: 0 16px; }
  .calc-grid { grid-template-columns: 1fr; gap: 16px; }

  .calc-card { border-radius: 12px; }
  .result-card { position: static; padding: 20px 16px; border-radius: 12px; border-width: 1.5px; }

  .calc-head { padding: 20px 16px 0; }
  .calc-head-divider { margin: 0 -16px; }
  .step-header { padding: 14px 16px; gap: 10px; }
  .step-num { width: 24px; height: 24px; font-size: 11px; }
  .step-title { font-size: 13px; }
  .step-subtitle { font-size: 11px; }
  .step-chevron { width: 24px; height: 24px; font-size: 11px; }
  .step-body { padding: 16px; }
  .calc-btn-area { padding: 0 16px 16px; }

  /* iOS 확대 방지: 입력 폰트 16px 이상 필수 */
  .form-input, .form-select { font-size: 16px; padding: 13px 44px 13px 12px; border-radius: 8px; }
  .form-select { padding: 13px 12px; }
  .form-label { font-size: 12px; }
  .form-label .hint { font-size: 11px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-row-3 { grid-template-columns: 1fr; gap: 0; }
  .form-group { margin-bottom: 16px; }

  .quick-btns { gap: 5px; margin-top: 7px; flex-wrap: wrap; }
  .quick-btn { font-size: 11px; padding: 5px 8px; border-radius: 5px; min-height: 30px; touch-action: manipulation; }

  .counter-row { padding: 11px 0; }
  .counter-label { font-size: 12px; }
  .counter-amount { font-size: 11px; min-width: 55px; }
  .counter-btn { width: 32px; height: 32px; font-size: 16px; touch-action: manipulation; }
  .counter-val { font-size: 14px; min-width: 22px; }

  .check-row { padding: 10px 12px; gap: 8px; border-radius: 8px; }
  .check-row label { font-size: 12px; }
  .check-row .check-amount { font-size: 11px; white-space: nowrap; }
  .check-row input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; }

  .detail-row { font-size: 12px; padding: 6px 0; }
  .detail-row.equals .d-label { font-size: 13px; }
  .detail-row.equals .d-val { font-size: 13px; }
  .rate-badge { font-size: 11px; padding: 2px 7px; }

  .result-final { padding: 18px 14px; border-radius: 10px; }
  .result-final .rf-amount { font-size: 28px; letter-spacing: -0.5px; }
  .result-final .rf-unit { font-size: 16px; }
  .result-final .rf-sub { font-size: 11px; }

  .btn-calculate { font-size: 15px; padding: 15px; border-radius: 10px; touch-action: manipulation; min-height: 52px; }
  .btn-kakao-full { padding: 14px; font-size: 14px; border-radius: 8px; min-height: 50px; touch-action: manipulation; }

  .result-empty { padding: 24px 0; }
  .result-empty p { font-size: 13px; }
  .result-notice { font-size: 11px; padding: 10px 12px; }
  .result-title { font-size: 15px; }
  .result-badge { font-size: 11px; }

  .mobile-only { display: inline; }
  .pc-only     { display: none; }
}

@media (max-width: 380px) {
  .calc-inner { padding: 0 12px; }
  .step-guide-box { flex-direction: column; align-items: flex-start; gap: 4px; }
  .step-guide-arrow { display: none; }
  .quick-btn { font-size: 10px; padding: 4px 6px; }
}
