/* Google-style Search Page */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fff;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.search-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

/* Top Right Navigation */
.top-nav {
    position: absolute;
    top: 20px;
    right: 30px;
    z-index: 100;
}

.top-nav-link {
    color: #5f6368;
    text-decoration: none;
    font-size: 0.9em;
    padding: 8px 16px;
    transition: color 0.2s ease;
}

.top-nav-link:hover {
    color: #1a73e8;
    text-decoration: underline;
}

/* Minimal Header */
.search-header-minimal {
    padding: 20px 30px;
    border-bottom: 1px solid #e8eaed;
    background: #fff;
}

.logo {
    font-size: 1.5em;
    color: #667eea;
    font-weight: 500;
}

/* Main Search Area */
.search-main-minimal {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    margin: 0 auto;
    padding-top: 80px;
}

/* Logo Container */
.search-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    width: 100%;
    padding: 0 20px;
}

.search-logo {
    max-width: 300px;
    width: 100%;
    height: auto;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Responsive logo sizing */
@media (max-width: 768px) {
    .search-logo {
        max-width: 200px;
    }

    .search-main-minimal {
        padding-top: 40px;
    }
}

@media (max-width: 480px) {
    .search-logo {
        max-width: 150px;
    }
}

/* Search Box */
.search-box-container {
    width: 100%;
    max-width: 600px;
    margin-bottom: 40px;
}

.search-box {
    width: 100%;
    border: 2px solid #dfe1e5;
    border-radius: 24px;
    padding: 12px 20px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.search-box:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #dfe1e5;
}

.search-box.dragover {
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.search-box-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-icon {
    color: #9aa0a6;
    flex-shrink: 0;
}

.search-box-text {
    flex: 1;
    color: #9aa0a6;
    font-size: 1em;
    user-select: none;
}

.search-box.has-image .search-box-text {
    color: #333;
    font-weight: 500;
}

/* Uploaded Thumbnail */
.uploaded-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #667eea;
    background: #f8f9ff;
}

.uploaded-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumbnail-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ea4335;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.thumbnail-remove:hover {
    background: #c5221f;
    transform: scale(1.1);
}

.search-box.has-image .search-icon {
    display: none;
}

.search-hint {
    text-align: center;
    margin-top: 15px;
    color: #5f6368;
    font-size: 0.9em;
}

.search-hint i {
    margin: 0 4px;
}

/* Upload Progress */
.upload-progress {
    width: 100%;
    max-width: 600px;
    margin-bottom: 30px;
}

.progress-bar {
    height: 4px;
    background: #e8eaed;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: #5f6368;
    font-size: 0.9em;
}

/* Search Results */
.search-results-section {
    width: 100%;
    max-width: 1200px;
    animation: fadeIn 0.3s ease-in;
}

.results-header {
    padding: 20px 0;
    border-bottom: 1px solid #e8eaed;
    margin-bottom: 30px;
}

.results-info {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.results-info h2 {
    font-size: 1.1em;
    color: #5f6368;
    font-weight: 400;
}

.results-stats {
    color: #9aa0a6;
    font-size: 0.9em;
}

/* Results List (Google-style) */
.search-results-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.search-result-item {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.search-result-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #dadce0;
    transform: translateY(-2px);
}

.result-image-container {
    width: 100%;
    height: 200px;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.result-image-container img,
.result-image-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.similarity-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.similarity-badge.very-high {
    background: rgba(40, 167, 69, 0.9);
}

.similarity-badge.high {
    background: rgba(23, 162, 184, 0.9);
}

.similarity-badge.medium {
    background: rgba(255, 193, 7, 0.9);
}

.result-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.result-title {
    font-size: 0.95em;
    color: #1a73e8;
    margin-bottom: 6px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-title:hover {
    text-decoration: underline;
}

.result-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: auto;
}

.result-meta-item {
    font-size: 0.8em;
    color: #5f6368;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-meta-item strong {
    color: #202124;
    font-weight: 500;
}

.method-tag {
    display: inline-block;
    background: #f1f3f4;
    color: #5f6368;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75em;
    margin-left: 4px;
}

/* Footer */
.search-footer {
    margin-top: auto;
    padding: 20px 30px;
    border-top: 1px solid #e8eaed;
    background: #f8f9fa;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.nav-link {
    color: #5f6368;
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #667eea;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .search-main-minimal {
        padding: 40px 15px 20px;
    }

    .search-results-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .results-info {
        flex-direction: column;
        gap: 5px;
    }
}
