:root {
  --forest-dark: #0f1c14;
  --forest-main: #2D5A27;
  --peach-main: #FF8A7A;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --accent: #FFC09F;
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --z-header: 1000;
  --z-panel: 500;
  --z-modal: 2000;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background-color: var(--forest-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden; /* Prevent full page scroll, handle inside containers */
  line-height: 1.5;
}

/* Glassmorphism */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-premium);
}

.header {
  height: 70px;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.logo {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--peach-main), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.search-bar {
  flex: 0 1 400px;
  height: 44px;
  border-radius: 22px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-bar input {
  background: transparent;
  border: none;
  color: white;
  flex: 1;
  outline: none;
  font-size: 15px;
}

#btn-reset-filters {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s, transform 0.3s;
}

#btn-reset-filters:hover {
  color: var(--peach-main);
  transform: rotate(-30deg);
}

/* Auth Button */
.auth-btn {
  padding: 8px 16px; 
  border-radius: 20px;
  background: var(--forest-main);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}
.auth-btn.active {
  background: var(--peach-main);
}

/* Layout */
.main-container {
  padding-top: 70px;
  display: flex;
  height: 100vh;
}

#map-mock {
  flex: 1;
  background: var(--forest-dark);
  position: relative;
  z-index: 100;
}

/* Ensure Leaflet controls don't overlap our glass UI */
.leaflet-control-container {
  z-index: 200;
}
.leaflet-bottom, .leaflet-top {
  z-index: 200 !important;
}

#btn-search-here {
  position: fixed;
  bottom: 40px;
  left: calc(50% - 210px); /* 사이드패널(420px) 절반을 빼서 지도 중앙에 위치 */
  transform: translateX(-50%);
  z-index: 900;
  padding: 12px 24px;
  border-radius: 30px;
  background: var(--forest-main);
  color: white;
  border: 1px solid var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: auto;
}

#btn-search-here:active {
  transform: translateX(-50%) scale(0.95);
  background: var(--peach-main);
}

#btn-back-step {
  transition: opacity 0.3s, transform 0.3s;
}

#btn-back-step:hover {
  background: white !important;
  color: var(--peach-main) !important;
  transform: translateX(-50%) scale(1.05);
}

#btn-view-map {
  transition: transform 0.3s ease, background-color 0.3s ease;
}

#btn-view-map:hover {
  background-color: #ff7060 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,138,122,0.6) !important;
}

#btn-reset-filters:hover {
  background: var(--peach-main) !important;
  color: white !important;
}

.side-panel {

  width: 420px;
  height: calc(100vh - 70px);
  overflow-y: auto;
  border-left: 1px solid var(--glass-border);
  background: rgba(15, 28, 20, 0.95);
  backdrop-filter: blur(10px);
  padding: 24px;
  z-index: var(--z-panel);
  transition: transform 0.3s ease;
}

/* Ad Slot */
.ad-slot {
  width: 100%;
  height: 90px;
  border-radius: 16px;
  background: linear-gradient(45deg, rgba(255,255,255,0.05), rgba(255,255,255,0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  border: 1px dashed rgba(255,255,255,0.2);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}

/* 모바일 검색창 (데스크톱에서 기본 숨김) */
.mobile-search-bar {
  display: none;
}

/* Cards */
.store-card {
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
  transition: transform 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.store-card:hover {
  transform: translateY(-4px);
  border-color: var(--peach-main);
}

.store-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 16px;
}

.verified-badge {
  position: absolute;
  top: 30px;
  right: 30px;
  background: var(--forest-main);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  border: 1px solid var(--accent);
}

.store-info h3 { font-size: 18px; margin-bottom: 4px; }
.store-info p { font-size: 14px; color: var(--text-secondary); }

.facility-icons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.icon-tag {
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: #fff;
  border: 1px solid transparent;
  cursor: pointer;
}

/* Select Box UI Fix */
select.icon-tag {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

select.icon-tag option {
  background-color: var(--forest-dark);
  color: #fff;
}

select.icon-tag:focus {
  border-color: var(--peach-main);
  outline: none;
}
.icon-tag.active {
  background: var(--peach-main);
  color: var(--forest-dark);
  font-weight: 600;
}

/* Modals & Overlays */
.overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bottom-sheet {
  position: fixed;
  bottom: -100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  height: 85vh;
  border-radius: 30px 30px 0 0;
  padding: 40px;
  z-index: calc(var(--z-modal) + 1);
  transition: bottom 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  overflow-y: auto;
}

.bottom-sheet.active {
  bottom: 0;
}

/* Auth Modal Small */
.auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 24px;
  padding: 30px;
  z-index: calc(var(--z-modal) + 2);
  display: none;
  opacity: 0;
  transition: all 0.3s ease;
}
.auth-modal.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%);
}

.drag-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 0 auto 20px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-modal.active #pet-card-view,
.auth-modal.active #auth-form-view {
  animation: fadeIn 0.4s ease-out forwards;
}

#btn-unlink:hover {
  background: rgba(255, 100, 100, 0.1) !important;
  border-color: rgba(255, 100, 100, 0.8) !important;
  color: #ff8080 !important;
  transition: all 0.3s ease;
}
.animate-in { animation: fadeIn 0.6s ease forwards; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  #map-mock {
    height: calc(100vh - 70px - 68px - 40vh); /* 헤더(70) + 검색창영역(68) 제외 후 하단 패널 공간(40vh) 확보 */
    min-height: 300px;
    flex: none;
  }
  .side-panel {
    width: 100%;
    height: 50vh;
    border-left: none;
    border-top: 1px solid var(--glass-border);
    border-radius: 24px 24px 0 0;
    margin-top: -20px;
    padding-top: 16px;
    position: relative;
  }
  .header { padding: 0 16px; }
  .search-bar { display: none; }

  .main-container {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* '이 지역 탐색' 버튼: 모바일에서 지도 상단 중앙으로 이동 */
  #btn-search-here {
    position: absolute;
    top: 140px; /* 검색창(약 60px) 고려하여 하단으로 조정 */
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
  }
  #btn-search-here:active {
    transform: translateX(-50%) scale(0.95);
  }

  /* 모바일 검색창 */
  .mobile-search-bar {
    display: flex;
    position: relative;
    z-index: 1001;
    align-items: center;
    gap: 10px;
    margin: 12px 16px;
    padding: 0 16px;
    height: 44px;
    border-radius: 22px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    flex-shrink: 0;
  }
  .mobile-search-bar input {
    background: transparent;
    border: none;
    color: white;
    flex: 1;
    outline: none;
    font-size: 14px;
  }
  .mobile-search-bar .search-icon {
    color: var(--text-secondary);
    font-size: 16px;
    flex-shrink: 0;
  }

  .reset-search-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
  }

  .reset-search-btn:hover {
    color: var(--peach-main);
  }

}

/* 맨 위로 플로팅 버튼 (기본 숨김) */
#btn-scroll-top {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--peach-main);
  color: white;
  border: none;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  display: flex;
  opacity: 0;
  visibility: hidden;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}
#btn-scroll-top:active {
  transform: scale(0.9);
  background: var(--forest-main);
}

