/**
 * 製品検索サジェスト機能のスタイル
 */

/* ==========================================================================
   サジェストボックス
   ========================================================================== */

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  margin-top: 8px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.search-suggestions.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* スクロールバースタイル */
.search-suggestions::-webkit-scrollbar {
  width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 3px;
}

.search-suggestions::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 3px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
  background: #a0a0a0;
}

/* ==========================================================================
   サジェストアイテム
   ========================================================================== */

.suggestion-item {
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.15s ease;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.is-selected {
  background: #f8f9fa;
}

.suggestion-item.is-selected {
  background: #e8f4fc;
}

/* メイン行（型番 + カテゴリ） */
.suggestion-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.suggestion-id {
  font-size: 1.05rem;
  font-weight: 600;
  color: #003c71;
}

.suggestion-id mark {
  background: #fff3cd;
  color: #003c71;
  padding: 0 2px;
  border-radius: 2px;
}

.suggestion-category {
  font-size: 0.75rem;
  color: #ffffff;
  background: #003c71;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* 詳細行（一致キーワード + 寸法） */
.suggestion-detail {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.suggestion-match {
  font-size: 0.8rem;
  color: #e63312;
  font-weight: 500;
}

.suggestion-dim {
  font-size: 0.8rem;
  color: #666666;
}

/* 該当なしメッセージ */
.suggestion-empty {
  padding: 20px;
  text-align: center;
  color: #999999;
  font-size: 0.9rem;
}

/* ==========================================================================
   製品ハイライト効果
   ========================================================================== */

.product-highlight,
.product-item.product-highlight,
.kako-product-card.product-highlight {
  animation: highlightPulse 3s ease-out;
}

@keyframes highlightPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 60, 113, 0.4);
    transform: scale(1);
  }
  10% {
    box-shadow: 0 0 0 15px rgba(0, 60, 113, 0.2);
    transform: scale(1.02);
  }
  20% {
    box-shadow: 0 0 0 20px rgba(0, 60, 113, 0);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 60, 113, 0);
  }
}

/* 製品アイテムの遷移ターゲット用の余白調整 */
.product-item[id],
.kako-product-card[id] {
  scroll-margin-top: 100px;
}

/* ==========================================================================
   レスポンシブ
   ========================================================================== */

@media screen and (max-width: 640px) {
  .search-suggestions {
    max-height: 300px;
    border-radius: 10px;
  }
  
  .suggestion-item {
    padding: 12px 15px;
  }
  
  .suggestion-id {
    font-size: 0.95rem;
  }
  
  .suggestion-category {
    font-size: 0.7rem;
    padding: 2px 8px;
  }
  
  .suggestion-detail {
    flex-direction: column;
    gap: 4px;
  }
}

/* ==========================================================================
   入力ヘルプテキスト
   ========================================================================== */

.search-help-text {
  text-align: center;
  margin-top: 12px;
  font-size: 0.8rem;
  color: #888888;
}

.search-help-text span {
  display: inline-block;
  margin: 0 5px;
  padding: 2px 8px;
  background: #f0f0f0;
  border-radius: 4px;
  font-family: monospace;
}
