/* ===== calculator.css (PASTEL / HIGH READABILITY) =====
   목표: 가독성(밝은 배경 + 어두운 텍스트), 파스텔 포인트, 아이콘 선명
   - index + detail 공통
*/

:root{
  /* Base */
  --bg:#f6f7fb;
  --fg:#111827;
  --muted:#6b7280;

  --panel:#ffffff;
  --panel2:#fbfcff;
  --border:#e5e7eb;

  /* Pastel accents (strong enough for contrast) */
  --accent:#4f7cff;      /* 파스텔 블루(진하게) */
  --accent2:#2f5dff;     /* 딥 블루 */
  --accentSoft:#e8efff;  /* 연한 파스텔 블루 배경 */
  --accentGlow: rgba(79,124,255,0.18);

  --success:#18a874;
  --warn:#f59e0b;
  --danger:#ef4444;

  --radius:16px;
  --shadow: 0 10px 26px rgba(17,24,39,0.10);
  --shadow2: 0 12px 32px rgba(17,24,39,0.12);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  background:
    radial-gradient(900px 420px at 20% -10%, rgba(79,124,255,0.12), transparent 62%),
    radial-gradient(900px 520px at 90% 0%, rgba(24,168,116,0.08), transparent 62%),
    linear-gradient(180deg, #f6f7fb 0%, #f2f6ff 100%);
  color:var(--fg);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans KR","Apple SD Gothic Neo",system-ui,sans-serif;
}

/* ===== Navbar (옵션) ===== */
.nav{
  position:sticky; top:0; z-index:20;
  background: rgba(246,247,251,0.92);
  backdrop-filter: blur(10px) saturate(140%);
  border-bottom:1px solid var(--border);
}
.nav-inner{
  max-width:980px; margin:0 auto; padding:12px 16px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.nav-logo{
  color:var(--fg); text-decoration:none; font-weight:900; letter-spacing:-0.02em;
}
.nav-sub{ color:var(--muted); font-weight:700; font-size:13px; }
.nav-fav-btn{
  border:1px solid var(--border);
  background:#fff;
  color:var(--fg);
  padding:8px 12px;
  border-radius:999px;
  cursor:pointer;
  font-weight:900;
  transition: box-shadow .12s ease, border-color .12s ease;
}
.nav-fav-btn:hover{ box-shadow: var(--shadow); }
.nav-fav-btn[aria-pressed="true"]{
  border-color: rgba(79,124,255,0.45);
  box-shadow: 0 0 0 3px var(--accentGlow);
}

/* ===== Layout ===== */
.calc-wrap{
  max-width:980px;
  margin:0 auto;
  padding:26px 16px 56px;
}

.calc-hero{
  display:flex;
  gap:16px;
  align-items:flex-end;
  justify-content:space-between;
  margin-bottom:14px;
}

.calc-title{
  margin:0;
  font-size:34px;
  letter-spacing:-0.02em;
}
.calc-sub{
  margin:8px 0 0;
  color:var(--muted);
  line-height:1.55;
  max-width:560px;
}

/* ===== Controls ===== */
.calc-controls{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  padding:10px;
  border:1px solid var(--border);
  border-radius:16px;
  background: rgba(255,255,255,0.70);
  box-shadow: 0 10px 22px rgba(17,24,39,0.05);
}
.calc-search, .calc-sort{
  padding:12px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  color:var(--fg);
  font-size:14px;
}
.calc-search{ min-width:300px; }
.calc-sort{ min-width:130px; }
.calc-search::placeholder{ color: #9aa4b2; }
.calc-search:focus, .calc-sort:focus{
  outline:none;
  border-color: rgba(79,124,255,0.45);
  box-shadow: 0 0 0 4px var(--accentGlow);
}

/* ===== Tabs ===== */
.calc-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.calc-tabs .tab{
  padding:9px 14px;
  border-radius:999px;
  border:1px solid var(--border);
  background: #fff;
  color: var(--fg);
  cursor:pointer;
  font-weight:900;
  transition: background .12s ease, box-shadow .12s ease, border-color .12s ease, color .12s ease;
}
.calc-tabs .tab:hover{ box-shadow: var(--shadow); }
.calc-tabs .tab.active{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: rgba(79,124,255,0.35);
  color:#fff;
  box-shadow: 0 14px 28px rgba(79,124,255,0.25);
}

/* ===== Cards ===== */
.calc-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}

.calc-card{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.85);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease, background .14s ease;
}
.calc-card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow2);
  border-color: rgba(79,124,255,0.18);
  background:#fff;
}
.calc-card.is-fav{
  border-color: rgba(79,124,255,0.40);
  box-shadow: 0 0 0 3px var(--accentGlow);
}

.calc-card-main{
  display:block;
  padding:14px;
  text-decoration:none;
  color:inherit;
}

/* 헤더(썸네일 + 배지) */
.calc-card-head{
  display:flex;
  align-items:center;
  margin-bottom:10px;

  /* ✅ fav 버튼 자리 확보(우상단) */
  padding-right:46px;
}


.calc-head-left{
  display:flex;
  align-items:center;
  gap:10px;
}

/* ✅ 아이콘 선명도: 흰 캡슐 + 충분한 크기 + 필터/투명도 제거 */
.calc-thumb-wrap{
  width:54px;
  height:54px;
  border-radius:14px;
  border:1px solid #e5e7eb;
  background:#fff;

  display:flex;
  align-items:center;
  justify-content:center;

  overflow:hidden; /* 아이콘이 커도 잘림 없이 깔끔 */
}

/* SVG/PNG 공통 */
.calc-thumb{
  width:54px;
  height:54px;

  display:block;            /* inline baseline 영향 제거 */
  object-fit:contain;       /* 비율 유지 */
  object-position:center;   /* 중앙 고정 */

  opacity:1 !important;
  filter:none !important;
  transform: translateZ(0); /* 렌더링 안정(선명도 도움) */
}

/* Badge */
.calc-badge{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  border:1px solid #e5e7eb;
  background:#fff;
}

/* Category-specific subtle tints (optional) */
.calc-card[data-category="health"] .calc-badge{ background: rgba(239,68,68,0.10); }
.calc-card[data-category="fitness"] .calc-badge{ background: rgba(245,158,11,0.12); }
.calc-card[data-category="finance"] .calc-badge{ background: rgba(24,168,116,0.12); }
.calc-card[data-category="salary"] .calc-badge{ background: rgba(99,102,241,0.12); }
.calc-card[data-category="tax"] .calc-badge{ background: rgba(148,163,184,0.14); }

.calc-card-title{
  font-weight:950;
  font-size:16px;
  letter-spacing:-0.01em;
  margin:2px 0 6px;
}
.calc-card-desc{
  color: #4b5563;
  font-size:13px;
  line-height:1.55;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:40px;
}

.calc-card-meta{
  margin-top:10px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.calc-key{
  font-size:12px;
  color:#6b7280;
  padding:6px 10px;
  border:1px solid rgba(17,24,39,0.08);
  border-radius:999px;
  background: rgba(255,255,255,0.90);
}
.calc-cta{
  font-size:12px;
  font-weight:900;
  color: rgba(17,24,39,0.72);
}

/* ✅ 즐겨찾기 버튼: 기본 버튼 스타일 제거 + 모양 고정 */
.fav-btn{
  position:absolute; top:12px; right:12px;
  width:34px; height:34px;
  border-radius:999px;

  padding:0;
  border:1px solid #e5e7eb;
  background:#fff;
  background-image:none;
  appearance:none;
  -webkit-appearance:none;

  display:flex;
  align-items:center;
  justify-content:center;

  cursor:pointer;
  z-index:10;

  font-size:16px;
  line-height:1;
  font-weight:900;
}
.calc-card:hover .fav-btn{
  background:#fff;
  color: rgba(17,24,39,0.78);
  box-shadow: 0 10px 18px rgba(17,24,39,0.12);
}
.fav-btn:hover{
  box-shadow:0 8px 18px rgba(0,0,0,0.08);
}
.fav-btn[aria-pressed="true"]{
  border-color:#111827;
}

/* Empty state */
.calc-empty{
  margin-top:16px;
  color: #4b5563;
  border:1px dashed rgba(17,24,39,0.18);
  border-radius:18px;
  padding:18px;
  background: rgba(255,255,255,0.70);
}

/* ===== Detail page ===== */
.container{
  max-width:980px;
  margin:0 auto;
  padding:26px 16px 56px;
}
.topbar{ display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.back{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:var(--fg);
  text-decoration:none;
  padding:9px 12px;
  border-radius:999px;
  border:1px solid rgba(17,24,39,0.10);
  background: rgba(255,255,255,0.85);
  font-weight:900;
  box-shadow: 0 10px 18px rgba(17,24,39,0.06);
}
.back:hover{ box-shadow: var(--shadow); }

h1{ font-size:30px; margin:8px 0 10px; letter-spacing:-0.02em; }
.desc{ color:var(--muted); margin:0 0 18px; line-height:1.6; }

.card{
  border-radius: var(--radius);
  background: rgba(255,255,255,0.88);
  border:1px solid rgba(17,24,39,0.10);
  padding:18px;
  box-shadow: var(--shadow);
}

.calc-form{ display:grid; gap:14px; max-width:560px; }
.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.field{ display:grid; gap:8px; }
.label-row{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
label{ font-weight:900; }
.unit{ color:#6b7280; font-weight:800; font-size:12px; }
.hint{ color:#6b7280; font-size:13px; line-height:1.4; }

input, select, textarea{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(17,24,39,0.10);
  background:#fff;
  color:var(--fg);
  font-size:15px;
}
input::placeholder{ color:#9aa4b2; }

input:focus, select:focus, textarea:focus{
  outline:none;
  border-color: rgba(79,124,255,0.45);
  box-shadow: 0 0 0 4px var(--accentGlow);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 14px;
  border:0;
  border-radius:14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color:#fff;
  font-weight:950;
  cursor:pointer;
  box-shadow: 0 14px 26px rgba(79,124,255,0.22);
}
.btn:active{ transform: translateY(1px); }
.btn.is-loading{ opacity:.85; }

.result{
  margin-top:16px;
  border-top:1px solid rgba(17,24,39,0.10);
  padding-top:16px;
}
.result-title{ font-size:18px; margin:0 0 10px; letter-spacing:-0.01em; }
.result-message{ color:#4b5563; margin-top:8px; line-height:1.45; }

.result-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  border-radius:14px;
  overflow:hidden;
  border:1px solid rgba(17,24,39,0.10);
  background:#fff;
}
.result-table td{
  padding:12px 12px;
  border-bottom:1px solid rgba(17,24,39,0.08);
}
.result-table tr:last-child td{ border-bottom:0; }
.result-table td:first-child{
  width:46%;
  font-weight:950;
  background: rgba(79,124,255,0.08);
  color:#1f2a44;
}

/* Responsive */
@media (max-width: 920px){
  .calc-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px){
  .calc-hero{ align-items:stretch; flex-direction:column; }
  .calc-controls{ justify-content:stretch; }
  .calc-search, .calc-sort{ width:100%; min-width:0; }
  .calc-grid{ grid-template-columns:1fr; }
  .grid-2{ grid-template-columns:1fr; }
  h1{ font-size:26px; }
}
