/*!
 * DATAPOS Site Search Styles
 * 위치: /css/site-search.css
 */

/* 검색 버튼 (헤더에 들어갈) */
.ds-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f3f5fa;
  border: 1px solid #e0e4ec;
  border-radius: 22px;
  color: #4a5568;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  vertical-align: middle;
}
.ds-search-trigger:hover {
  background: #fff;
  border-color: #c5d0e0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.ds-search-trigger svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.ds-search-trigger .ds-shortcut {
  margin-left: 6px;
  padding: 2px 6px;
  background: #fff;
  border: 1px solid #d5dae3;
  border-radius: 4px;
  font-size: 11px;
  color: #888;
}
@media (max-width: 768px) {
  .ds-search-trigger { padding: 8px 10px; }
  .ds-search-trigger .ds-search-text { display: none; }
  .ds-search-trigger .ds-shortcut { display: none; }
}

/* 검색 오버레이 */
#ds-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 16px 16px;
  overflow-y: auto;
}

/* 검색 박스 */
.ds-search-box {
  width: 100%;
  max-width: 680px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
}

.ds-search-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #ecf0f6;
  background: #fafbfc;
  flex-shrink: 0;
}
#ds-search-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 17px;
  padding: 8px 4px;
  color: #1a2332;
  font-family: inherit;
}
#ds-search-input::placeholder {
  color: #9aa4b8;
  font-size: 15px;
}
#ds-search-close {
  width: 34px;
  height: 34px;
  border: 0;
  background: #ecf0f6;
  border-radius: 50%;
  color: #5a6577;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  margin-left: 10px;
}
#ds-search-close:hover {
  background: #d5dae3;
}

/* 검색 결과 영역 */
#ds-search-results {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* 추천 검색어 */
.ds-search-suggest {
  padding: 24px 20px;
}
.ds-suggest-title {
  margin: 0 0 14px 0;
  font-size: 13px;
  font-weight: 600;
  color: #5a6577;
}
.ds-suggest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ds-tag {
  padding: 8px 14px;
  background: #f3f5fa;
  border: 1px solid #e0e4ec;
  border-radius: 18px;
  font-size: 13px;
  color: #1a2332;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.ds-tag:hover {
  background: #0057ff;
  border-color: #0057ff;
  color: #fff;
}

/* 검색 결과 리스트 */
.ds-result-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}
.ds-result-item {
  border-bottom: 1px solid #f5f7fb;
}
.ds-result-item:last-child {
  border-bottom: 0;
}
.ds-result-item a {
  display: block;
  padding: 14px 20px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.ds-result-item a:hover {
  background: #f8fafc;
}
.ds-result-cat {
  font-size: 12px;
  color: #5a6577;
  margin-bottom: 4px;
  font-weight: 500;
}
.ds-result-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a2332;
  margin-bottom: 4px;
  line-height: 1.4;
}
.ds-result-desc {
  font-size: 13px;
  color: #6a7484;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ds-result-item mark {
  background: #fef3c7;
  color: #92400e;
  padding: 1px 2px;
  border-radius: 2px;
  font-weight: 700;
}

/* 결과 없음 */
.ds-no-results {
  padding: 40px 20px;
  text-align: center;
  color: #6a7484;
}
.ds-no-results p {
  margin: 0 0 8px 0;
  font-size: 14px;
}
.ds-no-results .ds-tip {
  font-size: 13px;
  color: #9aa4b8;
}

/* 모바일 */
@media (max-width: 768px) {
  #ds-search-overlay {
    padding: 0;
    align-items: stretch;
  }
  .ds-search-box {
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  #ds-search-input {
    font-size: 16px;
  }
  .ds-search-suggest {
    padding: 18px 16px;
  }
  .ds-result-item a {
    padding: 12px 16px;
  }
}

/* 데스크탑용 검색 버튼은 모바일에서 숨김 (ds-search-mobile만 보이게) */

/* === 모바일 검색 아이콘 (햄버거 좌측) === */
.ds-search-mobile {
  display: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  color: #fff;
  align-items: center;
  justify-content: center;
}
.ds-search-mobile svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 1024px) {
  /* 데스크탑용 검색 버튼은 모바일에서 완전히 숨김 */
  .ds-search-trigger {
    display: none !important;
  }
  
  /* 모바일 검색 아이콘 - 햄버거 좌측에 절대 위치 */
  .ds-search-mobile {
    display: inline-flex !important;
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    z-index: 2;
    transition: color .3s, opacity .2s;
  }
  
  /* GNB 흰색(스크롤 후) - 진한 색 */
  #gnb.solid .ds-search-mobile {
    color: #0a1628;
  }
  
  /* 다크 GNB - 흰색 + 그림자 */
  #gnb:not(.solid) .ds-search-mobile {
    color: #fff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
  }
  
  /* 호버/터치 */
  .ds-search-mobile:hover,
  .ds-search-mobile:active {
    opacity: 0.7;
  }
}
