/* ============================================================
   부산어디? (Busan Where?) — 메인 스타일시트
   Design System: 부산 오션 테마
   ============================================================ */

/* 1. CSS 변수 (라이트 모드) */
:root {
  /* Primary — 오션 딥 블루 */
  --color-primary-900: #0A2342;
  --color-primary-700: #0D3B6E;
  --color-primary-500: #1E90A5;
  --color-primary-300: #5EC8D8;
  --color-primary-100: #C8F0F5;

  /* Accent */
  --color-accent-coral: #FF6B6B;
  --color-accent-gold:  #F9A825;
  --color-accent-green: #26A65B;
  --color-accent-purple: #7C4DFF;

  /* Neutral */
  --color-neutral-950: #0F172A;
  --color-neutral-800: #1E293B;
  --color-neutral-600: #475569;
  --color-neutral-400: #94A3B8;
  --color-neutral-200: #E2E8F0;
  --color-neutral-100: #F1F5F9;
  --color-neutral-50:  #F8FAFC;
  --color-white:       #FFFFFF;

  /* Semantic (라이트 모드 기본값) */
  --bg-page:    #F8FAFC;
  --bg-card:    #FFFFFF;
  --bg-header:  #0A2342;
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-invert:    #FFFFFF;
  --border:     #E2E8F0;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.14);

  /* Typography */
  --font-ko: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  --font-en: 'Inter', sans-serif;

  /* Spacing (8px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Border Radius */
  --radius-sm:   8px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-xl:   32px;
  --radius-full: 999px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.3s ease;
  --transition-drawer: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 다크 모드 */
[data-theme="dark"] {
  --bg-page:    #0F172A;
  --bg-card:    #1E293B;
  --bg-header:  #020B18;
  --text-primary:   #F1F5F9;
  --text-secondary: #94A3B8;
  --border:     #334155;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ko);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-page);
  transition: background-color var(--transition-base), color var(--transition-base);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol { list-style: none; }

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
}

/* 스크롤바 숨김 (원본 유지) */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* 3. 레이아웃 */
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 767px) {
  .container { padding: 0 var(--space-4); }
}

/* 4. 타이포그래피 */
.text-display { font-size: 56px; font-weight: 800; line-height: 1.1; }
.text-h1 { font-size: 40px; font-weight: 700; line-height: 1.2; }
.text-h2 { font-size: 32px; font-weight: 700; line-height: 1.3; }
.text-h3 { font-size: 24px; font-weight: 600; line-height: 1.4; }
.text-h4 { font-size: 20px; font-weight: 600; line-height: 1.4; }
.text-body-lg { font-size: 18px; line-height: 1.6; }
.text-body    { font-size: 16px; line-height: 1.6; }
.text-body-sm { font-size: 14px; line-height: 1.5; }
.text-caption { font-size: 12px; line-height: 1.4; }

@media (max-width: 767px) {
  .text-display { font-size: 36px; }
  .text-h1      { font-size: 28px; }
  .text-h2      { font-size: 24px; }
  .text-h3      { font-size: 20px; }
}

/* 5. 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-base);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-primary-500);
  color: var(--color-white);
  box-shadow: 0 2px 8px rgba(30, 144, 165, 0.35);
}
.btn-primary:hover {
  background-color: var(--color-primary-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(30, 144, 165, 0.45);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-primary-500);
  border: 2px solid var(--color-primary-500);
}
.btn-secondary:hover {
  background-color: var(--color-primary-100);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover {
  background-color: var(--color-neutral-100);
  color: var(--text-primary);
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 6. 뱃지 */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.badge-ocean  { background: var(--color-primary-100); color: var(--color-primary-700); }
.badge-hot    { background: #FFE5E5; color: var(--color-accent-coral); }
.badge-new    { background: #D9F5E7; color: var(--color-accent-green); }
.badge-ai     { background: #EDE7FF; color: var(--color-accent-purple); }
.badge-gold   { background: #FFF3CD; color: #B8860B; }

/* 7. 카드 공통 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  border: 1px solid var(--border);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.card-img-wrapper {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--color-neutral-100);
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease-out;
}

.card:hover .card-img-wrapper img {
  transform: scale(1.05);
}

.card-body {
  padding: var(--space-4);
}

.card-category {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary-500);
  margin-bottom: var(--space-1);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-address {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 13px;
  color: var(--text-secondary);
}

.card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-accent-gold);
  font-weight: 600;
}

/* 8. 섹션 공통 */
.section {
  padding: var(--space-16) 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-title .emoji {
  font-size: 24px;
}

/* 9. 슬라이더 공통 */
.slider-wrapper {
  position: relative;
}

.slider-track {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-behavior: smooth;
  padding-bottom: var(--space-2);
}
.slider-track.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.slider-track.no-scrollbar::-webkit-scrollbar { display: none; }

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all var(--transition-base);
  color: var(--text-primary);
}
.slider-btn:hover {
  background: var(--color-primary-500);
  color: white;
  border-color: var(--color-primary-500);
}
.slider-btn.prev { left: -22px; }
.slider-btn.next { right: -22px; }

/* 10. 그리드 */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

@media (max-width: 1279px) {
  .grid-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
  .grid-cards { grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
}

@media (max-width: 479px) {
  .grid-cards { grid-template-columns: 1fr; }
}

/* 11. 스켈레톤 로딩 */
.skeleton {
  background: linear-gradient(90deg, var(--color-neutral-100) 25%, var(--color-neutral-200) 50%, var(--color-neutral-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s linear infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 12. 유틸리티 */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2        { gap: var(--space-2); }
.gap-4        { gap: var(--space-4); }
.mt-4         { margin-top: var(--space-4); }
.mb-4         { margin-bottom: var(--space-4); }
.hidden       { display: none !important; }
.sr-only      { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* 13. 스크롤 상단 이동 버튼 */
#scroll-top {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--color-primary-500);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform var(--transition-base);
  z-index: 900;
}
#scroll-top.visible { opacity: 1; pointer-events: auto; }
#scroll-top:hover   { transform: translateY(-3px); }

@media (max-width: 767px) {
  #scroll-top { bottom: 80px; right: var(--space-4); }
}

/* 14. 모달 오버레이 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.25s ease;
}
.modal-overlay.open .modal-box { transform: scale(1); }

/* 15. 검색 오버레이 */
#search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 35, 66, 0.95);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 120px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#search-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.search-input-wrapper {
  width: 90%;
  max-width: 640px;
  position: relative;
}
.search-input-wrapper input {
  width: 100%;
  padding: 18px 56px 18px var(--space-6);
  font-size: 20px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: white;
  outline: none;
}
.search-input-wrapper input::placeholder { color: rgba(255,255,255,0.5); }
.search-input-wrapper input:focus { border-color: var(--color-primary-300); }
.search-close-btn {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.7;
}
.search-close-btn:hover { opacity: 1; }

.search-autocomplete {
  width: 90%;
  max-width: 640px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  margin-top: var(--space-3);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
}
.search-autocomplete-item {
  padding: 12px var(--space-6);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  transition: background var(--transition-fast);
}
.search-autocomplete-item:hover { background: var(--color-neutral-100); }
.search-autocomplete-item:last-child { border-bottom: none; }
