/* 検索ポップアップ用スタイル */

.search-popup {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-width: 300px;
    max-width: 800px;
    width: calc(100vw - 40px);
    left: 20px;
    right: 20px;
    display: none;
}

.search-popup-content {
    padding: 10px;
}

.search-popup-header {
    font-weight: bold;
    color: #666;
    font-size: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    padding-right: 30px;
}

.search-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-popup-close:hover {
    color: #333;
}

.search-popup-items {
    max-height: 400px;
    overflow-y: auto;
    padding-bottom: 50px; /* もっと見るリンクのスペースを確保 */
}

.search-popup-item {
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 3px;
    margin-bottom: 2px;
    font-size: 14px;
}

.search-popup-item:hover {
    background-color: #f5f5f5;
}

/* 商品グリッド */
.product-grid {
    display: grid;
    gap: 6px;
    padding: 8px;
    max-height: 320px; /* もっと見るリンクのスペースを確保 */
    overflow-y: auto;
}

/* 商品アイテム */
.product-item {
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff;
}

/* 商品画像 */
.product-item img {
    object-fit: cover;
    border-radius: 4px;
}

/* 商品名 */
.product-item .product-name {
    font-size: 12px;
    margin-top: 5px;
    font-weight: bold;
    color: #333;
    word-break: break-word;
}

/* 商品カテゴリ */
.product-item .product-category {
    font-size: 10px;
    margin-top: 2px;
    color: #666;
}

/* 商品価格 */
.product-item .product-price {
    font-size: 11px;
    margin-top: 3px;
    color: #e74c3c;
    font-weight: bold;
}

/* 規格情報 */
.product-item .class-info {
    font-size: 9px;
    margin-top: 2px;
    color: #666;
}

/* 商品コード */
.product-item .product-code {
    font-size: 9px;
    margin-top: 2px;
    color: #999;
    font-family: monospace;
}

/* もっと見るリンク */
.more-link {
    display: block;
    text-align: center;
    padding: 10px;
    color: #007bff;
    text-decoration: none;
    border-top: 1px solid #eee;
    margin-top: 8px;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    z-index: 1;
}

/* 検索結果なしメッセージ */
.no-results-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

.no-results-message .message-text {
    margin-bottom: 10px;
}

.no-results-message .suggestion-text {
    font-size: 12px;
    color: #999;
}

/* 入力案内メッセージ */
.input-guide-message {
    text-align: center;
    padding: 30px 20px;
    color: #666;
    font-size: 14px;
}

.input-guide-message .message-text {
    margin-bottom: 8px;
}

.input-guide-message .suggestion-text {
    font-size: 12px;
    color: #999;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .search-popup {
        min-width: 300px;
        width: calc(100vw - 40px);
        left: 20px;
        right: 20px;
    }
}

/* レスポンシブグリッド */
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-item img {
        width: 50px;
        height: 50px;
    }
}

@media (min-width: 481px) and (max-width: 767px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-item img {
        width: 60px;
        height: 60px;
    }
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .product-item img {
        width: 70px;
        height: 70px;
    }
}
