/* ── 하스피톡 비급여 가격비교 — Custom CSS ── */

/* Tabular numbers for price columns */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ── 병원 비교 ── */
.compare-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.4rem 0.7rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  background: #fff;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.compare-toggle:hover { border-color: #5eead4; color: #0f766e; background: #f0fdfa; }
.compare-toggle[aria-pressed="true"] { border-color: #0f766e; color: #fff; background: #0f766e; }
.compare-toggle[aria-pressed="true"]:hover { border-color: #115e59; background: #115e59; }

.hospital-compare-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 190px;
  padding: .35rem .45rem .35rem .65rem;
  border: 1px solid #334155;
  border-radius: 999px;
  background: #1e293b;
  color: #f8fafc;
  font-size: .75rem;
}
.hospital-compare-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hospital-compare-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 1rem;
  line-height: 1;
}
.hospital-compare-chip-remove:hover { background: #475569; color: #fff; }
.hospital-compare-action.is-disabled { cursor: not-allowed; opacity: .5; }

.compare-search-result {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}
.compare-search-result:last-child { border-bottom: 0; }
.compare-search-result:not(:disabled):hover { background: #f0fdfa; }
.compare-search-result:disabled { cursor: default; background: #f8fafc; opacity: .72; }
.compare-search-result-status { flex: none; color: #0f766e; font-size: .75rem; font-weight: 700; }
body.has-hospital-compare .scroll-top-btn { bottom: 9rem; }

@media (max-width: 640px) {
  .hospital-compare-chip { max-width: 135px; }
}
@media (min-width: 768px) {
  body.has-hospital-compare .scroll-top-btn { bottom: 7rem; }
}

/* 커스텀 셀렉트 박스 — 화살표/텍스트 겹침 방지 */
.filter-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem 1.1rem;
  padding: 0.6rem 2.25rem 0.6rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-select:hover { border-color: #94a3b8; }
.filter-select:focus {
  outline: none;
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}
.filter-select::-ms-expand { display: none; }

/* Nav link — desktop (legacy) */
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover {
  color: #0f766e;
  background: #f0fdfa;
}
.nav-link.active {
  color: #0f766e;
  background: #f0fdfa;
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: #0f766e;
  border-radius: 1px;
}

/* Nav pill — desktop (compact: small icon + label, single line) */
.nav-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-pill:hover {
  background: #f8fafc;
  color: #0f766e;
}
.nav-pill.active {
  background: #f0fdfa;
  color: #0f766e;
}
.nav-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
}
.nav-pill-icon svg { width: 14px; height: 14px; }
.nav-pill.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  background: #0d9488;
  border-radius: 1px;
}

/* Per-menu icon color variants */
.nri-teal   { background: #ccfbf1; color: #0d9488; }
.nri-blue   { background: #dbeafe; color: #2563eb; }
.nri-green  { background: #dcfce7; color: #16a34a; }
.nri-purple { background: #ede9fe; color: #7c3aed; }

/* Mobile nav item enhancements */
.nav-mobile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s;
}
.nav-mobile:hover { background: #f8fafc; }
.nav-mobile.active { background: #f0fdfa; }
.nav-mobile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  flex-shrink: 0;
}
.nav-mobile-icon svg { width: 18px; height: 18px; }
.nav-mobile-label { font-size: 0.9375rem; font-weight: 600; color: #0f172a; line-height: 1.2; }
.nav-mobile-sub { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; line-height: 1.2; }
.nav-mobile.active .nav-mobile-label { color: #0f766e; }

/* Pagination */
.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #475569;
  transition: background 0.15s, border-color 0.15s;
}
.pg-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.pg-btn.pg-nav {
  width: auto;
  min-width: 4.75rem;
  padding: 0 0.75rem;
  gap: 0.25rem;
}
.pg-active,
.pg-active:hover {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
}
.pg-active:hover {
  background: #115e59;
}
.pg-disabled,
.pg-disabled:hover {
  color: #cbd5e1;
  background: #ffffff;
  border-color: #e2e8f0;
  cursor: not-allowed;
}
.pg-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.875rem;
  color: #94a3b8;
}

.load-more-btn {
  width: min(100%, 22rem);
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: 1px solid #0f766e;
  border-radius: 0.75rem;
  background: #f0fdfa;
  color: #0f766e;
  font-size: 0.9375rem;
  font-weight: 700;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.load-more-btn:hover { background: #ccfbf1; }
.load-more-btn:disabled { opacity: 0.6; cursor: wait; }

.list-return-btn {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.75rem;
  padding: 0 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #334155;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  font-size: 0.8125rem;
  font-weight: 700;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s, border-color 0.15s;
}
.list-return-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.list-return-btn:hover { border-color: #0f766e; color: #0f766e; }
body.has-hospital-compare .list-return-btn { bottom: 12.75rem; }

@media (max-width: 640px) {
  .list-return-btn { right: 1rem; bottom: 4.75rem; }
  body.has-hospital-compare .list-return-btn { bottom: 10.75rem; }
}

/* Line clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Autocomplete — 섹션 그룹 */
.ac-section + .ac-section {
  border-top: 1px solid #f1f5f9;
}
.ac-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
}
.ac-section-head .ac-count {
  font-weight: 500;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0;
}
.ac-clear {
  font-size: 0.7rem;
  font-weight: 500;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.ac-clear:hover { color: #475569; }

/* Autocomplete item */
.ac-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
}
.ac-item:hover,
.ac-item.ac-active {
  background: #f0fdfa;
}
.ac-main {
  flex: 1;
  min-width: 0;
}
.ac-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-sub {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-cat { color: #64748b; margin-right: 0.4rem; }
.ac-meta { color: #94a3b8; }
.ac-cat + .ac-meta::before { content: '·'; margin: 0 0.3rem; color: #cbd5e1; }
.ac-price {
  font-size: 0.7rem;
  font-weight: 600;
  color: #16a34a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.ac-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.ac-badge-blue { background: #dbeafe; color: #2563eb; }
.ac-recent {
  align-items: center;
}
.ac-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
}
.ac-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  font-size: 0.8rem;
  color: #0f766e;
  background: #f0fdfa;
  border-top: 1px solid #ccfbf1;
  font-weight: 500;
}
.ac-footer:hover, .ac-footer.ac-active { background: #ccfbf1; }
/* Popular keyword chips (autocomplete empty state) */
.ac-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1rem 0.85rem;
}
.ac-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 0.25rem 0.7rem;
  text-decoration: none;
  transition: all 0.15s;
}
.ac-chip:hover { background: #ccfbf1; border-color: #5eead4; color: #0f766e; }

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Focus ring — 모든 인터랙티브 요소에 명확한 키보드 포커스 표시 */
:focus-visible {
  outline: 2px solid #0f766e;
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
[role="button"]:focus-visible,
.ac-chip:focus-visible {
  outline-offset: 3px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 0;
}

/* sr-only — 스크린리더 전용, 시각적으로 숨김 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.sr-only.focus\:not-sr-only:focus,
.focus\:not-sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: revert;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* prefers-reduced-motion — 모션 민감 사용자 배려 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Print */
@media print {
  header, footer, nav, .pg-btn, .scroll-top-btn, #hospitalCompareBar { display: none !important; }
  main { padding: 0 !important; }
}

/* ── SEO 하단 콘텐츠 공통 디자인 ── */
.seo-section {
  position: relative;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 60%);
  border-top: 1px solid #e2e8f0;
  margin-top: 2.5rem;
}
.seo-section::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 3px;
  background: linear-gradient(90deg, #0d9488, #14b8a6);
  border-radius: 0 0 3px 3px;
}
.seo-content {
  max-width: 56rem;
  margin: 0 auto;
  padding: 3rem 1rem 3.5rem;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: #475569;
}
.seo-content > *:first-child { margin-top: 0; }
.seo-content h2 {
  position: relative;
  display: inline-block;
  font-size: 1.375rem;
  font-weight: 700;
  color: #0f172a;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
}
.seo-content h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 32px;
  height: 3px;
  background: #0d9488;
  border-radius: 2px;
}
.seo-content h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #1e293b;
  margin: 2rem 0 0.75rem;
}
.seo-content p {
  margin: 0.875rem 0;
}
.seo-content strong {
  color: #0f766e;
  font-weight: 700;
}
.seo-content a {
  color: #0d9488;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.seo-content a:hover {
  border-bottom-color: #0d9488;
}
.seo-content dl {
  margin: 1.25rem 0 0;
  border-top: 1px solid #e2e8f0;
}
.seo-content dt {
  position: relative;
  padding: 1rem 0 0.5rem 2rem;
  font-weight: 600;
  color: #0f172a;
  font-size: 0.95rem;
}
.seo-content dt::before {
  content: 'Q';
  position: absolute;
  left: 0;
  top: 0.95rem;
  width: 1.4rem;
  height: 1.4rem;
  background: #ccfbf1;
  color: #0f766e;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.seo-content dd {
  position: relative;
  padding: 0 0 1rem 2rem;
  margin: 0;
  color: #475569;
  font-size: 0.9rem;
  border-bottom: 1px solid #e2e8f0;
}
.seo-content dd::before {
  content: 'A';
  position: absolute;
  left: 0;
  top: 0;
  width: 1.4rem;
  height: 1.4rem;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.seo-content dd:last-child { border-bottom: none; }

/* ── 플로팅 상단 이동 버튼 ── */
.scroll-top-btn {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 44px;
  height: 44px;
  background: #0f766e;
  color: #fff;
  border: none;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.92);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.15s;
  z-index: 40;
}
.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.scroll-top-btn:hover {
  background: #115e59;
}
.scroll-top-btn:active {
  transform: translateY(0) scale(0.95);
}
.scroll-top-btn svg {
  width: 20px;
  height: 20px;
}
@media (min-width: 768px) {
  .scroll-top-btn {
    right: 1.5rem;
    bottom: 1.5rem;
    width: 48px;
    height: 48px;
  }
  .scroll-top-btn svg {
    width: 22px;
    height: 22px;
  }
}
