/**
 * 图片搜索样式
 */

.image-search-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #3498db;
    color: white;
    padding: 15px 25px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52,152,219,0.3);
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.image-search-float-btn:hover {
    background: #2980b9;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52,152,219,0.4);
}

.image-search-float-btn .btn-icon { font-size: 24px; }
.image-search-float-btn .btn-text { font-size: 16px; font-weight: 600; }

.image-search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 999999;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.image-search-modal .modal-content {
    max-width: 1000px;
    margin: 40px auto;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

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

.image-search-modal .modal-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 20px 30px;
    position: relative;
}

.image-search-modal .modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.image-search-modal .close-btn {
    position: absolute;
    top: 18px;
    right: 30px;
    font-size: 30px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    line-height: 1;
}

.image-search-modal .close-btn:hover { opacity: 1; }

.image-search-modal .modal-body {
    padding: 30px;
    min-height: 400px;
}

.upload-area {
    text-align: center;
    padding: 60px 40px;
    border: 3px dashed #bdc3c7;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.upload-area.drag-over {
    border-color: #3498db;
    background: #e8f4fc;
}

.upload-icon svg { margin-bottom: 20px; }
.upload-text { font-size: 20px; color: #2c3e50; margin-bottom: 10px; font-weight: 500; }
.upload-hint { color: #7f8c8d; font-size: 14px; margin-bottom: 25px; }

.select-file-btn {
    padding: 12px 30px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.select-file-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(52,152,219,0.3);
}

.preview-area {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
}

#previewImage {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: #c0392b;
    transform: scale(1.1) rotate(90deg);
}

.search-btn-wrap { text-align: center; margin-top: 25px; }

.search-btn {
    padding: 15px 50px;
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(46,204,113,0.3);
}

.search-btn:hover:not(:disabled) {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46,204,113,0.4);
}

.search-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.analyzing-step { text-align: center; padding: 60px 20px; }
.analyzing-animation { display: flex; align-items: center; justify-content: center; gap: 20px; }

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-text { text-align: left; }
.spinner-text p { margin: 0; font-size: 18px; color: #2c3e50; }
.spinner-text .small { font-size: 14px; color: #7f8c8d; margin-top: 5px; }

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

.loading-step { text-align: center; padding: 60px 20px; }

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-step p { font-size: 18px; color: #7f8c8d; }

.results-step { display: none; }

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #3498db;
}

.results-header h4 { margin: 0; font-size: 18px; color: #2c3e50; font-weight: 600; }
.result-meta { display: flex; gap: 15px; }

.result-count {
    background: #3498db;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.process-time {
    background: #95a5a6;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    max-height: 500px;
    overflow-y: auto;
    padding: 5px;
}

.result-card {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e6ed;
    transition: all 0.3s;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-color: #3498db;
}

.card-image {
    height: 180px;
    overflow: hidden;
    background: white;
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.result-card:hover .card-image img { transform: scale(1.05); }

.card-info { padding: 15px; }

.card-info h4 {
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.4;
    color: #2c3e50;
    font-weight: 600;
    height: 42px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.subtitle {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-code {
    font-size: 12px;
    color: #95a5a6;
    margin-bottom: 8px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.price {
    font-size: 18px;
    font-weight: 700;
    color: #e74c3c;
}

.similarity {
    padding: 4px 12px;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.view-btn {
    display: block;
    text-align: center;
    padding: 8px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.view-btn:hover {
    background: #2980b9;
    color: white;
}

.results-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e6ed;
}

.new-search-btn {
    padding: 10px 30px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.new-search-btn:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    grid-column: 1 / -1;
}

.match-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.match-badge.identical {
    background: #2ecc71;
    animation: pulse 1.5s infinite;
}

.match-badge.similar { background: #3498db; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(46,204,113,0.7); }
    70% { box-shadow: 0 0 0 10px rgba(46,204,113,0); }
    100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}

@media (max-width: 768px) {
    .image-search-float-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 20px;
    }
    .image-search-float-btn .btn-text { display: none; }
    .image-search-float-btn .btn-icon { font-size: 28px; }
    .results-grid { grid-template-columns: 1fr; }
}