/* ==============================================================
   style.css  =  디자인(색상/여백/글꼴/반응형) 담당
   숫자 계산이나 화면 구조와는 분리되어 있습니다.
   색상 값만 바꾸면 전체 테마를 쉽게 바꿀 수 있습니다.
   ============================================================== */

/* 색상 팔레트 (여기 값만 바꾸면 테마가 바뀝니다) */
:root {
  --bg: #f4f6f8;          /* 페이지 배경 */
  --card: #ffffff;        /* 카드 배경 */
  --text: #1a2233;        /* 기본 글자색 */
  --muted: #6b7688;       /* 흐린 글자색 */
  --primary: #2563eb;     /* 메인 색 (버튼/강조) */
  --primary-dark: #1d4ed8;
  --danger: #dc2626;      /* 공제(빠지는 돈) 표시색 */
  --border: #e2e6ec;      /* 경계선 */
  --radius: 14px;
}

/* 기본 초기화 */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--bg); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--text);
  line-height: 1.6;
  padding: 16px;
}

/* ===== 헤더 ===== */
.site-header {
  text-align: center;
  max-width: 560px;
  margin: 8px auto 20px;
}
.site-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* ===== 레이아웃 컨테이너 ===== */
.container {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== 카드 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h2 {
  font-size: 1.1rem;
  margin-bottom: 14px;
}

/* ===== 입력 필드 ===== */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
}
#salary {
  width: 100%;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: right;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}
#salary:focus { border-color: var(--primary); }

/* ===== 버튼 ===== */
.btn {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 14px;
  transition: transform 0.05s, background 0.15s;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

/* 빠른 금액 추가 버튼 묶음 */
.quick-add {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.btn-quick {
  background: #eef2ff;
  color: var(--primary-dark);
  font-size: 0.9rem;
  padding: 10px 4px;
}
.btn-quick:hover { background: #e0e7ff; }
.btn-reset {
  background: #f1f3f5;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 10px 4px;
}
.btn-reset:hover { background: #e5e8eb; }

/* ===== 결과 영역 ===== */
.result-card { border-top: 4px solid var(--primary); }

.result-highlight {
  background: #eff4ff;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  margin-bottom: 16px;
}
.result-highlight-label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.result-highlight-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.result-list { list-style: none; }
.result-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 0.98rem;
}
.result-list li span { color: var(--muted); }
.result-list li strong { font-weight: 700; }
.result-list li.deduct strong { color: var(--danger); }
.result-list li.total {
  border-bottom: none;
  border-top: 2px solid var(--border);
  margin-top: 4px;
  font-weight: 800;
}
.result-list li.total span { color: var(--text); font-weight: 700; }

.note {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ===== 광고 영역 ===== */
.ad-slot {
  max-width: 560px;
  margin: 0 auto;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aab2bd;
  font-size: 0.85rem;
  background: repeating-linear-gradient(45deg, #f0f2f5, #f0f2f5 10px, #eaedf1 10px, #eaedf1 20px);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
/* 배포(production) 환경에서는 아래 클래스가 body에 붙어 광고 자리를 숨깁니다 */
body.is-production .ad-slot { display: none; }

/* ===== 푸터 ===== */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 24px auto 8px;
}

/* ===== 반응형: 화면이 좁으면 빠른버튼 2열로 ===== */
@media (max-width: 420px) {
  .quick-add { grid-template-columns: repeat(2, 1fr); }
  .site-header h1 { font-size: 1.3rem; }
  .result-highlight-value { font-size: 1.6rem; }
}
