/* ===================== 변액 펀드 수익률 (js/funds.js) =====================
   표 자체는 공시이율 표(.rates-table)를 그대로 씁니다. 여기에는 이 화면에만
   있는 것들(기간 버튼 줄, 비교 체크, 아래 비교 바, 상세·비교 창, 그래프)만 둡니다.
   색은 새로 들이지 않습니다 — 오름 빨강·내림 파랑(.rates-up/.rates-down)과
   잉크·주황 버튼은 style.css의 것을 씁니다. 그래프 선 색만 js/funds.js에 있습니다. */

.funds-sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* 기간 버튼. 변액수익률의 유지기간 버튼(.rates-pbtn)과 같은 모양입니다. */
.funds-period {
  display: flex;
  gap: 6px;
  margin: 4px 0 2px;
}
.funds-period .rates-pbtn { flex: 0 0 auto; padding: 7px 16px; }
/* 보라색은 변액수익률(예상치) 화면의 색입니다. 같은 색을 쓰면 같은 자료로 읽혀서
   이쪽은 사이트 기본 잉크색으로 둡니다. */
.funds-period .rates-pbtn:hover { border-color: var(--navy-light); }
.funds-period .rates-pbtn.active { background: var(--navy); border-color: var(--navy); color: #fff; }

.funds-controls .funds-search { flex: 1 1 220px; }
.funds-search input {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  background: #fff;
  color: var(--text-dark);
  width: 100%;
}
.funds-search input:focus { outline: 2px solid var(--blue-accent); }

/* 표 — 펀드명과 보험사를 한 칸에 두 줄로 묶어 휴대폰에서도 가로로 덜 밀리게 합니다. */
.funds-table { min-width: 520px; }
.funds-table th, .funds-table td { padding: 10px 10px; }
.funds-chk-col { width: 36px; text-align: center !important; }
.funds-chk-col input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--navy); }
.funds-rank-col { width: 44px; color: var(--text-light); font-variant-numeric: tabular-nums; }
.funds-name-col { white-space: normal !important; min-width: 180px; }
.funds-name {
  display: block;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--text-dark);
  text-align: left;
  cursor: pointer;
}
.funds-name:hover { color: var(--blue-accent); text-decoration: underline; }
.funds-sub { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--text-light); }
/* .rates-table th/td의 왼쪽 정렬이 .rates-num보다 우선해서 여기서 다시 밉니다. */
.funds-table th.rates-num, .funds-table td.rates-num { text-align: right; font-variant-numeric: tabular-nums; }
/* 고른 기간 칸을 옅게 칠해 "지금 이 숫자로 줄 세웠다"가 보이게 합니다. */
.funds-table .funds-col-on { background: #f8fafc; }
.funds-table th.funds-col-on { color: var(--navy); }
.funds-row-on td { background: #fff7ed !important; }
.funds-none { color: var(--text-light); }

.funds-more { display: block; margin: 14px auto 0; }

/* ---- 아래에 붙는 비교 바 ---- */
.funds-cmpbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 18px;
  background: var(--navy);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  width: max-content;
  max-width: calc(100% - 32px);
}
.funds-cmpbar[hidden] { display: none; }
.funds-cmpbar-text { font-size: 0.85rem; font-weight: 700; margin-right: 4px; }
.funds-cmpbar .btn-ghost { color: #cbd5e1; }
.funds-cmpbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.funds-cmpbar .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
/* 바가 떠 있는 동안 표 맨 아래·푸터가 바에 가리지 않게 여백을 줍니다. */
body.funds-cmpbar-on { padding-bottom: 80px; }

/* ---- 상세 · 비교 창 ---- */
.funds-modal { max-width: 640px; }
.funds-modal-wide { max-width: 760px; }
.funds-modal-kicker { margin: 0 0 4px; font-size: 0.8rem; font-weight: 700; color: var(--text-light); }
.funds-modal-title { margin: 0; font-size: 1.2rem; font-weight: 900; color: var(--navy); line-height: 1.35; }
.funds-basis { margin: 8px 0 0; font-size: 0.78rem; color: var(--text-mid); }
.funds-basis strong { color: var(--navy); }

.funds-rets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.funds-ret {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  text-align: center;
}
.funds-ret-label { display: block; font-size: 0.75rem; color: var(--text-light); margin-bottom: 4px; }
.funds-ret-val { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.funds-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 0 0 18px;
}
.funds-facts dt { font-size: 0.74rem; color: var(--text-light); margin-bottom: 2px; }
.funds-facts dd { margin: 0; font-size: 0.88rem; font-weight: 600; color: var(--text-dark); }
.funds-hint { font-size: 0.72rem; font-weight: 400; color: var(--text-light); }
.funds-code { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem !important; font-weight: 400 !important; }

.funds-chart-title { margin: 6px 0 8px; font-size: 0.9rem; font-weight: 700; color: var(--navy); }
.funds-chart { min-height: 120px; }
.funds-chart-empty { padding: 40px 0; text-align: center; font-size: 0.85rem; color: var(--text-light); }
.funds-svg-wrap { position: relative; }
.funds-svg-wrap svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.funds-grid { stroke: #eef1f4; stroke-width: 1; }
.funds-base { stroke: #9ca3af; stroke-width: 1; stroke-dasharray: 3 3; }
.funds-axis { font-size: 11px; fill: var(--text-light); font-family: inherit; }
.funds-cross { stroke: #9ca3af; stroke-width: 1; }
.funds-tip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--text-dark);
  pointer-events: none;
  white-space: nowrap;
}
.funds-tip strong { display: block; margin-bottom: 2px; }
.funds-tip span { display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.funds-tip i, .funds-legend i, .funds-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
}
.funds-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 6px; font-size: 0.78rem; color: var(--text-mid); }
.funds-legend span { display: inline-flex; align-items: center; gap: 6px; }
.funds-swatch { margin-right: 6px; vertical-align: -1px; }

.funds-cmp-wrap { margin: 14px 0 18px; }
.funds-cmp-table { min-width: 0; }
.funds-cmp-table th, .funds-cmp-table td { white-space: normal; }
.funds-cmp-table tbody th { color: var(--text-light); font-weight: 600; width: 72px; background: #fff; position: static; }
.funds-cmp-table td { font-variant-numeric: tabular-nums; }

.funds-disclaimer {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.74rem;
  line-height: 1.7;
  color: var(--text-light);
}
.funds-disclaimer a, .rates-source a, .prem-note-sub a { color: var(--navy-light); text-decoration: underline; }

@media (max-width: 640px) {
  .funds-period .rates-pbtn { flex: 1 1 0; }
  .funds-table { min-width: 0; }
  .funds-table th, .funds-table td { padding: 9px 6px; font-size: 0.8rem; }
  .funds-rank-col { width: 28px; }
  .funds-name-col { min-width: 120px; }
  /* 휴대폰에서는 세 기간을 다 펴면 3년 칸이 화면 밖으로 밀립니다. 위 기간 버튼으로
     고른 칸 하나만 보여주고, 나머지 둘은 상세·비교 창에서 봅니다. */
  .funds-table [data-col]:not(.funds-col-on) { display: none; }
  .funds-modal { padding: 24px 18px; }
  .funds-facts { grid-template-columns: 1fr; }
  .funds-ret-val { font-size: 0.95rem; }
  .funds-cmpbar { gap: 6px; padding: 8px 8px 8px 14px; }
  .funds-cmpbar .btn { padding: 8px 10px; font-size: 0.8rem; }
}
