/* BASIC css start */
@charset "utf-8";
/* ============================================================
   THE LAB CHEMICAL — 헤더 / 하단 네비 / 검색 / 카테고리
   header.1.css  ▸  common.css 토큰 사용
============================================================ */

/* ══════════════════════════════════════
   1. 헤더 기본
══════════════════════════════════════ */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  /* 스크롤 시 그림자 — JS로 .scrolled 추가 */
  transition: box-shadow .25s;
}
#header.scrolled {
  box-shadow: 0 2px 16px rgba(12, 2, 91, .08);
}

/* body 상단 여백 (헤더 높이 + safe area) */
body {
  padding-top: calc(56px + env(safe-area-inset-top));
  padding-bottom: calc(var(--bottom-nav-h, 60px) + env(safe-area-inset-bottom));
}

/* ── 로고 ── */
.header-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  line-height: 0;
}
.header-logo img {
  height: 28px;
  width: auto;
  display: block;
}

/* ── 아이콘 버튼 공통 ── */
.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--navy);
  border-radius: 10px;
  transition: background var(--ease, .2s);
  text-decoration: none;
  flex-shrink: 0;
}
.header-icon-btn:active {
  background: var(--navy-lt, rgba(12,2,91,.07));
}

/* ── 우측 액션 그룹 ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0;
}

/* ══════════════════════════════════════
   2. 검색 오버레이
══════════════════════════════════════ */
#search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(255, 255, 255, .98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: flex-start;
  padding-top: env(safe-area-inset-top);

  /* 기본 숨김 */
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .22s ease, transform .22s ease;
}
#search-overlay.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.search-overlay-inner {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.search-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: none; background: none;
  cursor: pointer;
  color: var(--navy);
  border-radius: 10px;
  flex-shrink: 0;
  transition: background var(--ease);
}
.search-back-btn:active { background: var(--navy-lt); }

.search-overlay-form {
  flex: 1;
  display: flex;
  align-items: center;
  height: 42px;
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 0 4px 0 16px;
  gap: 4px;
}
.search-overlay-form input[type="text"] {
  flex: 1;
  border: none;
  background: none;
  font-size: 16px; /* 16px이상 → iOS 자동 줌 방지 */
  color: var(--text);
  outline: none;
  padding: 0;
  font-family: var(--font);
}
.search-overlay-form input::placeholder { color: var(--text-muted); }
.search-overlay-form button[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: none;
  background: var(--navy);
  border-radius: 9px;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--ease);
}
.search-overlay-form button[type="submit"]:active { background: var(--navy-dk); }

/* ══════════════════════════════════════
   3. 하단 네비게이션
══════════════════════════════════════ */
#btmMenuBar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 900;
  height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

#btmMenuBar ul {
  display: flex;
  height: 60px;
  margin: 0; padding: 0;
  list-style: none;
}
#btmMenuBar ul li {
  flex: 1;
}
#btmMenuBar ul li a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  text-decoration: none;
  color: var(--text-muted);
  transition: color .18s;
  position: relative;
}

/* 아이콘 */
#btmMenuBar ul li a svg {
  transition: stroke .18s;
  stroke: currentColor;
}

/* 라벨 */
#btmMenuBar ul li a span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -.3px;
  line-height: 1;
}

/* Active 상태 — JS로 .active 클래스 추가 */
#btmMenuBar ul li a.active,
#btmMenuBar ul li a:active {
  color: var(--navy);
}

/* Active 상단 라인 인디케이터 */
#btmMenuBar ul li a.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 24px; height: 2.5px;
  background: var(--navy);
  border-radius: 0 0 3px 3px;
}

/* ══════════════════════════════════════
   4. 카테고리 드로어
══════════════════════════════════════ */
.category-drawer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}
.category-drawer.open {
  display: block;
}

/* 배경 딤 */
.category-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  opacity: 0;
  transition: opacity .3s ease;
}
.category-drawer.open .category-backdrop {
  opacity: 1;
}

/* 패널 */
.category-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 82vh;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(12, 2, 91, .12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.4, 0, .2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.category-drawer.open .category-panel {
  transform: translateY(0);
}

/* 헤더 */
.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.category-header h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -.4px;
  margin: 0;
}
.category-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  background: var(--bg-soft);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-sub);
  transition: background var(--ease);
}
.category-close:active { background: var(--border); }

/* 네비 스크롤 영역 */
.category-nav {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px 24px;
  flex: 1;
}

/* ── 1차 카테고리 ── */
.category-list, .subcategory-list, .third-list {
  list-style: none;
  margin: 0; padding: 0;
}
.category-item {
  border-bottom: 1px solid var(--border);
}
.category-item:last-child { border-bottom: none; }

.brand-row {
  display: flex;
  align-items: center;
  padding: 14px 0;
}
.brand-name-link {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.3px;
}
.brand-name-link:active { color: var(--navy); }

.brand-toggle {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  color: var(--text-muted);
  transition: background var(--ease);
  flex-shrink: 0;
}
.brand-toggle:active { background: var(--bg-soft); }

/* 토글 아이콘 회전 */
.toggle-icon {
  transition: transform .22s ease;
}
.category-item.open > .brand-row .toggle-icon,
.subcategory-item.open > .sub-row .toggle-icon {
  transform: rotate(180deg);
  stroke: var(--navy);
}

/* ── 2차 카테고리 ── */
.subcategory-list {
  display: none;
  padding: 0 0 10px 0;
}
.category-item.open > .subcategory-list { display: block; }

.subcategory-item { }

.sub-row {
  display: flex;
  align-items: center;
  padding: 9px 0 9px 14px;
  border-left: 2px solid var(--border);
  margin-left: 2px;
}
.subcategory-name-link {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
}
.subcategory-name-link:active { color: var(--navy); font-weight: 700; }
.subcategory-item.open > .sub-row {
  border-left-color: var(--navy);
}
.subcategory-item.open > .sub-row .subcategory-name-link {
  color: var(--text);
  font-weight: 700;
}

.sub-toggle {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: background var(--ease);
  flex-shrink: 0;
}
.sub-toggle:active { background: var(--bg-soft); }

/* ── 3차 카테고리 ── */
.third-list {
  display: none;
  padding: 4px 0 8px 28px;
}
.subcategory-item.open > .third-list { display: block; }

.third-link {
  display: block;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all var(--ease);
}
.third-link:active {
  color: var(--navy);
  background: var(--navy-lt);
  font-weight: 600;
}

/* ══════════════════════════════════════
   5. 자동완성 (다찾다)
══════════════════════════════════════ */
.search-auto-complete-list {
  display: none;
  position: absolute;
  top: 56px; left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(12,2,91,.08);
  z-index: 1200;
}
.search-auto-complete-list ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 16px;
  list-style: none;
  margin: 0;
}
.search-auto-complete-list ul li a {
  display: block;
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-soft);
  text-decoration: none;
  transition: all var(--ease);
}
.search-auto-complete-list ul li a strong { color: var(--accent); }
.search-auto-complete-list ul li a:active {
  background: var(--navy-lt);
  border-color: var(--navy);
  color: var(--navy);
}
.search-auto-complete-list .search-list-close {
  display: block;
  padding: 8px 16px 12px;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

/* ══════════════════════════════════════
   6. body-lock
══════════════════════════════════════ */
body.body-lock {
  overflow: hidden;
  height: 100vh;
  touch-action: none;
}
/* BASIC css end */

