/* 搜索功能样式 - 微信风格设计 */

/* 搜索模态框 */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-modal.show {
    display: flex;
    opacity: 1;
}

.search-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.search-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 100%;
    max-height: 80vh;
    margin: auto;
    background: #ffffff;
    border-radius: 12px 12px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
    to {
        transform: translateY(0);
    }
}

/* 搜索头部 */
.search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e7e7e7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-input-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px;
    border: 1px solid #e7e7e7;
    border-radius: 20px;
    background: #f7f7f7;
    font-size: 16px;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    background: #ffffff;
    border-color: #07c160;
    box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #999999;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.search-clear-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.search-close-btn {
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.search-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* 搜索过滤器 */
.search-filters {
    padding: 16px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #e7e7e7;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    max-height: 60px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.search-filters.expanded {
    max-height: 200px;
}

.search-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-filter-group label {
    font-size: 14px;
    color: #666666;
    white-space: nowrap;
}

.search-filter-group select {
    padding: 6px 12px;
    border: 1px solid #e7e7e7;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.search-filter-group select:focus {
    border-color: #07c160;
}

.search-filter-toggle {
    margin-left: auto;
    background: #07c160;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-filter-toggle:hover {
    background: #06ad56;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.search-filters.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* 搜索建议 */
.search-suggestions {
    background: #ffffff;
    border-bottom: 1px solid #e7e7e7;
    max-height: 200px;
    overflow-y: auto;
}

.suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #e7e7e7;
    font-size: 14px;
    color: #666666;
}

.clear-history-btn {
    background: none;
    border: none;
    color: #07c160;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.clear-history-btn:hover {
    background: rgba(7, 193, 96, 0.1);
}

.suggestions-list {
    padding: 8px 0;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background: #f5f5f5;
}

.suggestion-icon {
    font-size: 16px;
    color: #999999;
}

.suggestion-text {
    flex: 1;
    font-size: 15px;
    color: #333333;
}

.no-suggestions {
    padding: 24px 20px;
    text-align: center;
}

.no-suggestions-text {
    color: #999999;
    font-size: 14px;
}

/* 搜索结果 */
.search-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-status {
    padding: 40px 20px;
    text-align: center;
}

/* 欢迎界面 */
.search-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.search-welcome-icon {
    font-size: 48px;
    opacity: 0.6;
}

.search-welcome-text {
    font-size: 18px;
    color: #333333;
    margin-bottom: 8px;
}

.search-welcome-tips {
    color: #666666;
    font-size: 14px;
    line-height: 1.6;
}

.search-welcome-tips div {
    margin-bottom: 4px;
}

/* 搜索加载状态 */
.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e7e7e7;
    border-top: 3px solid #07c160;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 16px;
    color: #666666;
}

/* 搜索错误状态 */
.search-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.error-icon {
    font-size: 48px;
}

.error-text {
    font-size: 16px;
    color: #ff4757;
    text-align: center;
}

.retry-btn {
    background: #07c160;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.retry-btn:hover {
    background: #06ad56;
}

/* 搜索结果列表 */
.search-results-list {
    flex: 1;
    overflow-y: auto;
}

.search-results-stats {
    padding: 16px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #e7e7e7;
    font-size: 14px;
    color: #666666;
    text-align: center;
}

/* 搜索结果项 */
.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background: #f8f8f8;
}

.result-icon {
    font-size: 20px;
    margin-top: 2px;
    flex-shrink: 0;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-type-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-type-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.result-type-tag.file {
    background: #e3f2fd;
    color: #1976d2;
}

.result-type-tag.ai-response {
    background: #e8f5e8;
    color: #07c160;
}

.result-type-tag.ai-thinking {
    background: #f5f5f5;
    color: #666666;
}

.file-size {
    font-size: 12px;
    color: #999999;
}

.result-time {
    font-size: 12px;
    color: #999999;
}

.result-text {
    font-size: 15px;
    color: #333333;
    line-height: 1.4;
    margin-bottom: 4px;
    word-break: break-word;
}

.result-filename {
    font-size: 13px;
    color: #666666;
    font-style: italic;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.result-locate-btn {
    background: none;
    border: 1px solid #e7e7e7;
    color: #666666;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-locate-btn:hover {
    background: #07c160;
    border-color: #07c160;
    color: white;
}

/* 搜索高亮 */
.search-highlight {
    background: #ffeb3b;
    color: #333333;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* 无结果状态 */
.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
}

.no-results-icon {
    font-size: 48px;
    opacity: 0.6;
}

.no-results-text {
    font-size: 18px;
    color: #333333;
}

.no-results-tips {
    font-size: 14px;
    color: #666666;
    text-align: center;
}

/* 加载更多 */
.search-load-more {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e7e7e7;
}

.load-more-btn {
    background: #07c160;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.load-more-btn:hover {
    background: #06ad56;
}

/* 消息高亮动画 */
.message-highlight {
    background: #fff3cd !important;
    border: 2px solid #ffc107 !important;
    animation: highlightPulse 2s ease-in-out;
}

@keyframes highlightPulse {
    0%, 100% { 
        box-shadow: 0 0 0 rgba(255, 193, 7, 0.4); 
    }
    50% { 
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.6); 
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .search-modal-content {
        max-height: 100vh;
        border-radius: 0;
        height: 100%;
    }

    .search-header {
        padding: 12px 16px;
    }

    .search-filters {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-filter-group {
        justify-content: space-between;
    }

    .search-filter-toggle {
        margin-left: 0;
        align-self: center;
    }

    .search-result-item {
        padding: 12px 16px;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .result-time {
        align-self: flex-end;
    }

    .suggestions-header,
    .search-results-stats {
        padding: 12px 16px;
    }
}

/* iOS适配 */
@media (max-width: 480px) {
    .search-input {
        font-size: 16px; /* 防止iOS缩放 */
    }

    .search-modal-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .search-modal-content {
        background: #1e1e1e;
        color: #ffffff;
    }

    .search-header {
        background: #1e1e1e;
        border-bottom-color: #333333;
    }

    .search-input {
        background: #2a2a2a;
        border-color: #333333;
        color: #ffffff;
    }

    .search-input:focus {
        background: #2a2a2a;
        border-color: #07c160;
    }

    .search-filters {
        background: #2a2a2a;
        border-bottom-color: #333333;
    }

    .search-filter-group select {
        background: #1e1e1e;
        border-color: #333333;
        color: #ffffff;
    }

    .suggestions-header {
        background: #2a2a2a;
        border-bottom-color: #333333;
        color: #cccccc;
    }

    .suggestion-item:hover {
        background: #333333;
    }

    .suggestion-text {
        color: #ffffff;
    }

    .search-result-item:hover {
        background: #2a2a2a;
    }

    .result-text {
        color: #ffffff;
    }

    .search-results-stats {
        background: #2a2a2a;
        border-bottom-color: #333333;
        color: #cccccc;
    }
} 