/* ===== 변수 & 리셋 ===== */
:root {
  --primary: #1a3c6e;
  --accent: #c9a227;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #666;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 레이아웃 ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.site-header {
  background: var(--primary);
  color: white;
  padding: 14px 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header .logo { color: white; font-size: 1.1rem; font-weight: 700; }
.site-header nav { display: flex; gap: 20px; }
.site-header nav a { color: rgba(255,255,255,0.85); font-size: 0.9rem; }
.site-header nav a:hover { color: white; text-decoration: none; }

main.container { padding-top: 32px; padding-bottom: 60px; }

h1 {
  font-size: 1.8rem;
  color: var(--primary);
  font-weight: 800;
}
.subtitle {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.calculator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* ===== 카드 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

/* ===== 입력 패널 ===== */
.input-panel h2 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.field { margin-bottom: 22px; }
.field > label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text);
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.input-wrap:focus-within { border-color: var(--primary); }
.input-wrap input {
  flex: 1;
  border: none;
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
  font-family: inherit;
}
.input-wrap .unit {
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--bg);
  border-left: 1px solid var(--border);
}

.hint {
  font-size: 0.82rem;
  color: var(--accent);
  margin-top: 4px;
  font-weight: 600;
  min-height: 18px;
}

/* 라디오 그룹 */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.radio-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.2s;
  user-select: none;
}
.radio-btn:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}
.radio-btn input { display: none; }

/* 토글 스위치 */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.toggle { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: #ccc; border-radius: 26px;
  cursor: pointer; transition: 0.3s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: 0.3s;
}
.toggle input:checked + .slider { background: var(--primary); }
.toggle input:checked + .slider::before { transform: translateX(22px); }

/* 조정지역 목록 */
.link-btn {
  background: none; border: none;
  color: var(--primary); cursor: pointer;
  font-size: 0.82rem; padding: 0;
  text-decoration: underline;
}
.area-list {
  margin-top: 10px;
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.83rem;
  color: var(--text);
  line-height: 1.8;
}
.area-list.hidden { display: none; }

/* 툴팁 아이콘 */
.tooltip-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 16px; height: 16px;
  background: var(--muted);
  color: white; border-radius: 50%;
  font-size: 0.7rem;
  cursor: help;
  vertical-align: middle;
  margin-left: 4px;
}

/* 일시적 2주택 특례 체크박스 */
#temp2-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 400;
  font-size: 0.9rem;
}
#temp2-field input[type="checkbox"] { width: 16px; height: 16px; }

/* 면적 입력 spinner 제거 */
#area { -moz-appearance: textfield; }
#area::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ===== 결과 패널 ===== */
.result-panel { display: flex; flex-direction: column; gap: 16px; }
.result-panel .card { position: sticky; top: 20px; }

.result-card h2 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.result-notice { color: var(--muted); font-size: 0.9rem; }

.result-body.hidden { display: none; }

.tax-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.tax-name { font-weight: 600; font-size: 0.9rem; flex: 1; }
.tax-rate { color: var(--muted); font-size: 0.82rem; }
.tax-amount { font-weight: 700; font-size: 1rem; color: var(--text); }

.tax-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 16px;
  background: var(--primary);
  border-radius: 8px;
  color: white;
  font-weight: 800;
  font-size: 1.2rem;
}

.effective-rate {
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 8px;
}
.effective-rate strong { color: var(--accent); }

.rate-reason {
  margin-top: 12px;
  padding: 10px 14px;
  background: #eff6ff;
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-size: 0.83rem;
  color: var(--primary);
}

/* 정보 카드 */
.info-card h3 { font-size: 0.95rem; margin-bottom: 10px; color: var(--primary); }
.info-card ul { padding-left: 16px; }
.info-card li {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.5;
}

/* ===== 푸터 ===== */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  padding: 20px 0;
  font-size: 0.85rem;
  text-align: center;
}
.site-footer a { color: rgba(255,255,255,0.7); }

/* ===== 반응형 ===== */
@media (max-width: 768px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }
  .result-panel .card {
    position: static;
  }
  h1 { font-size: 1.4rem; }
  .card { padding: 20px; }
  .radio-group { gap: 6px; }
  .radio-btn { padding: 7px 12px; }
}
