/* === 공통 스타일 === */
header {
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
  padding: 20px 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 84px;
  flex-wrap: wrap;
}

.logo {
  width: 186px;
  height: 40px;
}
/* 왼쪽 로고 */
.header-left {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
/* 가운데 검색: flex:1 로 가로공간 확보 */
.header-center {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-right: 40px; /* 로그인/장바구니와 간격 확보 */
}
/* 로그인, 마이페이지, 장바구니 */
.header-right {
  display: flex;
  gap: 25px;
  align-items: flex-end;
}

.header-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

.header-item img {
  width: 24px;
  height: 23px;
  margin-bottom: 5px;
}

.header-item.cart {
  position: relative;
}

.header-item.cart .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: red;
  color: white;
  font-size: 12px;
  padding: 2px 2px;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* 검색 영역 공통 */
.search-wrapper {
  width: 400px;
  max-width: 400px; /* 검색창 최대폭. 더 길게 하고 싶으면 늘리세요 */
  flex-shrink: 0;
}
.search-form {
  position: relative;
  width: 100%;
}
.search-box {
  width: 360px;
  height: 36px;
  padding: 8px 36px 8px 10px; /* 오른쪽 패딩은 버튼 자리 */
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
}
.search-box:focus {
  outline: none;
  border-color: #999;
}
.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.search-icon {
  width: 18px;
  height: 18px;
}

/* 모바일 검색바는 아래 줄 전체 차지 */
.mobile-search-wrapper {
  width: 100%;
  padding: 0px 12px 2px 12px; /* 상단 여백 살짝 */
  background: #fff;
  box-sizing: border-box;
}
/* 폼 레이아웃: 가로 한 줄 */
.mobile-search-wrapper .search-form {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
}
/* 입력창 */
.search-box-mobile {
  flex: 1;
  height: 36px;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 0 40px 0 12px; /* 오른쪽은 버튼 자리 확보 */
  font-size: 14px;
  line-height: 1.4;
  background-color: #fafafa;
  color: #333;
  box-sizing: border-box;
}
.search-box-mobile:focus {
  border-color: #999;
  background-color: #fff;
  outline: none;
}
/* 검색 버튼 (입력창 안 우측에 겹침) */
.search-btn-mobile {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-icon-mobile {
  width: 20px;
  height: 20px;
  object-fit: contain;
  opacity: 0.7;
}
.search-btn-mobile:hover .search-icon-mobile {
  opacity: 1;
}



/* 모달 기본 구조 */
.search-modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 1000;
}
.search-modal.hidden {
  display: none;
}
.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

/* 컨텐츠 박스 */
.search-modal-content {
  position: relative;
  background: #fff;
  width: 90%;
  max-width: 600px;
  margin-top: 100px;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  overflow: hidden;
  animation: fadeInUp 0.25s ease-out;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 헤더 */
.search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}
.search-modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.search-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #888;
}

/* 결과 영역 */
.search-results {
  max-height: 400px;
  overflow-y: auto;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f3f3;
  cursor: pointer;
  transition: background 0.15s;
}
.search-item:hover {
  background: #fafafa;
}
.search-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}
.search-info {
  flex: 1;
}
.search-info .pname {
  font-size: 14px;
  color: #222;
  margin-bottom: 4px;
}
.search-info .price {
  font-size: 13px;
  color: #e60023;
  font-weight: bold;
}

/* 상태 메시지 */
.search-placeholder,
.search-empty,
.search-loading,
.search-error {
  padding: 20px;
  text-align: center;
  color: #666;
}

@media (max-width: 768px) {
  .header-inner {
    display: block; /* 검색창 아래로 */
  }

  .header-mobile {
    display: flex;
    justify-content: space-between;  /* 로고 왼쪽 / actions 오른쪽 */
    align-items: center;
    padding: 10px 0;
  }

  .logo-wrapper {
    flex-shrink: 0;
  }

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

  .header-item {
    flex-direction: column; /* 아이콘 위, 텍스트 아래 */
    font-size: 12px;
  }
  
}