/* 
    기본 설정 및 공통 변수
    */
:root{
  --color-primary: #2ace48;      /* 주요 포인트 색 (초록) */
  --color-text: #222;            /* 일반 텍스트 색 */
  --color-muted: #555;           /* 보조 텍스트 색 */
  --color-bg: #fff;              /* 배경색 (흰색) */
  --color-bg-soft: #f9f9f9;      /* 부드러운 회색 배경 */
  --color-line: #e9e9e9;         /* 경계선 기본색 */
  --color-line-soft: #eee;       /* 연한 경계선 */
  --shadow-strong: 0 10px 24px rgba(0,0,0,0.18);  /* 강한 그림자 */
  --shadow-medium: 0 4px 12px rgba(0,0,0,0.12);   /* 중간 그림자 */
  --shadow-light: 0 4px 10px rgba(0,0,0,0.08);    /* 약한 그림자 */
  --cat-h: 56px;            /* 카테고리 바 고정 높이 */

}

/* 페이지 기본 구조 */
html, body { height: 100%; margin: 0; padding: 0; }
#brand-menu-list-root, #map { position: relative; }
#map { width: 100%; height: 100vh; }

/* 
    카테고리 스크롤 버튼
    */
/* 기존 position: fixed 제거 */
.category-scroll-wrapper {
  top: 0;
  left: 0;
  right: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 10;
  scrollbar-width: none;
  background: #fff;       /* 리스트 상단 배경 */
  border-bottom: 1px solid #eee;
  position: sticky;       /* 리스트뷰에서 스크롤해도 상단 고정 */
}
.category-scroll-wrapper::-webkit-scrollbar { display: none; }

.category-buttons { display: inline-flex; padding: 0 10px; gap: 8px; }

.category-btn {
  flex: 0 0 auto; min-width: 80px;
  padding: 6px 14px; font-size: 14px;
  background: var(--color-bg);
  border: 1px solid #ccc; border-radius: 6px;
  white-space: nowrap; cursor: pointer;
}
.category-btn.active {
  background: var(--color-primary);
  color: #fff; border-color: var(--color-primary);
}

/* 
    하단 슬라이드 패널
    */
.slide-panel {
  position: fixed; bottom: -100%; left: 50%;
  transform: translateX(-60%);
  width: 92%; max-width: 480px;
  background: var(--color-bg); border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 10000;
  transition: bottom 0.4s ease-in-out, transform 0.4s ease-in-out;
}
/* 패널 열림 상태 */
.slide-panel.show { bottom: 0; transform: translateX(-50%); }

/* 패널 헤더 (닫기 버튼, 드래그바 등) */
.panel-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  padding: 15px 20px; background: var(--color-bg);
  border-bottom: 1px solid #f0f0f0; border-radius: 20px;
}
.drag-bar { width: 40px; height: 5px; background: #ccc; border-radius: 4px; margin-bottom: 10px; }
.close-btn {
  position: absolute; top: 10px; right: 20px;
  font-size: 24px; cursor: pointer; background: transparent; border: 0;
}

/* 패널 내부 정보 */
.brand-simple-panel { padding: 20px; }
.brand-info-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.brand-logo {
  width: 60px; height: 60px;
  object-fit: contain; border-radius: 10px; background: #f2f2f2;
}
.branch-extra-info {
  margin-top: 5px; font-size: 13px;
  color: var(--color-muted); line-height: 1.5; text-align: center;
}
.visit-btn {
  width: 100%; padding: 12px;
  font-size: 16px; cursor: pointer;
  background: var(--color-primary); color: #fff;
  border: none; border-radius: 10px;
}

/* 
    하단 고정 버튼 (지도/리스트 토글 등)
    */
.location-btn,
.toggle-view-btn {
  position: fixed; bottom: 60px; z-index: 9000;
  color: #fff; background: var(--color-primary);
  border: none; border-radius: 8px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.location-btn { right: 20px; padding: 10px 14px; font-size: 14px; }
.toggle-view-btn { left: 20px; padding: 8px 14px; font-size: 13px; }

/* 
    매장 리스트 화면
    */
.store-list {
  height: 100vh; overflow-y: auto;
  padding: 16px; background: var(--color-bg-soft);
}
.store-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; cursor: pointer;
  margin-bottom: 8px; padding: 12px;
  background: var(--color-bg); border: 1px solid #ddd; border-radius: 8px;
}

/* 즐겨찾기 아이콘 */
.favorite-icon-wrapper { margin-left: 10px; font-size: 20px; }
.favorite-icon {
  font-size: 24px; cursor: pointer; transition: color 0.3s; color: #ccc;
}
.favorite-icon.favorited { color: red; }

/* 
    하단 검색 바 (리스트 뷰 전용)
    */
.search-bar {
  position: sticky; bottom: 0; z-index: 3;
  display: flex; gap: 8px; padding: 10px;
  background: var(--color-bg); border-top: 1px solid var(--color-line-soft);
}
#storeSearchInput {
  flex: 1; height: 40px; padding: 0 12px; font-size: 15px;
  border: 1px solid #ddd; border-radius: 10px;
}
#clearSearchBtn {
  width: 40px; height: 40px; line-height: 1; font-size: 20px;
  background: #fafafa; border: 1px solid #ddd; border-radius: 10px;
}

/* 
    플로팅 검색 바 (지도 화면 전용)
    */
.floating-search{
  position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%);
  width: min(680px, 88vw); padding: 14px 12px;
  display: flex; align-items: center; gap: 10px;
  background: var(--color-bg); border-radius: 9999px;
  box-shadow: var(--shadow-strong); z-index: 5;
}

/* 위쪽 작은 드래그바 */
.floating-search .drag-indicator{
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 72px; height: 6px; border-radius: 999px;
  background: linear-gradient(#e9e9e9,#dcdcdc); opacity: .9;
}

/* 검색 입력창 스타일 */
.floating-search .search-box{
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 9999px;
  background: #f3f3f4; border: 1px solid var(--color-line);
}
.floating-search .search-box .ico{ flex: none; color: #8f8f93; }
.floating-search input[type="search"]{
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 16px; color: #202124;
}

/* 우측 기능 버튼 (예: 필터, 음성검색 등) */
.floating-search .right-actions{
  display: flex; align-items: center; gap: 8px;
}

/* 아이콘 버튼 공통 스타일 */
.icon-btn{
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text); background: var(--color-bg);
  border: 1px solid var(--color-line); box-shadow: var(--shadow-light);
}

/* compact 모드 (축소 상태) */
.floating-search.compact{
  width: min(680px, 88vw);
  padding: 8px 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,.14);
}
.floating-search.compact .drag-indicator{ top: 4px; width: 52px; height: 4px; }
.floating-search.compact .search-box{ padding: 6px 10px; }
.floating-search.compact .search-box .ico{ width: 16px; height: 16px; }
.floating-search.compact input[type="search"]{ font-size: 14px; line-height: 20px; }
.floating-search.compact .right-actions .icon-btn{
  width: 32px; height: 32px; border-radius: 10px;
}

/* 
    내 위치 버튼 (검색창 근처)
    */
.floating-locate{
  position: absolute; right: 30px; bottom: 180px;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text); background: var(--color-bg);
  border: 1px solid var(--color-line); box-shadow: var(--shadow-medium);
  z-index: 6;
}
/* compact 상태에서 버튼 축소 */
.floating-locate.compact,
.compact ~ .floating-locate{
  width: 34px; height: 34px; box-shadow: 0 3px 10px rgba(0,0,0,.12);
}

/* 
    반응형 (작은 화면 보정)
    */
@media (max-width: 380px){
  .icon-btn{ width: 36px; height: 36px; }
  .floating-search{ padding: 12px 10px; }
}

/* 리스트 상단 고정(sticky) + 항상 같은 높이 점유 */
.store-list .category-scroll-wrapper{
  height: var(--cat-h);
  position: sticky; top: 0;
  display: flex; align-items: center;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background: #fff; border-bottom: 1px solid #eee;
  z-index: 10; scrollbar-width: none;

  /* 출렁임 방지용: 기본은 숨김(투명) 상태, 공간은 유지 */
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease;
}
.store-list .category-scroll-wrapper::-webkit-scrollbar{ display:none; }

/* 리스트 모드일 때만 보여주기 (레이아웃 변화 없음) */
.brand-menu-list.list-mode .category-scroll-wrapper{
  opacity: 1; pointer-events: auto;
}

/* 버튼 스타일(그대로 사용 가능) */
.category-buttons { display: inline-flex; padding: 0 10px; gap: 8px; }
.category-btn{
  flex: 0 0 auto; min-width: 80px;
  padding: 6px 14px; font-size: 14px;
  background:#fff; border:1px solid #ccc; border-radius:6px;
  white-space: nowrap; cursor: pointer;
}
.category-btn.active{ background:#2ace48; color:#fff; border-color:#2ace48; }
