/* ============================================================
   MediFind - style.css
   디자인 전면 개편: 전 페이지 스타일 통합 및 최적화
   ============================================================ */

:root {
  --color-primary: #2563EB;
  --color-primary-dark: #1E40AF;
  --color-primary-light: #EFF6FF;
  --color-secondary: #10B981;
  --color-secondary-dark: #059669;
  --color-emergency: #DC2626;
  --color-emergency-light: #FEF2F2;
  --color-night: #7C3AED;
  --color-night-light: #F5F3FF;
  --color-sunday: #EA580C;
  --color-sunday-light: #FFF7ED;
  --color-text-dark: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-main: 'Sora', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --container-max: 1100px;
  --header-height: 64px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  color: var(--color-text-dark);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; transition: var(--transition); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select {
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background-color: #fff;
  color: var(--color-text-dark);
  transition: border-color var(--transition);
}
input:focus, select:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

/* ── 모든 select box: 둥근 pill 디자인 + 커스텀 화살표 ── */
select {
  border-radius: 999px;
  padding: 10px 40px 10px 18px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px;
}
select::-ms-expand { display: none; }


.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* 글로벌 페이지 레이아웃 */
.page-wrapper {
  display: flex;
  gap: 32px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
  align-items: flex-start;
}
.page-content {
  flex: 1;
  min-width: 0;
}
.page-sidebar {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 90px;
}

/* ============================================================
   헤더
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
}
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 900;
}
.main-nav { display: flex; gap: 8px; }
.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}
.nav-link:hover { color: var(--color-primary); background: var(--color-primary-light); }

/* 헤더 검색 (모바일) */
.header-search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--color-text-secondary);
  transition: var(--transition);
}
.header-search-toggle:hover { background: var(--color-primary-light); color: var(--color-primary); }

.header-search-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: #fff;
  z-index: 1001;
  align-items: center;
  padding: 0 12px;
  animation: searchSlideIn 0.2s ease;
}
.header-search-overlay.active { display: flex; }

@keyframes searchSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-search-form {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}
.header-search-input {
  flex: 1;
  border: none;
  font-size: 16px;
  padding: 10px 0;
  outline: none;
  background: transparent;
}
.header-search-input:focus { box-shadow: none; }
.header-search-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
}
.header-search-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-text-secondary);
}
.header-search-close:hover { background: var(--color-border-light); }

/* 인기 검색어 */
.trending-searches {
  padding: 28px 0;
  border-top: 1px solid var(--color-border-light);
}
.trending-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--color-text-dark);
}
.trending-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.trending-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 20px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  transition: var(--transition);
}
.trending-tag:hover {
  background: var(--color-primary);
  color: #fff;
}
.trending-rank {
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 16px;
}

/* 최근 본 항목 */
.recent-viewed {
  padding: 28px 0;
}
.recent-viewed-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-text-dark);
}
.recent-viewed-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.recent-viewed-list::-webkit-scrollbar { display: none; }
.recent-viewed-card {
  flex-shrink: 0;
  width: 160px;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: var(--transition);
}
.recent-viewed-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.recent-viewed-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.recent-viewed-type {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ============================================================
   히어로 섹션
   ============================================================ */
.hero {
  padding: 60px 0;
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  color: #fff;
  text-align: center;
}
.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 40px;
}
.hero .search-bar { max-width: 600px; margin: 0 auto; }

/* ============================================================
   검색바
   ============================================================ */
.search-input-wrap {
  display: flex;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  padding: 4px;
}
.search-input {
  flex: 1;
  border: none;
  padding: 14px 20px;
  font-size: 1rem;
  outline: none;
  color: var(--color-text-dark);
}
.search-btn {
  background: var(--color-primary);
  color: #fff;
  padding: 0 24px;
  border-radius: 8px;
  font-weight: 700;
  transition: var(--transition);
}
.search-btn:hover { background: var(--color-primary-dark); }

/* ============================================================
   빠른 링크 카드
   ============================================================ */
.quick-links { margin-top: -30px; margin-bottom: 40px; }
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.quick-card {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: 0.3s;
  border: 1px solid transparent;
  color: var(--color-text-dark);
}
.quick-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary-light);
}
.quick-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}
.quick-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.quick-card p { font-size: 0.85rem; color: var(--color-text-secondary); }

/* ============================================================
   브레드크럼
   ============================================================ */
.breadcrumb { padding: 20px 0 10px; }
.breadcrumb-list { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--color-text-muted); }
.breadcrumb-item::after { content: '/'; margin-left: 6px; opacity: 0.5; }
.breadcrumb-item:last-child::after { display: none; }
.breadcrumb-item a:hover { color: var(--color-primary); }
.breadcrumb-current { color: var(--color-text-secondary); font-weight: 600; }

/* ============================================================
   페이지/리스트 헤더
   ============================================================ */
.list-header { margin-bottom: 24px; }
.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--color-text-dark);
}
.list-count { font-size: 0.95rem; color: var(--color-text-muted); }
.list-count strong { color: var(--color-primary); }
.list-notice {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--color-sunday-light);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--color-sunday);
  border-left: 4px solid var(--color-sunday);
}

/* ============================================================
   지역 선택 (Selector & Grid)
   ============================================================ */
.region-selector { margin-bottom: 24px; }
.region-selector-row { display: flex; gap: 10px; flex-wrap: wrap; }
.region-select {
  padding: 12px 40px 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background-color: #fff;
  min-width: 140px;
  cursor: pointer;
}
.region-select:focus { border-color: var(--color-primary); outline: none; }
.region-select:disabled { background-color: var(--color-bg); cursor: not-allowed; opacity: 0.7; }

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--color-text-dark);
}
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.cat-tab {
  padding: 8px 18px;
  border-radius: 30px;
  background: #fff;
  border: 1px solid var(--color-border);
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.cat-tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.region-card {
  background: #fff;
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--color-border);
  font-weight: 600;
  transition: var(--transition);
  color: var(--color-text-dark);
}
.region-card:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-2px);
}

/* ============================================================
   기관 카드 (병원/약국 리스트 아이템)
   ============================================================ */
.inst-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 40px; }
.inst-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.inst-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}
.inst-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 12px; }
.inst-name { font-size: 1.15rem; font-weight: 800; color: var(--color-text-dark); }
.inst-name a:hover { color: var(--color-primary); }
.inst-cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  align-items: center;
}
.inst-cat-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #EEF2FF;
  color: #4338CA;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 999px;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
a.inst-cat-badge:hover { background: #4338CA; color: #fff; }
.inst-cat-more {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--color-text-muted);
  padding: 3px 4px;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-open { background: #ECFDF5; color: #059669; }
.status-closed { background: #FEF2F2; color: #DC2626; }
.status-unknown { background: #F1F5F9; color: #64748B; }

.inst-card-body { color: var(--color-text-secondary); font-size: 0.9rem; }
.inst-info-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.inst-info-item svg { color: var(--color-text-muted); flex-shrink: 0; }

.inst-card-footer { display: flex; gap: 10px; margin-top: 20px; }
.btn-action {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.9rem;
}
.btn-call { background: var(--color-primary-light); color: var(--color-primary); }
.btn-map { background: var(--color-border-light); color: var(--color-text-dark); }
.btn-detail { background: var(--color-primary); color: #fff; }
.btn-call:hover { background: #DBEAFE; }
.btn-map:hover { background: #E2E8F0; }
.btn-detail:hover { background: var(--color-primary-dark); }

/* ============================================================
   상세 페이지
   ============================================================ */
.detail-header { padding: 30px 0 20px; border-bottom: 1px solid var(--color-border); margin-bottom: 30px; }
.detail-title-row { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.detail-name { font-size: 2rem; font-weight: 800; }
.detail-category { color: var(--color-text-muted); font-size: 1rem; }

.detail-grid { display: grid; grid-template-columns: 1fr 380px; gap: 30px; margin-bottom: 40px; }
.detail-section-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid var(--color-border-light); }

.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; padding: 14px 0; border-bottom: 1px solid var(--color-border-light); }
.info-row dt { width: 100px; font-weight: 600; color: var(--color-text-secondary); flex-shrink: 0; }
.info-row dd { color: var(--color-text-dark); word-break: break-all; }

.hours-list { background: #fff; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--color-border); }
.hours-row { display: flex; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--color-border-light); }
.hours-row:last-child { border-bottom: none; }
.hours-row--today { background: var(--color-primary-light); font-weight: 700; color: var(--color-primary-dark); }
.hours-day { display: flex; align-items: center; gap: 8px; }
.hours-today-dot { width: 8px; height: 8px; background: var(--color-primary); border-radius: 50%; }
.hours-closed-text { color: var(--color-emergency); }

.detail-map-container { width: 100%; height: 400px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); }

/* ============================================================
   카테고리 선택 페이지 (전용)
   ============================================================ */
.category-hero { text-align: center; padding: 40px 0; }
.category-hero-title { font-size: 2.25rem; font-weight: 800; margin-bottom: 10px; }
.category-hero-desc { color: var(--color-text-secondary); font-size: 1.1rem; }

.nearby-toggle-section { text-align: center; margin-bottom: 40px; }
.btn-nearby-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 30px;
  background: #fff;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: 50px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}
.btn-nearby-toggle:hover { background: var(--color-primary); color: #fff; }

.category-select-section {
  max-width: 600px;
  margin: 0 auto 50px;
  padding: 30px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.category-select-label { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.category-select-row { display: flex; gap: 12px; justify-content: center; }

/* ============================================================
   페이지네이션
   ============================================================ */
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 40px 0; }
.page-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.page-link:hover { border-color: var(--color-primary); color: var(--color-primary); }
.page-current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ============================================================
   푸터
   ============================================================ */
.site-footer {
  background: #1E293B;
  color: #94A3B8;
  padding: 60px 0 40px;
  margin-top: 80px;
}
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; }
.footer-title { color: #fff; font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.footer-links li { margin-bottom: 12px; }
.footer-links a:hover { color: #fff; text-decoration: underline; }

/* ============================================================
   애드센스 & 유틸리티
   ============================================================ */
.nearby-group-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text-dark);
  margin: 30px 0 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-primary-light);
}
.nearby-group:first-child .nearby-group-title { margin-top: 0; }
.nearby-group { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }
.nearby-group .nearby-group-title { margin-bottom: 0; }

/* ── 내 주변 결과 아코디언 (개수만 → 클릭 시 펼침) ── */
.nearby-acc {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 6px;
  overflow: hidden;
}
.nearby-acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.nearby-acc-head:hover { background: var(--color-bg); }
.nearby-acc-title { font-size: 1.05rem; font-weight: 800; color: var(--color-text-dark); }
.nearby-acc-count {
  margin-left: auto;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 4px 12px;
  border-radius: 999px;
}
.nearby-acc-chevron { color: var(--color-text-muted); transition: transform 0.2s ease; flex-shrink: 0; }
.nearby-acc.open .nearby-acc-chevron { transform: rotate(180deg); }
.nearby-acc-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 14px 16px;
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}
.nearby-acc-body[hidden] { display: none; }
/* #nearbyList 는 .inst-list(gap:16px) 라 아코디언 간격이 벌어짐 → gap 제거하고 마진으로 제어 */
#nearbyList { gap: 0; margin-bottom: 24px; }
/* 그룹 사이 광고: 비어있을 땐 공간 0, 채워지면 자체 높이만 차지 */
.nearby-ad.nearby-ad-between { margin: 0; min-height: 0; }
.nearby-acc-body .nearby-ad { margin: 4px 0 0; }

.ad-container { 
  margin: 30px auto; 
  text-align: center; 
  min-height: 100px; 
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}
.ad-item { 
  margin-bottom: 20px; 
  display: flex;
  justify-content: center;
  width: 100%;
}
.ad-item > * { max-width: 100% !important; }
.ad-item:last-child { margin-bottom: 0; }
.ad-notice { font-size: 11px; color: var(--color-text-muted); margin-top: 6px; }
.ad-top .ad-item {
  display: block;
  width: 100%;
  max-width: 1000px;
  min-height: 280px;
  margin-left: auto;
  margin-right: auto;
}
.ad-top ins.adsbygoogle {
  display: block !important;
  width: 100%;
  min-width: 250px;
}
.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}
.ad-container:has(.adsbygoogle[data-ad-status="unfilled"]) {
  min-height: 0;
  margin-top: 0;
  margin-bottom: 0;
}

/* 상세 페이지 개선 */
.detail-grid { 
  display: grid; 
  grid-template-columns: 1fr 320px; 
  gap: 40px; 
  margin-bottom: 40px; 
  align-items: flex-start;
}
.detail-info {
  background: #fff;
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.detail-hours {
  background: #fff;
  padding: 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.page-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sidebar-widget {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.sticky-ad-mobile {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: #fff; box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  display: none;
  /* iOS 홈 인디케이터 영역 확보(광고가 가려지지 않도록) */
  padding-bottom: env(safe-area-inset-bottom);
  /* 광고가 너무 커도 화면 절반 이상은 차지하지 않게(정책: 콘텐츠 가림 방지) */
  max-height: 110px; overflow: hidden;
  text-align: center;
}
.mobile-fab { position: fixed; right: 16px; width: 52px; height: 52px; background: var(--color-primary); color: #fff; border-radius: 50%; display: none; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); z-index: 1000;
  /* 하단 고정 광고(약 60px) + 세이프에어리어 위로 띄움 */
  bottom: calc(72px + env(safe-area-inset-bottom));
}

/* 주변 검색 결과 헤더 */
.nearby-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 10px 0;
  border-bottom: 2px solid var(--color-border-light);
  flex-wrap: wrap;
  gap: 15px;
}
.nearby-result-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text-dark);
  margin: 0;
}
.nearby-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 컴팩트 결과 헤더 — 제목/컨트롤을 한 줄에 작게(화면 점유 축소) */
.nearby-result-header--compact {
  margin-bottom: 12px;
  padding: 6px 0;
  gap: 10px;
  flex-wrap: nowrap;
}
.nearby-result-header--compact .nearby-result-title {
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nearby-result-controls { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.region-select-sm { padding: 7px 28px 7px 12px; font-size: 0.85rem; min-width: 0; max-width: 110px; }
.btn-back-nearby {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px; border: 1px solid var(--color-primary);
  background: var(--color-primary); color: #fff;
  border-radius: 8px; font-size: 0.85rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-back-nearby:hover { background: var(--color-primary-dark, #1d4ed8); }

/* ============================================================
   전수조사 보강 - 미정의 클래스 일괄 스타일
   (list / search / category / error 페이지 공통)
   ============================================================ */

/* 본문 래퍼: 푸터를 항상 하단으로 */
.main-content { min-height: 60vh; }

/* 공통 버튼 시스템 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  transition: var(--transition);
  border: 1px solid transparent;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary {
  background: #fff;
  color: var(--color-text-dark);
  border-color: var(--color-border);
}
.btn-secondary:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; border-radius: var(--radius-sm); }
.btn-detail { background: var(--color-primary-light); color: var(--color-primary); font-weight: 700; }
.btn-detail:hover { background: var(--color-primary); color: #fff; }
.btn-map-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
}
.btn-map-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-map-toggle--active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-map-toggle--active:hover { color: #fff; }
.map-toggle-icon { flex-shrink: 0; width: 12px; height: 12px; }

/* 세부 지역 (시군구) - 깔끔한 보조 링크 네비게이션
   (주 UI 는 상단 region-selector 셀렉트박스, 이건 SEO 크롤링용 링크) */
.sub-region-nav {
  margin: 20px 0 28px;
  padding: 16px 18px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}
.sub-region-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: none;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}
.sub-region-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition);
}
.tag:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* 내부 링크 (지역 다른 정보) */
.internal-links {
  margin: 32px 0;
  padding: 24px;
  background: var(--color-primary-light);
  border-radius: var(--radius-lg);
}
.il-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-text-dark);
  margin-bottom: 14px;
}
.il-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.il-list li a {
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.92rem;
}
.il-list li a:hover { text-decoration: underline; }

/* 빈 상태 / 데이터 없음 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  margin: 24px 0;
}
.empty-state p { margin: 4px 0; font-size: 0.95rem; }
.no-data {
  padding: 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* 비동기 로딩 / 위치 오류 (내 주변 찾기) */
.loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}
.location-error {
  text-align: center;
  padding: 32px 20px;
  background: #fff;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}
.location-error p { margin-bottom: 12px; color: var(--color-text-secondary); }
.location-error .btn-sm { margin: 4px auto; }
.location-tip {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 10px !important;
}

/* 지도 로딩/에러 오버레이 — 지도 컨테이너를 덮는 반투명 레이어 */
.map-loading-overlay {
  position: absolute; inset: 0; z-index: 32;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(248, 250, 252, 0.88);
  border-radius: var(--radius-lg);
  color: var(--color-text-secondary);
  font-size: 0.9rem; font-weight: 600;
  text-align: center; padding: 16px;
}
.map-loading-overlay .map-loading-spinner { width: 30px; height: 30px; border-width: 3px; }
.map-loading-overlay.is-error { color: var(--color-text-dark); }
.map-overlay-retry {
  padding: 8px 18px; border-radius: 999px;
  background: var(--color-primary); color: #fff;
  font-size: 0.85rem; font-weight: 700;
}
.map-overlay-retry:hover { background: var(--color-primary-dark); }

/* 위치 권한 거부 안내 카드 */
.location-denied {
  text-align: center;
  padding: 40px 24px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.location-denied-icon {
  width: 60px; height: 60px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.location-denied-title {
  font-size: 1.15rem; font-weight: 800;
  color: var(--color-text-dark); margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.location-denied-desc {
  font-size: 0.9rem; line-height: 1.65;
  color: var(--color-text-secondary); margin-bottom: 22px;
}
.location-denied-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.loc-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 22px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 700; transition: var(--transition);
}
.loc-btn-primary { background: var(--color-primary); color: #fff; }
.loc-btn-primary:hover { background: var(--color-primary-dark); }
.loc-btn-ghost {
  background: #fff; color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.loc-btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* 검색 결과 페이지 */
.search-section { margin-bottom: 36px; }
.search-section-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text-dark);
  margin: 28px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-border-light);
}
.search-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.search-tabs .tab {
  padding: 9px 18px;
  border-radius: 30px;
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}
.search-tabs .tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.search-tabs .tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* 에러 페이지 (404 / 500) */
.error-page {
  text-align: center;
  padding: 80px 20px;
  max-width: 480px;
  margin: 0 auto;
}
.error-code {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--color-primary);
  letter-spacing: -0.03em;
}
.error-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text-dark);
  margin: 16px 0 10px;
}
.error-desc {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 28px;
}
.error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 푸터 정보 컬럼 */
.footer-info p {
  font-size: 0.88rem;
  line-height: 1.7;
  color: #94A3B8;
}

/* 전화번호 링크 */
.phone-link { color: var(--color-primary); font-weight: 600; }
.phone-link:hover { text-decoration: underline; }
.phone-emergency { color: var(--color-emergency); }

/* 메인/카테고리 섹션 간격 */
.region-section { padding: 16px 0 40px; }
.region-name { font-size: 0.95rem; font-weight: 700; margin: 0; }

/* 카테고리 선택 페이지 */
.region-select-lg { padding: 14px 40px 14px 20px; font-size: 1rem; min-width: 180px; }
.nearby-result-section { margin-bottom: 40px; }
.category-map-container,
.list-map-container {
  width: 100%;
  height: 360px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
}
.list-map-section { margin: 20px 0; }

/* 카드 클릭으로 지도까지 스크롤할 때, sticky 헤더가 지도 상단(이 지역에서 검색
   버튼)을 가리지 않도록 헤더 높이만큼 여백을 확보한다. --header-height 는
   데스크톱 64px / 모바일 56px 로 반응형이므로 양쪽 모두 자동 대응. */
#mapContainer, #listMapContainer, #nearbyMapContainer, #categoryMapContainer { scroll-margin-top: calc(var(--header-height) + 16px); }

/* "이 지역에서 검색" 버튼 — 지도 중앙 상단 (다크 알약) */
.map-research-btn {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  z-index: 30; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: #2b3648; color: #fff;
  border: none; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.22); white-space: nowrap;
}
.map-research-btn:hover { background: #1f2937; }
.map-research-btn:active { transform: translateX(-50%) scale(0.97); }
.research-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.3); flex-shrink: 0;
}

/* 지도 검색 로딩 토스트 — 하단 중앙 */
.map-loading-toast {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 31; display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; background: #fff; color: #374151;
  border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2); white-space: nowrap;
}
.map-loading-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid #e5e7eb; border-top-color: #3b82f6;
  animation: mapSpin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes mapSpin { to { transform: rotate(360deg); } }

/* 지도 영역 재검색 결과 안내 노트 */
.map-result-note {
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af;
  border-radius: 8px; padding: 9px 12px; margin-bottom: 14px;
  font-size: 0.85rem; font-weight: 600;
}
.map-result-note a { color: var(--color-primary); text-decoration: underline; margin-left: 4px; }
.inst-card { cursor: pointer; }
.inst-card a, .inst-card button { cursor: pointer; }

/* 지도 범례 (마커 색상 의미 안내) — 지도 좌상단 고정 */
.list-map-legend {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  pointer-events: none;
}
.list-map-legend .legend-marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
}
.list-map-legend .legend-marker-pin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.list-map-legend .legend-text { white-space: nowrap; }
.category-results { margin: 32px 0; }
.category-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.category-results-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text-dark);
  margin: 0;
}
.category-region-grid { margin: 40px 0; }
.category-grid-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-text-dark);
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .sub-region-nav, .internal-links { padding: 16px; }
  .error-code { font-size: 3.5rem; }
  .error-page { padding: 56px 16px; }
  .category-map-container, .list-map-container { height: 260px; }
  .region-select-lg { width: 100%; min-width: 0; }
}

/* ============================================================
   사용자 피드백 ("관리자에게 의견 보내기") — 푸터 버튼 + 모달
   ============================================================ */
.footer-feedback {
  margin-top: 40px; padding-top: 28px; border-top: 1px solid #334155;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 12px; text-align: center;
}
.footer-feedback-text { color: #cbd5e1; font-size: 0.9rem; }
.footer-feedback-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; background: var(--color-primary); color: #fff;
  border: none; border-radius: var(--radius-md); font-family: var(--font-main);
  font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: background var(--transition);
}
.footer-feedback-btn:hover { background: var(--color-primary-dark); }
.footer-feedback-btn svg { flex-shrink: 0; }

/* 모달 오버레이 */
.feedback-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.feedback-modal[hidden] { display: none; }
.feedback-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); }
.feedback-dialog {
  position: relative; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  background: var(--color-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 28px 24px 24px;
  animation: feedbackPop 0.18s ease-out;
}
@keyframes feedbackPop { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.feedback-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--radius-sm);
  color: var(--color-text-muted); cursor: pointer; transition: background var(--transition);
}
.feedback-close:hover { background: var(--color-bg); color: var(--color-text-dark); }
.feedback-title { font-size: 1.2rem; font-weight: 700; color: var(--color-text-dark); margin: 0 0 6px; }
.feedback-desc { font-size: 0.88rem; color: var(--color-text-secondary); margin: 0 0 18px; line-height: 1.5; }
.feedback-form { display: flex; flex-direction: column; }
.feedback-label { font-size: 0.85rem; font-weight: 600; color: var(--color-text-dark); margin-bottom: 6px; }
.feedback-label .feedback-req { color: var(--color-emergency); }
.feedback-label .feedback-optional { color: var(--color-text-muted); font-weight: 400; }
.feedback-textarea, .feedback-input {
  width: 100%; font-family: var(--font-main); font-size: 0.92rem; color: var(--color-text-dark);
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 11px 13px; transition: border-color var(--transition), box-shadow var(--transition);
}
.feedback-textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
.feedback-textarea:focus, .feedback-input:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.feedback-counter { align-self: flex-end; margin: 5px 2px 16px; font-size: 0.78rem; color: var(--color-text-muted); }
.feedback-input { margin-bottom: 16px; }
.feedback-status { font-size: 0.85rem; min-height: 18px; margin-bottom: 12px; }
.feedback-status.is-error { color: var(--color-emergency); }
.feedback-status.is-ok { color: var(--color-secondary-dark); }
.feedback-submit {
  width: 100%; padding: 12px; background: var(--color-primary); color: #fff;
  border: none; border-radius: var(--radius-md); font-family: var(--font-main);
  font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: background var(--transition);
}
.feedback-submit:hover { background: var(--color-primary-dark); }
.feedback-submit:disabled { opacity: 0.6; cursor: default; }

/* 허니팟 — 화면 밖으로 숨김 (봇만 채움) */
.feedback-honeypot {
  position: absolute !important; left: -9999px !important; top: -9999px !important;
  width: 1px; height: 1px; opacity: 0; pointer-events: none;
}

/* 제출 완료 토스트 */
.feedback-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  z-index: 1100; background: var(--color-text-dark); color: #fff;
  padding: 12px 20px; border-radius: 999px; font-size: 0.9rem; font-weight: 600;
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}
.feedback-toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

@media (max-width: 480px) {
  .feedback-dialog { padding: 24px 18px 20px; }
}
