/* ═══════════════════════════════════════════════
   동네보험 — global.css v25
   공통 스타일: 리셋, 변수, 헤더, 푸터, 모달
   v15: Noto Sans KR 폰트 변경 (Pretendard → Noto Sans KR)
   v16: @import → HTML <link> 태그로 이전 (렌더 차단 최소화)
   v18: 알림 종 아이콘 + 알림 패널 스타일
   v21: 모바일 알림 패널 position:fixed (뷰포트 기준 좌우 16px 고정)
   ═══════════════════════════════════════════════ */

/* 웹폰트: 각 HTML 파일의 <link> 태그에서 로딩 */

/* ── CSS Variables ── */
:root {
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-dark: #1D4ED8;
  --primary-50: #EFF6FF;
  --primary-100: #DBEAFE;
  --accent: #F59E0B;
  --bg: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-tertiary: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --header-height: 52px;
  --font-main: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.2s ease;

  /* 카드 컬러 링 + 뱃지 */
  --ring-compare: linear-gradient(135deg, #93C5FD, #2563EB);
  --ring-exclusive: linear-gradient(135deg, #FCD34D, #D97706);
  --type-compare-bg: #EFF6FF;
  --type-compare-text: #1E40AF;
  --type-exclusive-bg: #FFFBEB;
  --type-exclusive-text: #92400E;
  /* 상품 태그 (v2: 배경 없음, 초록 텍스트만) */
  --product-text: #15803D;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  font-size: inherit;
}
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-logo svg { width: 26px; height: 26px; }
.header-logo span {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-text {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.btn-text:hover { background: var(--bg-tertiary); }
.btn-primary-sm {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #3272c7;
  background: transparent;
  border: 1.5px solid #3272c7;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-primary-sm:hover { background: #3272c7; color: #fff; }

/* ── Header Avatar Dropdown ── */
.header-avatar-wrap {
  position: relative;
}
.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.header-avatar:hover {
  box-shadow: 0 0 0 3px var(--border-light);
  border-color: var(--text-tertiary);
}
.header-avatar__initial {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1;
}
.header-avatar__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #EF4444;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg);
  line-height: 1;
}
.header-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.97);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.header-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.header-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  width: 100%;
  text-align: left;
}
.header-dropdown__item:hover {
  background: var(--bg-tertiary);
}
.header-dropdown__item svg {
  flex-shrink: 0;
  color: var(--text-tertiary);
}
.header-dropdown__item--logout {
  color: var(--text-secondary);
}
.header-dropdown__item--disabled {
  opacity: 0.5;
  pointer-events: none;
}
.header-dropdown__divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 6px;
}
.header-dropdown__badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #EF4444;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Notification Bell + Panel ── */
.header-notif-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.header-notif-btn {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.header-notif-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.header-notif-btn svg {
  width: 18px;
  height: 18px;
}
.header-notif-btn__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: #EF4444;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg);
  line-height: 1;
}

/* 알림 패널 */
.header-notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: -60px;
  width: 320px;
  max-height: 420px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.97);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  display: flex;
  flex-direction: column;
}
.header-notif-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.header-notif-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.header-notif-panel__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.header-notif-panel__read-all {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  min-height: 32px;
  display: flex;
  align-items: center;
}
.header-notif-panel__read-all:hover {
  text-decoration: underline;
}
.header-notif-panel__body {
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}
.header-notif-panel__footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border-light);
  text-align: center;
  flex-shrink: 0;
}
.header-notif-panel__more {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  min-height: 32px;
}
.header-notif-panel__more:hover {
  text-decoration: underline;
}

/* 개별 알림 아이템 */
.header-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
}
.header-notif-item:last-child {
  border-bottom: none;
}
.header-notif-item:hover {
  background: var(--bg-secondary);
}
.header-notif-item--unread {
  background: rgba(37, 99, 235, 0.03);
}
.header-notif-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 4px;
}
.header-notif-item--unread .header-notif-item__dot {
  display: block;
}
.header-notif-item__dot {
  display: none;
}
.header-notif-item--unread .header-notif-item__dot {
  display: block;
}
/* 타입별 색상 */
.header-notif-item--qna .header-notif-item__dot {
  background: #10B981;
}
.header-notif-item--consult .header-notif-item__dot {
  background: #2563EB;
}
.header-notif-item__content {
  flex: 1;
  min-width: 0;
}
.header-notif-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.header-notif-item__message {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.header-notif-item__date {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* 빈 상태 */
.header-notif-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-tertiary);
}
.header-notif-empty svg {
  margin: 0 auto 8px;
  opacity: 0.4;
}
.header-notif-empty p {
  font-size: 13px;
}

/* 로딩 */
.header-notif-loading {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

/* 반응형 — 모바일 패널 */
@media (max-width: 767px) {
  .header-notif-panel {
    position: fixed;
    top: calc(var(--header-height) + 6px);
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
  }
}

/* ── Footer ── */
.footer {
  background: #1F2937;
  color: #9CA3AF;
  padding: 28px 16px 32px;
  font-size: 11px;
  line-height: 1.7;
  min-height: 160px; /* CLS 방지: 동적 로딩 전 높이 예약 */
}
.footer__inner {
  max-width: 1060px;
  margin: 0 auto;
}
.footer-links {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.footer-links a {
  color: #D1D5DB;
  font-size: 12px;
  transition: color var(--transition);
}
.footer-links a:hover { color: #fff; }
.footer-links a.bold { font-weight: 700; }
.footer-info p { margin-bottom: 2px; }
.footer-disclaimer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #374151;
  color: #6B7280;
  font-size: 10.5px;
}

/* ── Modal / Bottom Sheet ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.modal-backdrop.active { opacity: 1; visibility: visible; }

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 80vh;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  z-index: 210;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.3s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}
.bottom-sheet.active {
  transform: translateY(0);
  visibility: visible;
}
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: #D1D5DB;
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.bottom-sheet-header {
  display: flex;
  align-items: center;
  padding: 14px 20px 10px;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.bottom-sheet-body {
  padding: 0 20px 24px;
  overflow-y: auto;
  flex: 1;
}

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── 모달 반응형 (640px+: 모달 콘텐츠 폭 기준) ── */
/* 화면이 640px 이상이면 바텀시트 → 센터 팝업 모달로 전환            */
/* 640px = insurer 모달 최대 폭(640px)을 기준으로 콘텐츠가 안정적으로 표시되는 최소 viewport */
@media (min-width: 640px) {
  /* 바텀시트 → 센터 모달 */
  .bottom-sheet {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    max-width: 580px;
    width: calc(100% - 48px);
    max-height: 75vh;
    border-radius: var(--radius-lg);
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
  }
  .bottom-sheet.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
  }
  .bottom-sheet-handle { display: none; }
  .bottom-sheet-header {
    padding: 20px 24px 12px;
    font-size: 17px;
  }
  .bottom-sheet-body {
    padding: 0 24px 28px;
  }

  /* 보험사 그리드 4열 (PC 넓은 모달) */
  .insurer-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
  .insurer-item {
    padding: 12px 6px;
  }
  /* 보험사 모달만 더 넓게 */
  #insurerSheet {
    max-width: 640px;
  }

  /* 상품분야 2열 배치 */
  .category-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
}

/* ── PC Responsive (768px+: 페이지 레이아웃) ── */
@media (min-width: 768px) {
  .header {
    padding: 0 calc((100% - 1060px) / 2 + 24px);
  }
  .footer {
    padding: 32px 24px 40px;
  }
}

/* ── Mobile Bottom Navigation (v22) ── */
/* 시안 C: 활성 탭 필 하이라이트 — 생동감 있는 마이크로 인터랙션 */
:root {
  --mobile-nav-height: 56px;
}

/* PC에서 숨김 */
.mobile-nav { display: none; }

@media (max-width: 767px) {
  /* 하단 네비 영역만큼 페이지 하단 여백 추가 */
  body.has-mobile-nav {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: var(--mobile-nav-height);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.07);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
    z-index: 95;
    align-items: stretch;
  }

  .mobile-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    color: #94A3B8;
    text-decoration: none;
    background: none;
    border: none;
    font-family: var(--font-main);
    cursor: pointer;
    position: relative;
    transition: color 0.22s ease;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
  }

  /* 활성 탭 필 배경 (시안 C) */
  .mobile-nav__item::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%) scale(0.7);
    width: 58px;
    height: 46px;
    background: rgba(50,114,199,0.10);
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
  }

  .mobile-nav__item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: transform 0.22s ease, color 0.22s ease;
    position: relative;
    z-index: 1;
  }

  .mobile-nav__item span {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: -0.2px;
    line-height: 1;
    position: relative;
    z-index: 1;
  }

  /* 활성 상태 */
  .mobile-nav__item.active {
    color: #3272c7;
  }

  .mobile-nav__item.active::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }

  .mobile-nav__item.active svg {
    transform: translateY(-1px) scale(1.04);
  }

  /* 누를 때 피드백 */
  .mobile-nav__item:active {
    opacity: 0.65;
  }
}