/* cgtax 공통 UI — 하단 네비, 뱃지, 북마크 버튼 (모든 페이지 공유) */

:root {
  --cgt-bg: #f5f2eb;
  --cgt-card: #ffffff;
  --cgt-line: #e4dccd;
  --cgt-line2: #d3c6b1;
  --cgt-txt: #1f2723;
  --cgt-txt2: #607067;
  --cgt-txt3: #89948e;
  --cgt-accent: #1f6f63;
  --cgt-accent2: #245f8f;
  --cgt-danger: #a33a2b;
}

/* 본문 하단에 nav 가림 방지 */
body.has-bottom-nav {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

/* ============================
   하단 네비게이션 바
   ============================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--cgt-line, var(--line));
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  z-index: 40;
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-shadow: 0 -10px 28px rgba(43, 34, 24, 0.12);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 2px 7px;
  color: var(--cgt-txt3, var(--txt3));
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
  position: relative;
  transition: color 0.12s;
  min-width: 0;             /* 그리드 셀 가운데 정렬 보장 */
  text-align: center;
}

.bottom-nav a:hover,
.bottom-nav a.active {
  color: var(--cgt-accent, var(--accent));
  text-decoration: none;
}

.bottom-nav a.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  background: var(--cgt-accent, var(--accent));
  border-radius: 0 0 2px 2px;
}

/* 아이콘 + 뱃지 결합 컨테이너 */
.bottom-nav .ico-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  font-size: 18px;
  line-height: 1;
}

.bottom-nav .ico {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
}

.bottom-nav .nav-label {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

/* ============================
   알림 뱃지 — 아이콘 우상단 정확히 부착
   ============================ */
.bn-badge {
  position: absolute;
  top: -5px;
  left: calc(100% - 6px);     /* 아이콘 우측에서 살짝 안쪽 */
  background: var(--cgt-danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 9px;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 2px var(--cgt-card, #ffffff);   /* 배경 분리감 */
  pointer-events: none;
}

/* ============================
   QA 페이지 부유 북마크 버튼
   ============================ */
.qa-bookmark {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));   /* 하단 nav 위 */
  right: 18px;
  z-index: 30;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--cgt-line, var(--line));
  color: var(--cgt-txt2, var(--txt2));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.18s, border-color 0.15s, background 0.15s;
  box-shadow: 0 8px 24px rgba(43, 34, 24, 0.14);
  padding: 0;
}
.qa-bookmark:hover {
  transform: scale(1.05);
  border-color: var(--cgt-accent, var(--accent));
}
.qa-bookmark.bookmarked {
  background: var(--cgt-accent, var(--accent));
  color: #fff;
  border-color: transparent;
}

/* ============================
   새 답변 토스트 (메인 페이지)
   ============================ */
.new-answer-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  color: var(--cgt-txt, #1f2723);
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13.5px;
  z-index: 50;
  border: 1px solid var(--cgt-line, #e4dccd);
  box-shadow: 0 10px 28px rgba(43, 34, 24, 0.16);
  cursor: pointer;
  animation: cgt-slide-down 0.4s ease;
  max-width: calc(100% - 32px);
  text-align: center;
}
@keyframes cgt-slide-down {
  from { transform: translate(-50%, -30px); opacity: 0; }
  to   { transform: translate(-50%, 0);     opacity: 1; }
}

/* ============================
   모바일 좁은 화면 보정
   ============================ */
@media (max-width: 380px) {
  .bottom-nav a { padding: 9px 1px 7px; }
  .bottom-nav .nav-label { font-size: 10px; }
  .bottom-nav .ico { font-size: 17px; }
  .qa-bookmark { width: 46px; height: 46px; font-size: 20px; right: 14px; }
}
@media (max-width: 320px) {
  .bottom-nav .nav-label { font-size: 9.5px; }
}

/* 모바일: 하단 네비 부가 메뉴 숨김(핵심 3개만 노출) */
@media (max-width: 640px) {
  .bottom-nav a.bn-opt { display: none; }
}
