/* ===================== 以图搜图 ===================== */

/* --- 搜索栏 flex 布局修复 --- */
.search-bar form .search-group {
    display: flex !important;
    align-items: center;
}
.search-bar form .search-group #search-input {
    flex: 1;
    width: auto !important;
    min-width: 0;
}
.search-bar form .search-group #ai-topsearch {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    flex-shrink: 0;
}

/* --- 桌面端相机按钮 --- */
.image-search-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 100%;
    cursor: pointer;
    color: #999;
    font-size: 20px;
    transition: color 0.2s;
    position: relative;
    flex-shrink: 0;
}
.image-search-trigger:hover {
    color: var(--color-main, #3296fa);
}

/* --- 隐藏 file input（不可用 display:none，否则浏览器拒绝弹出文件选择） --- */
.image-search-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

/* --- 手机端相机按钮 --- */
.image-search-trigger-mobile {
    position: relative;
}
.image-search-trigger-mobile .am-btn {
    font-size: 16px;
    padding: 0 10px;
}
.image-search-trigger-mobile .icon-camera {
    font-size: 16px;
}

/* --- 浮层遮罩 --- */
.image-search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 浮层卡片 --- */
.image-search-dialog {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    width: 400px;
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
}
.image-search-dialog h4 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 600;
}

/* --- 图片预览 --- */
.image-search-preview {
    text-align: center;
    margin-bottom: 16px;
}
.image-search-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid #eee;
}

/* --- 控制区域 --- */
.image-search-controls {
    margin-bottom: 16px;
}
.image-search-controls label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}
.image-search-controls input[type="range"] {
    width: 100%;
    margin-bottom: 12px;
}
.image-search-controls input[type="number"] {
    width: 80px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.image-search-controls .threshold-val {
    font-size: 13px;
    color: #333;
    min-width: 36px;
    display: inline-block;
}

/* --- 搜索按钮 --- */
.image-search-action {
    text-align: center;
}
.image-search-action .image-search-btn {
    display: inline-block;
    padding: 8px 32px;
    background: var(--color-main, #3296fa);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.image-search-action .image-search-btn:hover {
    opacity: 0.85;
}
.image-search-action .image-search-btn:disabled {
    background: #999;
    cursor: not-allowed;
}
.image-search-action .image-search-cancel {
    display: inline-block;
    padding: 8px 24px;
    margin-left: 12px;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

/* --- 状态提示 --- */
.image-search-status {
    text-align: center;
    font-size: 13px;
    color: #999;
    margin-top: 12px;
}
.image-search-status.error {
    color: #e74c3c;
}
.image-search-status.success {
    color: #27ae60;
}

/* --- loading --- */
.image-search-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: image-search-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes image-search-spin {
    to { transform: rotate(360deg); }
}

/* --- 搜索结果页提示条 --- */
.image-search-tips {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    font-size: 14px;
    color: #795548;
}
.image-search-tips .icon-camera {
    font-size: 18px;
    color: #ff9800;
}
.image-search-tips a {
    margin-left: auto;
    color: var(--color-main, #3296fa);
    text-decoration: underline;
}
