/* BASIC css start */
/* ============================================================
   THE LAB CHEMICAL — 헤더 CSS  (header-top.css)
   ▸ common.css :root 토큰 사용 (중복 정의 없음)
   ▸ Aside 카테고리 + 고정 헤더
============================================================ */

/* ── Scope base ── */
#header, #header *,
aside#aside, aside#aside * {
  box-sizing: border-box;
  font-family: var(--font);
}
#header a, aside#aside a { color: inherit; text-decoration: none; }
#header ul, aside#aside ul { margin: 0; padding: 0; list-style: none; }
#header img, aside#aside img { max-width: 100%; height: auto; display: block; }

/* ── Aside ── */
/* aside#aside + aside 둘 다 매치 (MakeShop이 id를 안 붙이는 경우 대응) */
aside#aside,
aside:not([id]) {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--aside-w);
  height: 100vh;
  background: var(--bg);
  border-right: 1px solid var(--border-soft);
  z-index: 500;                  /* ✅ body content보다 위 */
  overflow-y: auto;
  overflow-x: visible;           /* ✅ 서브메뉴가 aside 밖으로 나올 수 있도록 */
  transition: transform .26s cubic-bezier(.4,0,.2,1);
}

aside#aside .asi_inner,
aside:not([id]) .asi_inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 20px 14px 28px;
}

aside#aside .aside-title,
aside:not([id]) .aside-title {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
  padding: 6px 8px 0;
  line-height: 1.8;
  user-select: none;
}

aside#aside nav,
aside:not([id]) nav { margin-top: 16px; }
aside#aside nav li,
aside:not([id]) nav li { position: relative; }
aside#aside nav .main_m > li,
aside:not([id]) nav .main_m > li { margin-bottom: 3px; }

aside#aside nav a,
aside:not([id]) nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--ease), color var(--ease);
}
aside#aside nav li:hover > a,
aside:not([id]) nav li:hover > a,
aside#aside nav li:focus-within > a,
aside:not([id]) nav li:focus-within > a {
  background: var(--bg-soft);
}
aside#aside nav li.active > a,
aside:not([id]) nav li.active > a,
aside#aside nav li.selected > a,
aside:not([id]) nav li.selected > a {
  background: var(--navy-lt);
  color: var(--navy);
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--navy);
}

/* Sub dropdown */
aside#aside nav .sub1_m,
aside:not([id]) nav .sub1_m,
aside#aside nav .sub2_m,
aside:not([id]) nav .sub2_m {
  display: none;
  position: fixed;
  top: auto;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 8px;
  z-index: 9999;
  /* 서브메뉴와 부모 사이 가상 브리지 — 마우스가 틈새를 지나도 유지 */
  margin-left: -8px;
  padding-left: 16px;
}
aside#aside nav .sub1_m.is-open:not(:empty),
aside:not([id]) nav .sub1_m.is-open:not(:empty),
aside#aside nav .sub2_m.is-open:not(:empty),
aside:not([id]) nav .sub2_m.is-open:not(:empty) {
  display: block;
}
/* ⚠️ hover 트리거는 JS로 처리 (hover gap 문제 방지) */
/* aside nav .sub1_m, .sub2_m 표시는 02_header.js가 담당 */

aside#aside nav .sub1_m a,
aside:not([id]) nav .sub1_m a,
aside#aside nav .sub2_m a,
aside:not([id]) nav .sub2_m a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  padding: 8px 12px;
  border-radius: 8px;
}
aside#aside nav .sub1_m a:hover,
aside:not([id]) nav .sub1_m a:hover,
aside#aside nav .sub2_m a:hover,
aside:not([id]) nav .sub2_m a:hover {
  background: var(--bg-soft);
  color: var(--navy);
}

/* Overlay */
.aside-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.38);
  z-index: 109;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.aside-overlay[hidden] { display: none; }

/* ── Header Shell ── */
#header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  min-height: var(--header-h);
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
  z-index: 120;
  /* MakeShop 공통 CSS 덮어쓰기 방지 */
  margin: 0 !important;
  padding: 0 !important;
}

#header .head_inner {
  height: var(--header-h);
  max-width: var(--wrap);          /* ✅ 본문·푸터와 동일한 1200px */
  margin: 0 auto;
  padding: 0 28px;                 /* ✅ 본문과 동일한 좌우 28px */
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 24px;
  align-items: center;
}

/* 로고 */
#header .header_left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#header .aside-toggle {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
  flex-shrink: 0;
}
#header .aside-toggle:hover { background: var(--bg-soft); border-color: var(--navy); }

#header .header_logo a {
  display: flex;
  align-items: center;
}
#header .header_logo img {
  height: 58px;
  max-width: 210px;
  width: auto;
  object-fit: contain;
}

/* 검색 영역 */
#header .header_center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
}
#header .header_search_box {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
}

/* 유저 버튼 행 */
#header .header_user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  flex-wrap: wrap;
}
#header .user_icon_btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pill);
  transition: all var(--ease);
  white-space: nowrap;
}
#header .user_icon_btn:hover {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}

/* 검색 폼 */
#header .header_search_box fieldset,
#header .header_search_box form > fieldset {
  display: flex;
  align-items: center;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--pill);
  background: var(--bg-soft);
  padding: 0 5px 0 18px;
  overflow: hidden;
  transition: border-color var(--ease), box-shadow var(--ease);
}
#header .header_search_box fieldset:focus-within {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-lt);
  background: var(--bg);
}

/* 검색 input — MakeShop 스킨 override */
#header .header_search_box input,
#header .header_search_box input[type="text"],
#header .header_search_box input.MS_search_word,
#header .header_search_box input.search_auto_completion {
  flex: 1 !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  height: 100% !important;
  width: 100% !important;
  max-width: none !important;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
}
#header .header_search_box input::placeholder { color: var(--text-muted); }

/* 검색 버튼 */
#header .search_btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--pill);
  background: var(--navy);
  border: none;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
  text-decoration: none;
  margin-left: 2px;
}
#header .search_btn::before {
  content: '';
  display: block;
  width: 14px; height: 14px;
  border: 2.5px solid rgba(255,255,255,.9);
  border-radius: 50%;
  box-shadow: 3px 3px 0 rgba(255,255,255,.9);
}
#header .search_btn:hover { background: var(--navy-dk); transform: scale(1.05); }

/* 서브 버튼 */
#header .search_sub_buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
#header .search_sub_buttons a {
  display: inline-flex;
  align-items: center; justify-content: center;
  height: 30px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  background: transparent;
  border: 1px solid rgba(12,2,91,.22);
  border-radius: var(--pill);
  transition: all var(--ease);
  white-space: nowrap;
}
#header .search_sub_buttons a:hover {
  background: var(--navy-lt);
  border-color: var(--navy);
  transform: translateY(-1px);
}

/* 배너 */
#header .header_banner {
  width: 175px;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}
#header .header_banner img { width: 100%; height: 100%; object-fit: cover; }
#header .header_banner .swiper,
#header .header_banner .swiper-wrapper,
#header .header_banner .swiper-slide { height: 100%; }

/* ── Desktop offset ── */
.main_layout { padding-top: var(--header-h); }

@media (min-width: 1024px) {
  .main_layout { margin-left: var(--aside-w); }

  /* 1024~1120 compact */
  @media (max-width: 1120px) {
    #header .header_logo img { height: 48px; }
    #header .header_banner { width: 140px; }
    #header .search_sub_buttons a { padding: 0 10px; }
  }
}

/* ── Mobile ── */
@media (max-width: 1023px) {
  aside#aside,
  aside:not([id]) { transform: translateX(-100%); }
  aside#aside.is-open,
  aside:not([id]).is-open { transform: translateX(0); box-shadow: var(--shadow-md); }
  body.aside-open { overflow: hidden; touch-action: none; }

  #header { left: 0 !important; width: 100% !important; }

  #header .head_inner {
    height: auto;
    padding: 10px 16px;           /* ✅ 모바일 좌우 16px로 통일 */
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 10px;
    row-gap: 8px;
    max-width: 100%;
    margin: 0;
  }

  #header .header_left { grid-column: 1; grid-row: 1; }
  #header .aside-toggle { display: inline-flex; }
  #header .header_logo img { height: 34px; max-width: 140px; }

  #header .header_user { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  #header .user_icon_btn { height: 26px; font-size: 11px; padding: 0 9px; }

  #header .header_center { grid-column: 1 / 3; grid-row: 2; }
  #header .header_search_box fieldset { height: 42px; }

  #header .search_sub_buttons {
    grid-column: 1 / 3;
    grid-row: 3;
    justify-self: end;
    width: fit-content;
    margin-left: auto;
    padding: 5px 8px;
    background: rgba(255,255,255,.92);
    border: 1px solid var(--border);
    border-radius: var(--pill);
    box-shadow: var(--shadow-sm);
  }

  #header .header_banner { display: none; }
}

/* ── MakeShop 공통 CSS 충돌 방지 ── */
#header { width: 100% !important; }
aside#aside,
aside:not([id]) { width: var(--aside-w) !important; margin: 0 !important; }
/* BASIC css end */

