/**
 * BruceClay AI検索 - フロントエンドスタイル
 * 改修内容: ダークモード時の背景色問題のみ修正（他のスタイルは元のまま維持）
 */

/* 検索ボックスコンテナ */
.crossSearch-type.ai .search__box--row-wrap {
    width: 100%;
}

.bcai-search-form {
    display: flex;
}

.bcai-search-container {
    background: #ffffff;
}

.bcai-search-input-wrapper {
    flex: 1;
    position: relative;
    padding-right: 10px;
    width: 85%;
}

.bcai-search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1.6rem !important;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.bcai-search-button {
    border: 1px solid #009432;
    background-color: #009432 !important;
    line-height: 26px;
    color: #fff;
    cursor: pointer;
    width: 15%;
}

.bcai-search-button:hover:not(:disabled) {
    box-shadow: 2px 2px 1px 1px rgba(0, 0, 0, .2) inset;
    outline: 0;
}

.bcai-search-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ローディングインジケーター */
.bcai-search-loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.bcai-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: bcai-spin 1s linear infinite;
}

@keyframes bcai-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.bcai-loading-text {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

/* 検索結果コンテナ */
.bcai-search-results {
    animation: bcai-fade-in 0.5s ease;
}

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

/* 検索の解釈 */
.bcai-interpretation {
    padding: 15px;
    background: #f0f8ff;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    margin-bottom: 20px;
}

.bcai-interpretation p {
    margin: 0;
    color: #333;
}

/* 結果数表示 */
.bcai-result-count {
    padding: 10px 0;
    color: #666;
    font-size: 14px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

/* 検索結果リスト */
.bcai-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 個別の検索結果 */
.bcai-result-item {
    padding: 20px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.bcai-result-item:hover {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 結果タイトル */
.bcai-result-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.bcai-result-title a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

.bcai-result-title a:hover {
    color: #005a87;
    text-decoration: underline;
}

/* URL表示 */
.bcai-result-url {
    color: #006621;
    font-size: 13px;
    margin-bottom: 10px;
    word-break: break-all;
}

/* 抜粋 */
.bcai-result-excerpt {
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

/* メタ情報 */
.bcai-result-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
}

/* 関連性スコア */
.bcai-relevance-score {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.bcai-score-bar {
    display: inline-block;
    width: 60px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.bcai-score-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #ffa500 0%, #28a745 100%);
    transition: width 0.5s ease;
    max-width: 100%; /* 100%を超えないように制限 */
}

/* 理由表示 */
.bcai-result-reason {
    color: #666;
    font-style: italic;
    flex: 1;
}

/* 結果なしメッセージ */
.bcai-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.bcai-no-results p {
    margin: 10px 0;
}

.bcai-no-results p:first-child {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* メッセージ表示 */
.bcai-message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    animation: bcai-fade-in 0.3s ease;
}

.bcai-message-error {
    background: #fee;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.bcai-message-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.bcai-message-info {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

/* サジェスチョン（オートコンプリート） */
.bcai-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.bcai-suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

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

.bcai-suggestion-item:hover {
    background: #f0f8ff;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .bcai-search-input-wrapper {
        padding-right: 0;
        padding-bottom: 10px;
        width: 100%;
    }
    .bcai-search-form {
        flex-direction: column;
    }
    
    .bcai-search-button {
        width: 100%;
        padding: 5px 10px;
    }
    
    .bcai-result-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .bcai-score-bar {
        width: 100px;
    }
}

/* ダークモード対応 - 【修正】白背景を強制して黒背景問題を解決 */
@media (prefers-color-scheme: dark) {
    .bcai-search-container {
        background: #ffffff;
        color: #333;
        width: 100%;
    }
    
    .bcai-search-input {
        background: #ffffff;
        border-color: #e0e0e0;
        color: #333;
    }
    
    .bcai-search-input:focus {
        border-color: #0073aa;
    }
    
    .bcai-result-item {
        background: #fafafa;
        border-color: #e0e0e0;
    }
    
    .bcai-result-item:hover {
        background: #ffffff;
    }
    
    .bcai-result-excerpt,
    .bcai-interpretation p {
        color: #333;
    }
    
    .bcai-result-title a {
        color: #0073aa;
    }
    
    .bcai-result-url {
        color: #006621;
    }
    
    .bcai-results-list {
        background: transparent;
    }
    
    .bcai-search-results {
        background: transparent;
    }
    
    .bcai-no-results {
        background: transparent;
        color: #666;
    }
    
    .bcai-no-results p:first-child {
        color: #333;
    }
}

/* アニメーション無効化（アクセシビリティ） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}