/* ==========================================
   ssregi - 쓰레기 배출 안내 서비스
   style.css
   ========================================== */

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

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary:     #CF6B28;
  --color-primary-dk:  #B85A1E;
  --color-accent:      #E8A87C;
  --color-bg:          #FAF9F5;
  --color-sidebar-bg:  #FAF9F5;
  --color-sidebar-border: #E2DDD5;
  --color-card-bg:     #FFFFFF;
  --color-text:        #1A1A1A;
  --color-text-muted:  #9A8E84;
  --color-divider:     #E2DDD5;

  --sidebar-width:     300px;
  --header-height:     56px;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;

  --shadow-card: 0 4px 24px rgba(180,140,100,0.15);
  --transition:  0.25s ease;
}

html, body {
  height: 100%;
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
}

/* ── App Layout ── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform var(--transition);
}

/* 사이드바 헤더 */
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--color-divider);
  background: linear-gradient(135deg, #FAF9F5, #F0EDE6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--color-text);
}

.brand-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 1px;
}

/* 현재 위치 카드 */
.location-card {
  background: var(--color-card-bg);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--color-divider);
}

.location-label {
  font-size: 10px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.location-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}

.location-name .icon-pin {
  font-size: 14px;
}

.location-detail {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* 위치 상태 표시 */
.location-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
  flex-shrink: 0;
}

.status-dot.active {
  background: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(207,107,40,0.25);
  animation: pulse 2s infinite;
}

.status-dot.error {
  background: #E74C3C;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── 네비게이션 메뉴 ── */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-section-title {
  font-size: 10px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 8px;
  margin-bottom: 8px;
  margin-top: 16px;
}

.nav-section-title:first-child {
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  user-select: none;
  position: relative;
}

.nav-item:hover {
  background: rgba(207,107,40,0.08);
  color: var(--color-text);
}

.nav-item.active {
  background: rgba(207,107,40,0.12);
  color: var(--color-primary);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

/* ── 사이드바 하단 ── */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--color-divider);
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.6;
}

.data-notice {
  display: flex;
  gap: 8px;
  background: #FFF8EE;
  border: 1px solid #F0D5B0;
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 10px;
  text-align: left;
}

.data-notice-icon {
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1.4;
}

.data-notice-body strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #8B5E2A;
  margin-bottom: 4px;
}

.data-notice-body p {
  font-size: 10px;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin-bottom: 6px;
}

.data-notice-report {
  font-size: 10px;
  color: var(--color-primary);
  text-decoration: none;
}

.data-notice-report:hover {
  text-decoration: underline;
}

.footer-copy {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ── 지도 영역 ── */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* ── 지도 위 컨트롤 ── */
.map-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.map-btn {
  width: 44px;
  height: 44px;
  background: var(--color-sidebar-bg);
  border: 1px solid var(--color-sidebar-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  box-shadow: var(--shadow-card);
}

.map-btn:hover {
  background: var(--color-card-bg);
  transform: scale(1.06);
}

/* 모바일 토글 버튼 */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(207,107,40,0.35);
}

/* 로딩 오버레이 */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 20px;
  transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-divider);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ── Toast 알림 ── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-card-bg);
  border: 1px solid var(--color-divider);
  color: var(--color-text);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: var(--shadow-card);
  white-space: nowrap;
  z-index: 9000;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── 모바일 반응형 ── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar-toggle {
    display: flex;
  }

  #map-container {
    width: 100vw;
  }

  .map-overlay {
    top: 68px;
  }
}

/* 사이드바 오버레이 (모바일) */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
}

#sidebar-backdrop.show {
  display: block;
}

/* ── 종량제봉투 판매소 팝업 (CustomOverlay) ── */
.store-popup {
  position: relative;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 14px 10px 12px;
  font-family: 'Noto Sans KR', sans-serif;
  min-width: 200px;
  max-width: 260px;
  line-height: 1.5;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  cursor: default;
}

/* 말풍선 꼬리 */
.store-popup::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.1));
}

.store-popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 12px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
}

.store-popup-close:hover {
  color: #333;
}

.store-popup-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 4px;
  padding-right: 16px;
}

.store-popup-addr {
  font-size: 11px;
  color: #555;
  margin-bottom: 3px;
  word-break: keep-all;
}

.store-popup-phone {
  font-size: 12px;
}

.store-popup-phone a {
  color: #CF6B28;
  text-decoration: none;
  font-weight: 600;
}

.store-popup-ref {
  font-size: 10px;
  color: #888;
  margin-top: 4px;
}

.store-popup-combined {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
}

/* scrollbar */
#sidebar::-webkit-scrollbar {
  width: 4px;
}
#sidebar::-webkit-scrollbar-track {
  background: transparent;
}
#sidebar::-webkit-scrollbar-thumb {
  background: var(--color-divider);
  border-radius: 2px;
}

/* ── 마커 필터 버튼 ── */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 12px 8px;
}

.filter-btn {
  flex: 1;
  padding: 7px 0;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  background: var(--color-card-bg);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  font-family: 'Noto Sans KR', sans-serif;
}

.filter-btn:hover {
  background: rgba(207,107,40,0.08);
  color: var(--color-text);
}

.filter-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.filter-btn-full {
  flex-basis: 100%;
}

/* ── 판매소 팝업 타입 배지 ── */
.popup-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 5px;
}

.badge-bag      { background: #FDECEA; color: #C0392B; }
.badge-both     { background: #EAF3FB; color: #2471A3; }
.badge-sticker  { background: #EAFAF1; color: #1E8449; }
.badge-clothing { background: #E8F8F5; color: #1ABC9C; }

/* ── 베타 공지 팝업 ── */
#beta-notice {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

#beta-notice.show {
  display: flex;
}

.beta-notice-box {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px 20px 20px;
  max-width: 340px;
  width: calc(100% - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  text-align: center;
}

.beta-notice-badge {
  display: inline-block;
  background: #CF6B28;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.beta-notice-text {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.7;
  margin-bottom: 16px;
}

.beta-notice-btn {
  width: 100%;
  padding: 11px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.beta-notice-btn:hover {
  background: var(--color-primary-dk);
}
