/* RecoImageMinimax 主样式 */

:root {
    --primary-color: #1a5f7a;
    --secondary-color: #2d8bba;
    --accent-color: #57c5b6;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e0e6ed;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --success-color: #27ae60;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0;
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: 2px;
}

header .subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Main Content */
main {
    flex: 1;
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.upload-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.upload-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.upload-card h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
}

/* Drop Zone */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(26, 95, 122, 0.05);
}

.drop-content {
    pointer-events: none;
}

.upload-icon {
    width: 50px;
    height: 50px;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.drop-zone .file-info {
    font-size: 0.8rem;
    margin-top: 8px;
    color: #95a5a6;
}

/* Preview */
.preview {
    display: none;
    position: relative;
    width: 100%;
    max-height: 300px;
    overflow: hidden;
    border-radius: 8px;
}

.preview.show {
    display: block;
}

.preview img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.remove-btn:hover {
    background: var(--danger-color);
}

/* Options Row */
.options-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.option-group select {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--card-bg);
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.option-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Analyze Button */
.analyze-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(26, 95, 122, 0.3);
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 95, 122, 0.4);
}

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

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading.show {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Results Section */
.results-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.results-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-color);
}

.results-section h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* Similarity Scores */
.similarity-scores {
    margin-bottom: 40px;
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.score-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

.score-card:hover {
    transform: scale(1.05);
}

.score-card.combined {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.score-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.score-card.combined .score-value {
    color: white;
}

.score-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.score-card.combined .score-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Comparison Viewer */
.comparison-viewer {
    margin-bottom: 40px;
}

.image-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 25px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.tab-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tab-content {
    position: relative;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-pane img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.zoom-controls button {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.zoom-controls button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

#zoom-level {
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

/* Targets List */
.targets-list {
    margin-bottom: 30px;
}

.targets-table {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 80px 1fr 120px 120px;
    gap: 10px;
    padding: 15px 20px;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.target-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px 120px;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: background 0.3s ease;
}

.target-row:hover {
    background: #f8f9fa;
}

.target-row:last-child {
    border-bottom: none;
}

.col-num {
    font-weight: 600;
    color: var(--text-secondary);
}

.col-bbox {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.col-prob {
    font-weight: 700;
    font-size: 1.1rem;
}

.col-risk {
    padding: 5px 15px;
    border-radius: 20px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    color: white;
}

/* Legend */
.legend {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.legend h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .upload-grid {
        grid-template-columns: 1fr;
    }

    .options-row {
        flex-direction: column;
    }

    .scores-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-header,
    .target-row {
        grid-template-columns: 50px 1fr 80px;
    }

    .col-risk {
        display: none;
    }

    .image-tabs {
        flex-wrap: wrap;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-section {
    animation: fadeIn 0.5s ease;
}
