/* 기본 스타일  max-width: 1095.5px;
body { display: flex; font-family: 'Noto Sans KR', sans-serif, '굴림'; line-height: 1.6; margin: 0; padding: 20px; background-color: #000; justify-content: center; }
*/
html {  overflow-y: scroll; } 
* { box-sizing: border-box; margin: 0; padding: 0; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: rgba(182, 182, 182, 0.3);  border-radius: 4px; }

body {
    display: flex;
    flex-direction: column;  /* 자식 요소를 세로로 쌓음 */
    align-items: center;    /* 자식 요소를 가로축(cross-axis)에서 가운데 정렬 */
    background-color: #000;
    margin: 0;
    padding-top: 10px;
    padding-bottom: 10px;  /* 이것 보다 줄이면 iframe 에서 페이징 이후 스크롤 안됨 */
    width: 100%;          /* 너비를 100%로 명시 */
    overflow-x: hidden;   /* 수평 스크롤 및 패닝 현상 강제 차단 */
}

/* --- AJAX 로딩 효과 --- */
body.loading .maincontainer {
    opacity: 0.5;
    transition: opacity 0.3s ease;
    pointer-events: none; /* 로딩 중 클릭 방지 */
}

/*.topcontainer { max-width: 100%; margin: 0 24px 0 22px;  width: calc(100% - 46px); justify-content: center; background-color: #000000; border-radius: 8px; box-sizing: border-box;  } */
.topcontainer { position: relative; z-index: 1; margin-top: -28px; width: 100%; }

@media (max-width: 768px) { 
    .topcontainer { 
      .results-header { padding: 10px 0 22px 0;  padding-bottom: 6px; padding-left: 0px; }
      .sort-options { padding-right: 0px; }
}
}

/* 2. .results-header (배경/테두리 제거, 좌우 정렬만 담당) */
.results-header {
    display: flex;
    justify-content: space-between; /* 양쪽 끝으로 밀어내기 */
    align-items: center;
    
    
    /* [변경] 좌우 22px 간격만 남김 (기존 요청) */
    padding: 0 22px; 
    padding-left: 27px;
    box-sizing: border-box;
    
    /* [제거] 너비, 배경, 그림자, 테두리 모두 제거 */
    width: auto;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    border-bottom: none;
}

/* 3. 왼쪽 박스 스타일 (.t-results) */
.t-results {
    /* [추가] 검색창 스타일 적용 */
    background-color: #252525;
    border-radius: 25px; /* 둥근 모서리 */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    padding: 8px 15px;   /* 텍스트에 맞게 패딩 조절 */
    color: #ffffff;         /* 어두운 텍스트 */
    font-weight: 400;
    font-size: 0.85em;
}

/* 4. 오른쪽 정렬 옵션 (버튼들을 감쌈) */
.sort-options {
    display: flex;
    gap: 10px; /* 두 개의 정렬 버튼 사이의 간격 */
    align-items: center;
    padding-right: 27px;
}

/* 5. [중요] 링크 사이의 구분선(|) 숨기기 */
.sort-options .separator {
    display: none;
}

/* 6. 오른쪽 개별 버튼 스타일 (a 태그) */
.sort-options a {
    /* [추가] 검색창 스타일 적용 */
    background-color: #252525;
    border-radius: 25px; /* 둥근 모서리 */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    padding: 8px 15px;   /* 텍스트에 맞게 패딩 조절 */
    color: #d4d4d4;         /* 어두운 텍스트 */
    
    font-size: 0.75em;
    font-weight: 800;
    text-decoration: none;
}

/* (선택) 버튼 호버 효과 */
.sort-options a:hover {
    text-decoration: none;
    opacity: 0.8; 
}


.search-container { display: flex; align-items: center; width: 640px;  margin: 0 auto; background-color: #ffffff; border-radius: 50px; padding: 5px 20px; box-shadow: 0 0 15px rgba(255, 255, 255, 0.2); transition: box-shadow 0.3s ease; margin-bottom: 0px; position: relative; /* z-index를 적용하기 위한 기준 */
    z-index: 2;}
.search-container:focus-within { box-shadow: 0 0 20px rgba(255, 255, 255, 0.35); }

/*.maincontainer { max-width: 100%; margin: 20px 24px 0 22px; background-color: #000000; border-radius: 8px; box-sizing: border-box; } */
.maincontainer { max-width: 100%; margin: 10px 24px 0 22px; padding-top: 10px; background-color: #000000; border-radius: 8px; box-sizing: border-box; width: calc(100% - 46px);}

/* For screens up to 768px wide (Tablets and Phones) */
@media (max-width: 768px) { 
    .maincontainer {
    /* 화면 너비 768px 이하일 때 적용할 여백 margin: 0px 13px 0px 15px; */
    margin: 0 13px 0 15px;
    /* ▼▼▼ (13px + 15px = 28px) 이므로 27을 28로 수정 ▼▼▼ */
    width: calc(100% - 28px);
    max-width: none;
  }
}

.bottomcontainer { max-width: 100%; margin: 0 auto; justify-content: center; background-color: #000000; border-radius: 8px; box-sizing: border-box; display: flex;
 }

.results-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 28.01px; padding: 0 3px 0 1px; margin: 0 auto; box-sizing: border-box; }
@media (max-width: 1025px) { .results-grid { grid-template-columns: repeat(3, 1fr); gap: auto; padding: 0; margin: 0 auto; box-sizing: border-box; } }
@media (max-width: 641px) { .results-grid { grid-template-columns: repeat(2, 1fr); gap: auto; padding: 0; margin: 0 auto; box-sizing: border-box; } }

/*.result-item { width: 100%; position: relative; border-radius: 8px; overflow: hidden; transition: transform 0.3s, box-shadow 0.3s; background-color: #1d1d1d; } */

.result-item {
  width: 100%;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  background-color: #1d1d1d;
  aspect-ratio: 1 / 1; 
}

@media screen and (max-width: 767px) { .results-grid { gap: 17px; } }
@media (max-width: 768px) { .result-item { width: auto; /* 220.66px */ } }
@media (max-width: 430px) { .result-item { width: auto; /* 168px */ } }
        
/* 로고 링크 스타일 !important; */
.responsive-logo { width: 25px; margin-top: 7px; }
.responsive-logo:hover { 
  filter: invert(100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

@supports not (aspect-ratio: 1 / 1) {
  
  .result-item {
    height: 0;
    padding-top: 100%; 
  }

  .result-item img {
    position: absolute;
    top: 0;
    left: 0;
  }

}

.logo { font-size: 24px; font-weight: bold; color: #2C3A84; margin-right: 15px; }


.search-input { flex-grow: 1; border: none; outline: none; background-color: transparent; font-family: 'Nanum Gothic', 'Noto Sans KR', '굴림'; font-size: 1.2rem; width: auto; color: #000000; min-width: 0;}
.search-input::placeholder { color: #aaaaaa; }
        
.icon-wrapper { display: flex; align-items: center; gap: 15px; margin-left: 5px; }
.icon-wrapper i { font-size: 24px; color: #5f6368; cursor: pointer; }
.icon-wrapper .spacer { display: none; }
body.ipad-mini2 .icon-wrapper .spacer {
  display: inline-block;
  width: 25px;
}
        
#search-button { color: #42e457; } /*17e02e*/
#search-button:hover { color: #0cc224; }  /*009912*/
#photo-button { color: #97d6ff; } /*929292*/
#photo-button:hover { color: #116fad; } /*414141ff*/

/* F 아이콘 기본 상태 (회색) */
i#fulltext-button { color: #aaa; /* 회색 */ cursor: pointer; transition: color 0.2s ease; }
/* F 아이콘 활성 상태 (검정) */
i#fulltext-button.active { color: #000; /* 검정 */ }
/* F 아이콘 호버 시 (약간 진하게) */
i#fulltext-button:not(.active):hover { color: #555; }


.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 100px;
  background-color: #424242;
  color: #fff;
  text-align: center;
  border-radius: 20px;
  padding: 6px;
  position: absolute;
  z-index: 1;
  bottom: -180%; /* 아이콘 위에 표시 */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-family: 'Nanum Gothic', 'Noto Sans KR', '굴림'; font-size: 0.8rem;
}
.logo-tooltip .tooltip-text { bottom: -100%; /* 로고 툴팁만 더 띄우기 */ }

.tooltip:hover .tooltip-text { visibility: visible; opacity: 1; }

/* 사진 검색 결과 이미지 스타일 - 원본 비율 유지 */
/* .photo-search-item img { width: 100%; height: auto; display: block; object-fit: contain; aspect-ratio: auto !important;}  /* 원본 비율 유지 */ 

.result-item.photo-search-item img {
  width: 100%;
  height: 100%; 
  display: block;
  object-fit: contain; 
}
.title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;   
    width: auto; /* 텍스트 길이에 맞게 자동 조절 */
    max-width: 100%; /* 너무 길 경우를 위한 최대 폭 제한 */
    display: inline-block; /* inline-block으로 텍스트 길이에 맞춤 */
    box-sizing: border-box; /* 패딩 포함한 크기 계산 */
    bottom: 0%;
    background-color: rgba(0, 0, 0, 0.2);
    color: rgb(255, 255, 255);
    padding: 6px 0 6px 10px;
    text-align: center;
    z-index: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}
.title-overlay:hover { background-color: rgba(0, 0, 0, 0.9); }


.ftitle { font-weight: 500; font-size: 0.9rem; }
.famount { font-weight: none; font-size: 0.75rem; }
.fcount { font-weight: none; font-size: 0.75rem; }
.fphoto { font-weight: none; font-size: 0.7rem; margin-bottom: 4px;}

.ptitle-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto; /* 텍스트 길이에 맞게 자동 조절 */
    max-width: 100%; /* 너무 길 경우를 위한 최대 폭 제한 */
    display: inline-block; /* inline-block으로 텍스트 길이에 맞춤 */
    box-sizing: border-box; /* 패딩 포함한 크기 계산 */
    /*bottom: 5%;*/
    background-color: rgba(0, 0, 0, 0.2);
    color: rgb(255, 255, 255);
    padding: 6px 0 6px 10px;
    text-align: center;
    z-index: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.ptitle-overlay:hover { background-color: rgba(0, 0, 0, 0.9); }

.result-item:hover { /*transform: scale(1.05); opacity: 0.85;*/ cursor: pointer; /*box-shadow: 0 4px 12px rgba(0,0,0,0.3);*/ }
/*.result-item img { width: 100%; height: auto; display: block; object-fit: cover; aspect-ratio: 1/1; }*/
.result-item img { width: 100%; height: 100%; display: block; object-fit: cover; } 
.result-item a img:hover { transform: rotate(-3deg) scale3d(1.2, 1.2, 1.2); transition: transform 0.3s ease; /* 부드러운 변환 효과 */ }

.custom-hr { width: 100%; border: none; border-top: 2px solid #303030; margin-bottom: 10px;}


/* --- Mobile and Tablet Adjustments --- */

/* For screens up to 768px wide (Tablets and Phones) */
@media (max-width: 768px) { 
    .maincontainer, .topcontainer {
    /* 화면 너비 768px 이하일 때 적용할 여백 margin: 0px 12px 0px 15px; */
    margin: 0 13px 0 15px;
    width: calc(100% - 27px);
    max-width: none;
  }
  .tooltip:hover .tooltip-text { visibility: hidden; opacity: 0; }
}

/* For screens up to 599px wide (Smartphones) */
@media (max-width: 599px) {
  .search-container {
    padding: 5px 18px;
    width: 92%; /* 스마트폰에서 검색창 너비를 화면에 맞게 조절 */
    max-width: none; /* 기존의 최대 너비 제한 해제 */
  }
  .search-input { font-size: 1rem; }
}

/* 자동완성 목록 기본 스타일 (모바일 기준) */
.ui-autocomplete { overflow-y: auto;  overflow-x: hidden; max-height: 280px;  width: auto !important; min-width: 0;  }
.ui-autocomplete li > div { white-space: nowrap; }

/* PC 화면 (가로 769px 이상)일 때만 최대 높이를 재정의 */
@media screen and (min-width: 769px) { .ui-autocomplete { max-height: 350px; } }

/* 페이지네이션 스타일 */
.pagination { 
    display: flex; 
    justify-content: center; 
    margin-top: 30px; 
    flex-wrap: wrap; 
    gap: 5px; 
    font-family: 'Nanum Gothic', sans-serif;
    font-weight: 800; /* ExtraBold */
    font-size: 0.9rem; /* (수정) 폰트 크기를 약간 줄여 전체적인 균형 맞춤  */
    align-items: center;
    position: relative;
    z-index: 1;
}
@media (min-width: 769px) { .pagination { min-height: 26px; } }
.pagination-link { 
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: 2.1em; /* (수정) 박스 높이 줄임 */
    min-width: 2.1em; /* (수정) 최소 너비 줄임 */
    margin: 0 3px; 
    background-color: rgba(255, 255, 255, 0.6); 
    color: #333; 
    border-radius: 4px; 
    text-decoration: none; 
    transition: background-color 0.3s;
    padding: 0 0.7em; /* (수정) 좌우 여백 약간 줄임 */
}
.pagination-link:hover { 
    background-color: rgba(255, 255, 255, 0.8);
}
.pagination-current { 
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: 2.1em; /* (수정) 박스 높이 줄임 */
    min-width: 2.1em; /* (수정) 최소 너비 줄임 */
    margin: 0 3px; 
    background-color: rgba(255, 255, 255, 1);
    color: #000;
    border-radius: 4px;
    padding: 0 0.7em; /* (수정) 좌우 여백 약간 줄임 */
}
.pagination-dots { 
    display: inline-block; 
    padding: 10px 12px;
    margin: 0 3px; 
    color: #cccccc;
    transition: visibility 0s, opacity 0.2s linear; /* 부드러운 효과(선택 사항) */
}

/* 구형 iPad mini2 전용 */
@media screen and (max-width: 768px) and (orientation: portrait) {
  /* 최신 안드로이드 제외 */
  @supports (-webkit-overflow-scrolling: touch) and (not (-webkit-device-pixel-ratio: 1.5)) {
    .icon-wrapper {
      gap: 0; /* gap 무시 */
    }
    .icon-wrapper .spacer {
      display: inline-block; /* spacer만 보이게 */
      width: 25px;
    }
  }
}

/* 푸터 스타일 */
.bottomcontainer {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.9rem;
  color: #ccc;
  text-align: center;
  padding: 20px 0;
  display: flex;
  justify-content: center;
  /*padding-bottom: 50px; */
  /* background-color: #1d1d1d; */
}


/* --- 자동완성 (신규) --- */
.autocomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
}

.autocomplete-label {
    font-size: 1rem;
    color: #333;
    /* 텍스트가 너무 길어질 경우를 대비 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 자동완성 하이라이트 스타일 */
.autocomplete-label .autocomplete-highlight {
    color: blue;
    font-weight: bold; /* (선택 사항) 강조 */
}

.autocomplete-counts {
    font-size: 0.8rem;
    color: #666;
    margin-left: 12px;
    /* 카운트 숫자가 줄어들지 않도록 고정 */
    flex-shrink: 0; 
}

.search-error-message {
    color: red;
    text-align: center;
    padding: 20px;
}
