/* ==========================================================================
   기사 속 장소 찾기 - CSS Style (2016 레트로 감성 & 현대적 반응형 UI)
   ========================================================================== */

:root {
  --primary-color: #1a365d;
  --primary-hover: #2a4365;
  --accent-color: #c53030;
  --delivery-color: #dd6b20;
  --bg-color: #f7fafc;
  --surface-color: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #2d3748;
  --text-muted: #718096;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --header-height: auto;
  --sidebar-width: 380px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", Dotum, 돋움, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-color);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* ==========================================================================
   1. 헤더 (Header)
   ========================================================================== */
#site-header {
  background-color: var(--surface-color);
  border-bottom: 2px solid var(--border-color);
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: #ffffff;
}

.header-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-tag {
  background-color: var(--accent-color);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.header-title-box h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.header-sub {
  font-size: 0.85rem;
  color: #e2e8f0;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  padding-left: 10px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: #2b6cb0;
  color: #ffffff;
}
.btn-primary:hover {
  background-color: #2c5282;
}

.btn-primary .badge {
  background-color: #ffffff;
  color: #2b6cb0;
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}
.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

.btn-special {
  background-color: var(--delivery-color);
  color: #ffffff;
}
.btn-special:hover {
  background-color: #c05621;
}

/* 안내 배너 (원작 고증: 공식 지진 안내 링크) */
#safety-banner {
  background-color: #fffaf0;
  border-bottom: 1px solid #feebc8;
  padding: 6px 20px;
  font-size: 0.8rem;
  color: #744210;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-icon {
  font-size: 1rem;
}

.banner-text a {
  color: #c05621;
  text-decoration: underline;
  font-weight: 600;
  margin-left: 2px;
}

.banner-text a:hover {
  color: #7b341e;
}

/* ==========================================================================
   2. 메인 컨텐츠 레이아웃 (사이드바 + 지도)
   ========================================================================== */
#main-content {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* 사이드바 (장소 목록) */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--surface-color);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 500;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.sidebar-header {
  padding: 14px 18px 10px;
  background-color: #edf2f7;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
}

.sidebar-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 장소 아이템 목록 */
.places-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.place-item {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.place-item:hover {
  border-color: #90cdf4;
  background-color: #ebf8ff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.place-item.active {
  border-color: var(--accent-color);
  background-color: #fff5f5;
  box-shadow: 0 0 0 2px rgba(197, 48, 48, 0.2);
}

.place-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.place-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: #e2e8f0;
  color: #4a5568;
  font-weight: 600;
}

.place-item.active .place-tag {
  background-color: var(--accent-color);
  color: #ffffff;
}

.place-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.place-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.place-article-title {
  font-size: 0.8rem;
  color: #4a5568;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 2화 배송지 패널 스타일 */
.delivery-panel {
  border-top: 2px dashed var(--delivery-color);
  background-color: #fffaf0;
  padding: 14px;
  margin-top: 10px;
}

.delivery-panel.hidden {
  display: none;
}

.delivery-header h3 {
  font-size: 0.9rem;
  color: var(--delivery-color);
  font-weight: 800;
}

.delivery-sub {
  font-size: 0.75rem;
  color: #7b341e;
  font-style: italic;
  display: block;
  margin-bottom: 10px;
}

.delivery-item {
  background-color: #ffffff;
  border: 1px solid #fbd38d;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}

.delivery-item:hover {
  background-color: #feebc8;
}

.delivery-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9c4221;
}

.delivery-memo {
  font-size: 0.78rem;
  color: #744210;
  margin-top: 4px;
  line-height: 1.3;
}

/* 지도 섹션 */
#map-section {
  flex: 1;
  height: 100%;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background-color: #e5e3df;
}

/* ==========================================================================
   3. Leaflet 커스텀 팝업 & 마커 스타일
   ========================================================================== */
.custom-popup .leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  border-top: 4px solid var(--accent-color);
}

.custom-popup.delivery-popup .leaflet-popup-content-wrapper {
  border-top: 4px solid var(--delivery-color);
}

.popup-card {
  padding: 6px 4px;
  max-width: 280px;
}

.popup-tag {
  font-size: 0.7rem;
  background-color: #fed7d7;
  color: #9b2c2c;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 4px;
}

.popup-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 6px;
}

.popup-article {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2b6cb0;
  line-height: 1.35;
  margin-bottom: 6px;
  display: block;
}

.popup-desc {
  font-size: 0.78rem;
  color: #4a5568;
  margin-bottom: 8px;
  line-height: 1.4;
  background-color: #f7fafc;
  padding: 6px;
  border-radius: 4px;
}

.popup-link {
  display: inline-block;
  font-size: 0.75rem;
  color: #ffffff;
  background-color: #2b6cb0;
  padding: 4px 10px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.2s;
}

.popup-link:hover {
  background-color: #1a365d;
}

/* 마커 핀 스타일 */
.quake-pin {
  width: 28px;
  height: 28px;
  background-color: var(--accent-color);
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  animation: pulse-pin 2s infinite;
}

@keyframes pulse-pin {
  0% { box-shadow: 0 0 0 0 rgba(197, 48, 48, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(197, 48, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(197, 48, 48, 0); }
}

.delivery-pin {
  width: 28px;
  height: 28px;
  background-color: var(--delivery-color);
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

/* ==========================================================================
   4. 푸터 (Footer: 김재현 안내 고증)
   ========================================================================== */
#site-footer {
  background-color: #2d3748;
  color: #e2e8f0;
  padding: 8px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  border-top: 1px solid #4a5568;
  z-index: 1000;
  flex-shrink: 0;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.author-title {
  font-weight: 700;
  color: #63b3ed;
}

.author-note strong {
  color: #fed7d7;
}

.tech-stack {
  color: #a0aec0;
  font-size: 0.7rem;
}

/* ==========================================================================
   5. 모바일 반응형 처리 (원작 47행 고증: 작은 화면에서 목록 접기/펼치기)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 85vw;
  }

  .header-main {
    padding: 8px 12px;
  }

  .header-title-box h1 {
    font-size: 1.1rem;
  }

  .header-sub {
    display: none;
  }

  .btn-text {
    display: none;
  }

  button {
    padding: 6px 10px;
  }

  #safety-banner {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  /* 모바일 서랍(Drawer) 형태 사이드바 */
  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    max-width: 340px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 999;
  }

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

  #site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    font-size: 0.72rem;
  }

  .footer-right {
    display: none;
  }
}
