/* Image Search Specific Styles */

.image-search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 60vh;
}

/* Header Styles */
.search-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.search-header h1 {
    color: #2c3e50;
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-header p {
    color: #7f8c8d;
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Upload Section */
.upload-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    padding: 50px;
    margin-bottom: 50px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.upload-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2ecc71, #e74c3c, #f39c12);
    border-radius: 20px 20px 0 0;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #3498db;
    border-radius: 15px;
    padding: 80px 30px;
    background: rgba(52, 152, 219, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.upload-area:hover {
    border-color: #2980b9;
    background: rgba(52, 152, 219, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.2);
}

.upload-area.dragover {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    transform: scale(1.02);
    box-shadow: 0 15px 30px rgba(39, 174, 96, 0.3);
}

.upload-icon {
    font-size: 5rem;
    color: #3498db;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.upload-area:hover .upload-icon {
    color: #2980b9;
    transform: scale(1.1);
}

.upload-text {
    font-size: 1.4rem;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.upload-subtext {
    color: #7f8c8d;
    font-size: 1rem;
    margin: 10px 0;
}

/* Browse Button */
.browse-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    padding: 15px 35px;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin: 25px 0 15px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
}

.browse-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.browse-btn:hover::before {
    left: 100%;
}

.browse-btn:hover {
    background: linear-gradient(45deg, #2980b9, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(52, 152, 219, 0.4);
}

/* Preview Section */
.preview-section {
    display: none;
    margin-top: 40px;
    animation: fadeInUp 0.5s ease;
}

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

.preview-image {
    max-width: 350px;
    max-height: 350px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 25px;
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.05);
}

/* Search Button */
.search-btn {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    padding: 18px 50px;
    border: none;
    border-radius: 35px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.3);
    position: relative;
    overflow: hidden;
}

.search-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.search-btn:hover::after {
    width: 300px;
    height: 300px;
}

.search-btn:hover {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(46, 204, 113, 0.4);
}

.search-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.search-btn:disabled::after {
    display: none;
}

/* Loading Section */
.loading {
    display: none;
    text-align: center;
    padding: 60px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #ecf0f1;
    border-top: 6px solid #3498db;
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
    margin: 0 auto 30px;
}

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

.loading h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.loading p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Results Section */
.results-section {
    display: none;
    animation: slideInUp 0.6s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.results-header h2 {
    color: #2c3e50;
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.results-header p {
    color: #27ae60;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.result-item {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    transform: translateY(0);
}

.result-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

.result-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.result-content {
    padding: 25px;
}

.result-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Similarity Badge */
.similarity-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    z-index: 2;
}

/* Product Badges */
.product-badges {
    margin: 15px 0;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-hot {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
}

.badge-new {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    box-shadow: 0 3px 10px rgba(243, 156, 18, 0.3);
}

/* View Details Button */
.btn-primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    border: none;
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(45deg, #2980b9, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
    color: white;
    text-decoration: none;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 80px 30px;
    color: #7f8c8d;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.no-results-icon {
    font-size: 5rem;
    margin-bottom: 25px;
    color: #bdc3c7;
}

.no-results h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.no-results p {
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .image-search-container {
        padding: 15px;
    }
    
    .search-header h1 {
        font-size: 2.2rem;
    }
    
    .search-header p {
        font-size: 1rem;
    }
    
    /* Method selection responsive */
    .search-method-section {
        margin-bottom: 30px;
        padding: 0 10px;
    }
    
    .method-options-horizontal {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .method-card {
        min-width: 250px;
        padding: 20px 15px;
    }
    
    .method-icon {
        font-size: 2rem;
    }
    
    .method-title {
        font-size: 1.1rem;
    }
    
    .method-desc {
        font-size: 0.85rem;
    }
    
    .upload-section {
        padding: 30px 20px;
    }
    
    .upload-area {
        padding: 50px 20px;
        min-height: 200px;
    }
    
    .upload-icon {
        font-size: 4rem;
    }
    
    .upload-text {
        font-size: 1.2rem;
    }
    
    .browse-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    .search-btn {
        padding: 15px 35px;
        font-size: 1.1rem;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .result-content {
        padding: 20px;
    }
    
    .results-header h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .search-header h1 {
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .upload-icon {
        font-size: 3.5rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .preview-image {
        max-width: 280px;
        max-height: 280px;
    }
}

/* Search Method Selection - Horizontal Layout */
.search-method-section {
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.method-options-horizontal {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.method-option-horizontal {
    cursor: pointer;
    position: relative;
}

.method-option-horizontal input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.method-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid #e9ecef;
    border-radius: 20px;
    min-width: 200px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.method-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #2ecc71, #e74c3c);
    border-radius: 20px 20px 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.method-option-horizontal:hover .method-card {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.method-option-horizontal input[type="radio"]:checked + .method-card {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-color: #2980b9;
    color: white;
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(52, 152, 219, 0.3);
}

.method-option-horizontal input[type="radio"]:checked + .method-card::before {
    opacity: 1;
    background: linear-gradient(90deg, #2ecc71, #e74c3c, #f39c12);
}

.method-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    transition: transform 0.3s ease;
}

.method-option-horizontal:hover .method-icon {
    transform: scale(1.1);
}

.method-option-horizontal input[type="radio"]:checked + .method-card .method-icon {
    transform: scale(1.2);
}

.method-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
    transition: color 0.3s ease;
}

.method-option-horizontal input[type="radio"]:checked + .method-card .method-title {
    color: white;
}

.method-desc {
    font-size: 0.9rem;
    color: #7f8c8d;
    text-align: center;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.method-option-horizontal input[type="radio"]:checked + .method-card .method-desc {
    color: rgba(255, 255, 255, 0.9);
}

/* Result enhancements for hybrid search */
.result-item .method-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.result-item .method-badge.hybrid {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
}

.result-item .method-badge.color {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
}

.result-item .method-badge.edge {
    background: linear-gradient(45deg, #f39c12, #e67e22);
}

.result-item .method-badge.phash {
    background: linear-gradient(45deg, #34495e, #2c3e50);
}

.result-scores {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #7f8c8d;
}

.result-scores .score-item {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 6px;
    background: #ecf0f1;
    border-radius: 6px;
}

/* Accessibility Improvements */
.upload-area:focus-within {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

.btn-primary:focus,
.browse-btn:focus,
.search-btn:focus {
    outline: 3px solid rgba(52, 152, 219, 0.5);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .upload-section,
    .loading {
        display: none !important;
    }
    
    .results-section {
        display: block !important;
    }
    
    .result-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
