/* 초기 상태에서 빈 정보창 숨기기 */
#overlay,
#details {
  display: none; /* 초기에는 보이지 않도록 설정 */
}

/* 전체 화면 스타일 */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 검색창과 돋보기 버튼 컨테이너 스타일 */
.search-container {
  display: flex;
  justify-content: center;
  align-items: center; /* 모든 요소의 세로 높이를 일치 */
  margin: 20px auto;
  width: 600px;
  height: 40px; /* 컨테이너 높이를 고정하여 내부 요소 정렬 */
  box-sizing: border-box;
}

/* 드롭다운 메뉴 스타일 */
#searchScope {
  height: 100%; /* 컨테이너 높이에 맞춤 */
  display: inline-block;
  vertical-align: middle;
  padding: 5px; /* 드롭다운 내부 여백 */
  font-size: 16px;
  border: 2px solid #ccc;
  border-radius: 5px 0 0 5px;
  box-sizing: border-box;
}

/* 검색창 스타일 */
#search {
  height: 100%; /* 컨테이너 높이에 맞춤 */
  width: calc(100% - 150px); /* 드롭다운과 버튼 크기를 제외한 나머지 너비 */
  border: 2px solid #ccc;
  border-left: none;
  border-right: none;
  font-size: 16px;
  padding-left: 10px;
  box-sizing: border-box;
}

/* 돋보기 버튼 스타일 */
#searchButton {
  height: 100%; /* 컨테이너 높이에 맞춤 */
  width: 40px;
  border: 2px solid #ccc;
  border-left: none;
  border-radius: 0 5px 5px 0;
  background-color: #f0f0f0;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

#searchButton img {
  width: 20px;
  height: 20px;
}

/* 모바일 화면에서 검색창 길이 수정 */
@media (max-width: 768px) {
  .search-container {
    width: 80%; /* 검색창이 화면 너비의 80% 차지 */
  }

  #search {
    width: calc(100% - 40px); /* 돋보기 버튼 제외한 나머지 공간 */
  }
}

/* 갤러리 스타일 */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px;
  width: 80%;
}

.gallery img {
  width: 100%;
  height: auto;
  border-radius: 5px;
  cursor: pointer;
}

/* 정보창 스타일 (PC 버전) */
#details {
  display: none; /* 기본적으로 숨김 */
  flex-direction: row;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  z-index: 1000;
  width: 60%;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.details img {
  width: 50%; /* 이미지 크기 웹페이지 크기의 절반 */
  height: auto;
  border-radius: 5px;
  margin-right: 20px; /* 이미지와 정보 사이 간격 */
}

.details-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 10px;
}

.details-info textarea {
  width: 100%;
  height: 50px;
  resize: none;
  font-size: 16px;
  box-sizing: border-box;
}

/* 모바일 화면 (768px 이하) */
@media (max-width: 768px) {
  #details {
    flex-direction: column; /* 세로 배치 */
    width: 90%;
    max-width: 80%;
    padding: 10px;
    gap: 10px;
    text-align: center;
    max-height: 90vh; /* 화면 높이의 90%로 설정 */
    overflow-y: auto; /* 스크롤 허용 */
    position: fixed; /* 화면 중앙에 고정 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 화면 중앙으로 정렬 */
    box-sizing: border-box; /* 패딩 포함한 높이 계산 */
    z-index: 1000;
  }

  #details img {
    width: 100%; /* 부모 요소의 가로폭에 맞춤 */
    max-height: 100%; /* 이미지 높이 제한 */
    height: auto; /* 비율 유지 */
    position: relative;
    left: 3%; /* 오른쪽 스크롤때문에 왼쪽에 살짝 여백 */
    object-fit: contain; /* 이미지 비율 유지하며 부모 높이에 맞게 축소 */
    margin-bottom: 0px; /* 이미지와 아래 텍스트 간격 */
  }

  .details-info {
    width: 100%;
    text-align: left;
  }
}

/* 닫기 버튼 스타일 */
.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #333;
  font-weight: bold;
}

/* 사진 전체화면 */
#fullscreenImage {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

#fullscreenImage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
}
