/**
 * Anke検索履歴プルダウン
 * Google風デザイン
 */

/* プルダウン本体 */
.search-history-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ヘッダー */
.search-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e8eaed;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.search-history-header span {
    font-size: 0.875rem;
    color: #5f6368;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-history-header span i {
    font-size: 0.875rem;
    color: #5f6368;
}

/* 全削除ボタン */
.clear-all-history {
    background: none;
    border: none;
    color: #1a73e8;
    cursor: pointer;
    font-size: 0.813rem;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: 500;
}

.clear-all-history:hover {
    background-color: rgba(26, 115, 232, 0.08);
}

.clear-all-history:active {
    background-color: rgba(26, 115, 232, 0.16);
}

/* 履歴リスト */
.search-history-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

/* 履歴アイテム */
.search-history-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s;
    gap: 12px;
    position: relative;
}

.search-history-item:hover {
    background-color: #f1f3f4;
}

.search-history-item:active {
    background-color: #e8eaed;
}

/* 検索アイコン */
.search-history-item > i.fa-search {
    color: #5f6368;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* キーワードテキスト */
.search-history-item .keyword {
    flex: 1;
    color: #202124;
    font-size: 0.938rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 削除ボタン */
.search-history-item .delete-history {
    background: none;
    border: none;
    color: #5f6368;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0;
    flex-shrink: 0;
}

.search-history-item:hover .delete-history {
    opacity: 1;
}

.search-history-item .delete-history:hover {
    background-color: rgba(60, 64, 67, 0.08);
    color: #202124;
}

.search-history-item .delete-history:active {
    background-color: rgba(60, 64, 67, 0.16);
}

.search-history-item .delete-history i {
    font-size: 0.875rem;
}

/* 空の状態 */
.search-history-empty {
    padding: 20px 16px;
    text-align: center;
    color: #5f6368;
    font-size: 0.875rem;
}

/* スクロールバーのスタイル（Webkit） */
.search-history-dropdown::-webkit-scrollbar {
    width: 8px;
}

.search-history-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.search-history-dropdown::-webkit-scrollbar-thumb {
    background-color: #dadce0;
    border-radius: 4px;
}

.search-history-dropdown::-webkit-scrollbar-thumb:hover {
    background-color: #bdc1c6;
}

/* レスポンシブ対応 */
@media screen and (max-width: 768px) {
    .search-history-dropdown {
        max-height: 300px;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 2px 4px rgba(32, 33, 36, 0.28);
    }
    
    .search-history-item {
        padding: 12px 16px;
    }
    
    .search-history-item .keyword {
        font-size: 0.875rem;
    }
    
    /* モバイルでは削除ボタンを常に表示 */
    .search-history-item .delete-history {
        opacity: 0.6;
    }
    
    .search-history-item:hover .delete-history,
    .search-history-item .delete-history:active {
        opacity: 1;
    }
}

/* ダークモード対応（将来の拡張用） */
@media (prefers-color-scheme: dark) {
    .search-history-dropdown {
        background: #292a2d;
        border-color: #5f6368;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    }
    
    .search-history-header {
        background-color: #35363a;
        border-bottom-color: #5f6368;
    }
    
    .search-history-header span,
    .search-history-header span i {
        color: #e8eaed;
    }
    
    .search-history-item:hover {
        background-color: #35363a;
    }
    
    .search-history-item .keyword {
        color: #e8eaed;
    }
    
    .search-history-item > i.fa-search,
    .search-history-item .delete-history {
        color: #9aa0a6;
    }
    
    .search-history-empty {
        color: #9aa0a6;
    }
}
