/* ===========================
   Cropick — market.css
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700;800;900&display=swap');

:root {
  --primary:      #3A9E2F;
  --primary-light:#5BBD50;
  --primary-dark: #2D7D24;
  --brown:        #3D2B1F;
  --yellow:       #F5C518;
  --text-dark:    #1A1A1A;
  --text-mid:     #444;
  --text-light:   #888;
  --border:       #E8E8E8;
  --bg:           #FFFFFF;
  --bg-soft:      #F6FAF5;
  --radius-sm:    8px;
  --radius-md:    14px;
  --nav-h:        100px;
  --catbar-h:     52px;
  --filter-w:     220px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Noto Sans KR', sans-serif; color: var(--text-dark); background: #FAFAFA; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ── NAVBAR ── */
.navbar { position: sticky; top: 0; z-index: 1000; height: var(--nav-h); background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 40px; }
.navbar__logo { display: flex; align-items: center; gap: 10px; margin-right: 48px; flex-shrink: 0; }
.navbar__logo img { height: 40px; width: auto; object-fit: contain; }
.navbar__nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.navbar__nav a { font-size: 20px; font-weight: 500; color: #777; padding: 7px 16px; border-radius: 8px; letter-spacing: -0.2px; transition: color .2s, background .2s; position: relative; }
.navbar__nav a:hover { color: var(--text-dark); background: var(--bg-soft); }
.navbar__nav a.active { color: var(--primary); font-weight: 700; }
.navbar__nav a.active::after { content: ''; position: absolute; bottom: -2px; left: 16px; right: 16px; height: 2px; border-radius: 2px; background: var(--primary); }
.navbar__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.navbar__actions .link-sm { font-size: 13px; font-weight: 500; color: #888; padding: 6px 10px; border-radius: 6px; transition: color .2s, background .2s; }
.navbar__actions .link-sm:hover { color: var(--text-dark); background: var(--bg-soft); }
.navbar__icon-btn { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: transparent; color: #888; cursor: pointer; transition: background .2s, color .2s; border: 1.5px solid var(--border); }
.navbar__icon-btn:hover { background: var(--bg-soft); color: var(--text-dark); border-color: #ccc; }

/* ── 카테고리 탭바 — navbar 바로 아래 붙음 ── */
.cat-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 100;
  background: #fff;
  border-bottom: 1.5px solid var(--border);
  height: var(--catbar-h);
  display: flex;
  align-items: stretch;
  padding: 0 40px;
  gap: 0;
  margin: 0;        /* ← 공백 제거 */
}
.cat-bar__tab {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-light);
  padding: 0 22px;
  cursor: pointer;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  background: none;
  transition: color .2s, border-color .2s;
  white-space: nowrap;
  outline: none;
  font-family: 'Noto Sans KR', sans-serif;
  display: flex;
  align-items: center;
}
.cat-bar__tab:hover { color: var(--text-dark); }
.cat-bar__tab.active { color: var(--primary); font-weight: 700; border-bottom-color: var(--primary); }

/* ── 메인 레이아웃 ── */
.market-layout {
  display: flex;
  align-items: flex-start;
  padding: 0 40px;
  gap: 0;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── 왼쪽 필터 패널 ── */
.filter-panel {
  width: var(--filter-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-h) + var(--catbar-h));
  height: calc(100vh - var(--nav-h) - var(--catbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 20px 40px 0;
  border-right: 1px solid var(--border);
  background: #FAFAFA;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.filter-panel::-webkit-scrollbar { width: 3px; }
.filter-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.filter-header__title { font-size: 16px; font-weight: 800; color: var(--text-dark); }
.filter-reset {
  font-size: 12px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  font-family: 'Noto Sans KR', sans-serif;
  transition: color .2s;
}
.filter-reset:hover { color: var(--primary); }

.filter-section { border-top: 1px solid var(--border); padding: 16px 0; }
.filter-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 10px;
}
.filter-section__head h3 { font-size: 13px; font-weight: 700; color: var(--text-dark); }
.filter-arrow { font-size: 10px; color: var(--text-light); transition: transform .2s; }
.filter-section.closed .filter-arrow { transform: rotate(180deg); }
.filter-section.closed .filter-body { display: none; }

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-mid);
  transition: color .2s;
  user-select: none;
}
.filter-item:hover { color: var(--text-dark); }
.filter-item input[type="checkbox"],
.filter-item input[type="radio"] { display: none; }

.filter-check {
  width: 16px; height: 16px;
  border: 1.5px solid #CCC;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color .2s, background .2s;
}
.filter-item input[type="checkbox"]:checked + .filter-check {
  background: var(--primary);
  border-color: var(--primary);
}
.filter-item input[type="checkbox"]:checked + .filter-check::after {
  content: '';
  width: 8px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

.filter-radio {
  width: 16px; height: 16px;
  border: 1.5px solid #CCC;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color .2s;
}
.filter-item input[type="radio"]:checked + .filter-radio {
  border-color: var(--primary);
  border-width: 2px;
}
.filter-item input[type="radio"]:checked + .filter-radio::after {
  content: '';
  width: 7px; height: 7px;
  background: var(--primary);
  border-radius: 50%;
  display: block;
}

.filter-label { flex: 1; font-size: 13px; }
.filter-count { font-size: 11px; color: var(--text-light); }
.filter-item input:checked ~ .filter-label { color: var(--primary); font-weight: 600; }

/* ── 오른쪽 상품 영역 ── */
.product-panel {
  flex: 1;
  min-width: 0;
  padding: 24px 0 60px 32px;
  background: #FAFAFA;
}

.product-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.product-count { font-size: 14px; color: var(--text-light); }
.product-count strong { color: var(--text-dark); font-weight: 700; }

.sort-btns { display: flex; align-items: center; }
.sort-btn {
  font-size: 13px;
  color: var(--text-light);
  background: none;
  border: none;
  padding: 4px 10px;
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  border-right: 1px solid var(--border);
  transition: color .2s;
  white-space: nowrap;
}
.sort-btn:last-child { border-right: none; }
.sort-btn:hover { color: var(--text-dark); }
.sort-btn.active { color: var(--primary); font-weight: 700; }

/* ── 상품 그리드 ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px 20px;
}
@media (max-width: 1300px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── 상품 카드 ── */
.product-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow .2s, transform .2s;
  cursor: pointer;
}
.product-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  transform: translateY(-3px);
}

.product-card__thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f5f5f5;
  position: relative;
}
.product-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.product-card:hover .product-card__thumb img { transform: scale(1.04); }

.product-badge {
  position: absolute;
  top: 10px; left: 10px;
  font-size: 11px; font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  color: #fff;
  z-index: 1;
}
.badge--new     { background: var(--primary); }
.badge--sale    { background: #e74c3c; }
.badge--member  { background: var(--brown); }
.badge--limited { background: var(--yellow); color: var(--brown); }

/* 카트 버튼 */
.product-card__cart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  transition: background .2s, color .2s;
}
.product-card__cart:hover { background: var(--bg-soft); color: var(--primary); }

/* 상품 정보 */
.product-card__info { padding: 14px 14px 16px; }
.product-card__delivery { font-size: 11px; color: var(--text-light); margin-bottom: 5px; }
.product-card__name { font-size: 14px; font-weight: 500; color: var(--text-dark); line-height: 1.5; margin-bottom: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card__desc { font-size: 12px; color: var(--text-light); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card__original { font-size: 12px; color: var(--text-light); text-decoration: line-through; display: block; margin-bottom: 2px; }
.product-card__price-row { display: flex; align-items: baseline; gap: 5px; margin-bottom: 4px; }
.product-card__discount { font-size: 14px; font-weight: 700; color: var(--primary); }
.product-card__price { font-size: 17px; font-weight: 800; color: var(--text-dark); }
.product-card__review { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.product-card__tags { display: flex; gap: 5px; flex-wrap: wrap; }
.product-tag { font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 4px; background: var(--bg-soft); color: var(--primary-dark); border: 1px solid #c5e8be; }

/* 빈 상태 */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-light); grid-column: 1/-1; }
.empty-state__icon { font-size: 48px; margin-bottom: 16px; }

/* ── FOOTER ── */
.footer-main { padding: 60px 40px; border-top: 1px solid var(--border); background: #fff; }
.footer-main__logo { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.footer-main__logo img { height: 28px; width: auto; object-fit: contain; }
.footer-main__info { font-size: 14px; color: var(--text-light); line-height: 1.8; }
.footer-main__links { display: flex; gap: 16px; margin-top: 16px; }
.footer-main__links a { font-size: 13px; color: var(--text-light); transition: color .2s; }
.footer-main__links a:hover { color: var(--text-dark); }
.footer-main__copy { font-size: 12px; color: #bbb; margin-top: 8px; }

/* ── BACK TO TOP ── */
.back-to-top { position: fixed; bottom: 28px; right: 28px; width: 44px; height: 44px; background: #fff; border: 1px solid var(--border); border-radius: 50%; box-shadow: 0 4px 16px rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; color: var(--text-mid); z-index: 999; opacity: 0; pointer-events: none; transition: opacity .3s; }
.back-to-top.visible { opacity: 1; pointer-events: auto; }

/* ── 인스타그램 아이콘 (CSS로 로고 구현) ── */
.insta-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(135deg, #feda75 0%, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.insta-icon::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  position: absolute;
}
.insta-icon::after {
  content: "";
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  right: 2px;
}


/* ════════════════════════════════
   MOBILE — market.css
════════════════════════════════ */
@media (max-width: 768px) {

  :root { --nav-h: 60px; }
  .navbar { height: var(--nav-h); padding: 0 16px; }
  .navbar__logo { margin-right: 0; }
  .navbar__logo img { height: 30px; }
  .navbar__nav { display: none; }
  .navbar__actions .link-sm { display: none; }
  .navbar__icon-btn { width: 32px; height: 32px; }

  /* 카테고리 탭바 */
  .cat-bar { padding: 0 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .cat-bar::-webkit-scrollbar { display: none; }
  .cat-bar__tab { padding: 0 14px; font-size: 13px; }

  /* 레이아웃: 필터 패널 숨기고 상품만 */
  .market-layout { flex-direction: column; padding: 0; }
  .filter-panel { display: none; }
  .product-panel { padding: 16px 16px 48px; }

  /* 상품 그리드 2열 */
  .product-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 16px 12px; }

  /* 정렬 버튼 스크롤 */
  .sort-btns { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .sort-btns::-webkit-scrollbar { display: none; }
  .sort-btn { font-size: 12px; padding: 4px 8px; }

  /* 상품 카드 */
  .product-card__name { font-size: 12px; }
  .product-card__price { font-size: 14px; }
  .product-card__info { padding: 10px 10px 12px; }

  .footer-main { padding: 28px 16px; }
  .footer-main__info { font-size: 12px; }
}

/* ════════════════════════════════
   HAMBURGER + DRAWER
════════════════════════════════ */

/* 햄버거 버튼 — PC에서는 숨김 */
.navbar__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: 8px;
  border-radius: 8px;
  transition: background .2s;
}
.navbar__hamburger:hover { background: var(--bg-soft, #F6FAF5); }
.navbar__hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: #555;
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}

/* 드로어 오버레이 */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1100;
}
.drawer-overlay.open { display: block; }

/* 드로어 패널 */
.drawer {
  position: fixed;
  top: 0; left: 0;
  width: 280px; height: 100%;
  background: #fff;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.22,1,.36,1);
  box-shadow: 4px 0 24px rgba(0,0,0,.12);
}
.drawer.open { transform: translateX(0); }

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #E8E8E8;
  flex-shrink: 0;
}
.drawer__header img { height: 28px; width: auto; object-fit: contain; }
.drawer__close {
  width: 32px; height: 32px;
  background: none; border: none;
  font-size: 18px; color: #888;
  cursor: pointer;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.drawer__close:hover { background: #f5f5f5; }

.drawer__nav {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}
.drawer__nav a {
  font-size: 16px;
  font-weight: 500;
  color: #444;
  padding: 14px 24px;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.drawer__nav a:hover { background: #F6FAF5; color: #1A1A1A; }
.drawer__nav a.active {
  color: var(--primary, #3A9E2F);
  font-weight: 700;
  border-left-color: var(--primary, #3A9E2F);
  background: rgba(58,158,47,.05);
}

.drawer__actions {
  padding: 16px 24px 32px;
  border-top: 1px solid #E8E8E8;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer__actions a {
  font-size: 14px;
  font-weight: 500;
  color: #888;
  text-decoration: none;
  padding: 8px 0;
  transition: color .2s;
}
.drawer__actions a:hover { color: #1A1A1A; }
.drawer__login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary, #3A9E2F);
  color: #fff !important;
  border-radius: 8px;
  padding: 12px 0 !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  transition: background .2s;
}
.drawer__login:hover { background: var(--primary-dark, #2D7D24); }

/* 모바일에서만 햄버거 표시 */
@media (max-width: 768px) {
  .navbar__hamburger { display: flex; }
}

