/* 1. 나눔스퀘어 네오 폰트 불러오기 (CDN) */
@import url("https://cdn.jsdelivr.net/gh/moonspam/NanumSquareNeo/nanumsquareneo.css");

/* 2. 기본 리셋 및 폰트 설정 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "NanumSquareNeo", sans-serif; /* 폰트 적용 */
  background-color: #1f2538;
  color: #333;
}

/* 상단 히어로 섹션 */
.hero-section {
  position: relative;
  width: 100%;
  height: 50vh; /* 화면 높이의 50% 차지 */
  min-height: 450px;
  background-image: url("../images/backgrounds/default.jpg");
  background-size: cover; /* 꽉 채우기 */
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease-in-out;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 80px; /* Navbar 공간 확보 */
  padding-bottom: 80px; /* 아래쪽 여유 공간 확보 */
}

.hero-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3); /* 30% 어두운 막 */
}

/* 로고 디자인 */
.title-logo {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 300; /* Light */

  display: flex;
  align-items: center;
  gap: 10px;
}

.title-logo strong {
  font-weight: 800; /* ExtraBold */
}

.title-logo img {
  height: 3rem;
}

.card-link {
  text-decoration: none;
}

/* navbar 디자인 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 15px 40px;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease-in-out;
}

.navbar.scrolled {
  background-color: rgba(23, 37, 42, 0.95);
  padding: 10px 40px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* 오른쪽 그룹 (메뉴 + 스위치 + 햄버거) 정렬 */
.nav-right {
  display: flex;
  align-items: center;
  gap: 25px; /* 요소 사이 간격 */
}

/* 1. 데스크톱 메뉴 스타일 */
.desktop-menu {
  display: flex;
  gap: 20px;
  list-style: none;
}

.desktop-menu a {
  text-decoration: none;
  color: #fff; /* 흰색 글씨 */
  font-weight: 700;
  font-size: 1rem;
  position: relative;
  transition: color 0.3s;
}

/* 메뉴에 마우스 올리면 밑줄 쫙 */
.desktop-menu a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: #fff;
  transition: width 0.3s;
}

.desktop-menu a:hover::after {
  width: 100%;
}

/* 2. 섭씨/화씨 스위치 (텍스트 보이게 수정됨) */
.toggle-wrapper {
  position: relative;
  width: 64px;
  height: 32px;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-label {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #2b7a78; /* 기본 색상 */
  border-radius: 30px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: 0.4s;
}

/* 스위치 안의 텍스트 배치 */
.label-text {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.8);
  user-select: none; /* 드래그 방지 */
}

.label-text.c {
  right: 10px;
} /* 공이 왼쪽에 있을 때 보이는 C는 오른쪽에 배치 */
.label-text.f {
  left: 10px;
} /* 공이 오른쪽에 있을 때 보이는 F는 왼쪽에 배치 */

/* 하얀색 공 */
.toggle-ball {
  position: absolute;
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* 통통 튀는 효과 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 2; /* 글씨보다 위에 */
}

/* 체크되었을 때 (화씨 모드) */
.toggle-input:checked + .toggle-label {
  background-color: #e17055; /* 주황색 */
}

.toggle-input:checked + .toggle-label .toggle-ball {
  transform: translateX(32px); /* 공 이동 */
}

/* 3. 반응형 (모바일) 설정 */
.hamburger-btn {
  display: none; /* PC에선 숨김 */
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

.mobile-menu {
  display: none; /* PC에선 숨김 */
}

/* 히어로 내부 컨텐츠 (검색창 등) */
.hero-content {
  position: relative;
  z-index: 5; /* 오버레이보다 위에 표시 */
  width: 100%;
  max-width: 600px;
  padding: 0 20px;
}

.hero-title {
  color: #fff;
  margin-bottom: 30px;
  font-weight: 700;
  font-size: 2rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* 검색창 디자인 */
.search-box {
  display: flex;
  background: #fff;
  border-radius: 50px;
  padding: 5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.search-box:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
}

input {
  flex: 1;
  border: none;
  padding: 15px 25px;
  font-size: 1.1rem;
  border-radius: 50px;
  outline: none;
  font-family: "NanumSquareNeo", sans-serif;
}

#searchBtn {
  background-color: #2b7a78; /* 포인트 컬러 (청록색) */
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s;
}

#searchBtn:hover {
  background-color: #17252a;
}

#clearBtn {
  background: transparent; /* 배경 투명 */
  border: none;
  color: #999; /* 연한 회색 */
  cursor: pointer;
  padding: 0 10px; /* 좌우 여백 */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

#clearBtn:hover {
  color: #333; /* 마우스 올리면 진하게 */
}

.history-container {
  margin-top: 25px;
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  padding: 10px 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;

  /* 스크롤바 숨기기 (선택사항) */
  -ms-overflow-style: none; /* IE, Edge */
  scrollbar-width: none; /* Firefox */
}

.history-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.history-btn {
  flex-shrink: 0; /* 공간 좁아도 줄어들지 않음 */
  white-space: nowrap; /* 글자 줄바꿈 방지 */
  background: rgba(255, 255, 255, 0.3); /* 반투명 흰색 */
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 8px 16px;
  border-radius: 10px;
  color: #333;
  font-family: "NanumSquareNeo", sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease; /* 부드러운 움직임 */
}

/* 마우스 올렸을 때 효과 */
.history-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px); /* 살짝 위로 뜸 */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 메인 컨텐츠 영역 */
.container {
  max-width: 1200px;
  margin: -60px auto 50px; /* 히어로 영역 위로 살짝 겹치게 (-60px) */
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.weather-result {
  text-decoration: none;
}

/* 날씨 카드 (현재 날씨) */
.weather-card {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  border-radius: 25px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;

  /* 애니메이션 설정 */
  transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); /* 아주 부드러운 움직임 */
  cursor: pointer;
  position: relative;
  overflow: hidden; /* 내용이 넘치지 않게 */
}
.weather-header {
  transition: all 0.5s ease;
}
.main-icon {
  width: 120px;
  margin-top: 20px;
  transition: all 0.5s ease; /* 아이콘 크기/위치 변경 애니메이션 */
}
.temp {
  font-size: 4rem;
  font-weight: 800;
  margin-top: 10px 0;
  transition: all 0.5s ease;
}
.desc {
  transition: all 0.5s ease;
  padding: 10px;
}
.dust-good {
  color: #1fa4ff;
}
.dust-normal {
  color: #22bb22;
}
.dust-not-good {
  color: #ffdd3d;
}
.dust-bad {
  color: #ff7f00;
}
.dust-very-bad {
  color: #fe3636;
}
.dust-danger {
  color: #ff73ff;
}

.dust-info-box {
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.3);
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 12px;
  display: inline-flex;
  flex-direction: column; /* 세로로 쌓기 */
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  transition: all 0.5s ease;
}

.dust-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
/* 숨겨진 상세 정보 영역 (기본 상태) */
.weather-details {
  max-height: 0; /* 높이를 0으로 해서 숨김 */
  opacity: 0; /* 투명하게 */
  margin-top: 0;
  overflow: hidden; /* 내용이 삐져나오지 않게 */
  transition: all 0.5s ease; /* 스르륵 열리는 효과 */
}

/* 화살표 아이콘 (아래쪽에 작게 표시) */
.expand-icon {
  margin-top: 10px;
  color: black;
  transition: transform 0.5s ease;
  animation: bounce 2s infinite;
}

/* 카드 전체: 배경색 살짝 진하게 */
.weather-card.expanded {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  padding-bottom: 40px;
}

/* 아이콘: 왼쪽 위로 이동하면서 작아짐 */
/* transform을 쓰면 레이아웃을 깨지 않고 이동시킬 수 있습니다 */
.weather-card.expanded .main-icon {
  width: 90px; /* 크기 줄임 */
  transform: translateX(-50px) /*translateY(-10px)*/; /* 왼쪽으로 이동 */
}

/* 온도: 오른쪽으로 살짝 이동하며 크기 줄임 */
.weather-card.expanded .temp {
  font-size: 2.5rem;
  transform: translateX(50px) translateY(-80px); /* 아이콘 옆으로 이동 */
}

/* 설명: 위치 조정 */
.weather-card.expanded .desc {
  transform: translateY(-60px);
  opacity: 0.8;
}

.weather-card.expanded .dust-info-box {
  transform: translateY(-60px);
  background: rgba(0, 0, 0, 0.5);
}

/* 상세 정보: 스르륵 열림 */
.weather-card.expanded .weather-details {
  max-height: 500px; /* 충분히 큰 값 */
  opacity: 1;
  margin-top: -30px; /* 위쪽 요소들이 올라갔으므로 간격 조정 */
}

/* 화살표: 180도 회전 (접기 모양) */
.weather-card.expanded .expand-icon {
  transform: rotate(180deg);
  animation: none; /* 멈춤 */
}

/* 통통 튀는 화살표 애니메이션 */
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}

/* 안내 문구 */
.empty-state {
  background: white;
  padding: 50px;
  border-radius: 20px;
  text-align: center;
  color: #888;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.weather-card img,
.forecast-card img {
  /* 어떤 필터나 다크모드 확장 프로그램도 이미지 색상을 못 바꾸게 함 */
  filter: none !important;
  /* 이미지 렌더링을 부드럽게 */
  image-rendering: -webkit-optimize-contrast;
}

/* --- 상세 정보 (Visuals) 스타일 --- */
.visual-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 30px 0;
}

.detail-card {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px); /* 뒤가 흐릿하게 비침 */
  border: 1px solid rgba(255, 255, 255, 0.4); /* 얇은 유리 테두리 */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* 은은한 그림자 */
  border-radius: 20px;
  padding: 20px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.3s;
}

.detail-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.35);
}

/* 텍스트 스타일 */
.detail-title {
  font-size: 0.9rem;
  color: #555;
  font-weight: 600;
}

.detail-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: #222;
}

/* 일출/일몰 */
.sun-time {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.7rem;
  color: #555;
}

/* 차트 컨테이너 */
.chart-container {
  width: 100%;
  height: 150px;
  margin-top: 20px;
}

/* 예보 컨테이너 (가로 스크롤 가능하게) */
.forecast-container {
  display: flex;
  flex-direction: row;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 예보 카드 */
.forecast-card {
  background: rgba(255, 255, 255, 0.8);
  padding: 20px 15px;
  border-radius: 15px;
  width: 120px; /* 조금 더 넓게 */
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s;
  animation: fadeInUp 0.8s ease-out;
}

.forecast-card:hover {
  transform: translateY(-5px);
}

.forecast-card .day {
  font-weight: 800;
  color: #2b7a78;
  margin-bottom: 5px;
}
.forecast-card img {
  width: 50px;
}
.forecast-card .temp {
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
}

/* 애니메이션 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- 대한민국 지도 스타일 --- */
.modal-content.map-content {
  background: #eef2f3;
  max-width: 400px;
  height: 600px;
}
.korea-map-bg {
  position: relative;
  width: 100%;
  height: 500px;
  background-image: url("https://upload.wikimedia.org/wikipedia/commons/d/dc/Map_of_South_Korea-blank.svg"); /* 무료 지도 이미지 */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin: 0 auto;
}
.map-pin {
  width: 3rem;
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: bold;
  color: #333;
  text-shadow: 0 0 5px white;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 13px;
}
.close-map {
  float: right;
  font-size: 28px;
  cursor: pointer;
}

.modal {
  display: none; /* 평소엔 숨김 */
  position: fixed;
  z-index: 3000; /* 맨 위에 */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6); /* 뒷배경 어둡게 */
  backdrop-filter: blur(5px); /* 뒷배경 흐리게 */
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
  animation: fadeIn 0.3s;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  position: relative;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content.info-content {
  max-width: 350px; /* 작고 귀여운 사이즈 */
  text-align: center;
  padding: 40px 30px;
}

.close-info {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: #aaa;
}
.close-info:hover {
  color: #333;
}

.info-body {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.app-logo img {
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.info-body h3 {
  margin: 0;
  color: #2b7a78;
  font-size: 1.5rem;
}

.version {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.divider {
  width: 100%;
  height: 1px;
  background: #eee;
  margin: 10px 0;
}

.desc {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #555;
}

.creator-info {
  margin-top: 15px;
  background: #f9f9f9;
  width: 100%;
  padding: 15px;
  border-radius: 12px;
}

.creator-info p {
  margin: 3px 0;
}

.links a {
  display: inline-block;
  margin-top: 8px;
  color: #2b7a78;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.9rem;
}
.links a:hover {
  text-decoration: underline;
}

.tech-stack {
  margin-top: 15px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.tech-stack span {
  background: #eef2f3;
  color: #666;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

footer {
  color: white;
  text-align: center;
  margin-bottom: 10px;
}

::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #1f2538;
}
::-webkit-scrollbar-thumb {
  background: #3a4b66;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #55698a;
}

/* 모바일 반응형 디자인*/
@media (max-width: 768px) {
  /* 1. 레이아웃 및 여백 조정 */
  .hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 40px;
    min-height: 50vh; /* 높이 확보 */
  }

  .hero-content {
    width: 100%;
    padding: 0 20px; /* 좌우 여백 확보 */
    margin-top: 0;
    box-sizing: border-box; /* 패딩 포함 크기 계산 */
  }

  /* 2. [문제 해결] 검색창 튀어나감 방지 */
  .search-box {
    width: 100%; /* 부모(hero-content) 너비에 딱 맞춤 */
    max-width: 100%; /* 화면 넘어감 방지 */
    display: flex; /* 내부 요소 가로 정렬 */
    box-sizing: border-box;
  }

  .search-box input {
    flex: 1; /* 남은 공간 다 차지하기 */
    width: auto; /* 고정 너비 해제 */
    min-width: 0; /* 플렉스 박스 찌그러짐 방지 */
    font-size: 1rem;
  }

  /* 3. Navbar 여백 조정 */
  .navbar {
    padding: 15px 20px;
  }

  /* PC 메뉴 숨김 */
  .desktop-menu {
    display: none;
  }
  .hamburger-btn {
    display: block;
  }

  /* 4. 모바일 메뉴 (전체 화면 덮기) */
  .mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(23, 37, 42, 0.98); /* 진한 배경 */
    backdrop-filter: blur(10px);
    z-index: 2000; /* 제일 위에 */

    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
  }

  .mobile-menu.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
  }

  /* 5. [추가] 닫기(X) 버튼 스타일 */
  .close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    transition: transform 0.3s;
  }
  .close-btn:hover {
    transform: rotate(90deg); /* 마우스 올리면 회전 */
    color: #ff7e67;
  }

  /* 6. [추가] 메뉴 링크 밑줄 제거 */
  .mobile-menu a {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none; /* ★ 밑줄 제거 핵심 코드 */
    padding: 10px 30px;
    border-radius: 50px;
  }

  .mobile-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ff7e67;
  }

  .history-container {
    margin-top: 0px;
  }

  .weather-card {
    margin-top: 20px;
  }

  /* 7. 예보 카드 가로 스크롤 (유지) */
  .forecast-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 5px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* 파이어폭스 스크롤바 숨김 */
  }
  .forecast-container::-webkit-scrollbar {
    display: none;
  } /* 크롬 스크롤바 숨김 */

  .forecast-card {
    min-width: 110px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .visual-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}
