* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.nav-btn {
    padding: 12px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: #667eea;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-btn i {
    margin-right: 8px;
}

.nav-btn:hover {
    background: #f8f9ff;
    border-color: #667eea;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

/* Views */
.view {
    display: none;
    min-height: 200px; /* Ensure views have some height */
    width: 100%;
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.view.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

main {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
    min-height: 400px;
}

section {
    margin-bottom: 40px;
}

h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* Upload Section */
.upload-section {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 30px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 15px;
}

.upload-content p {
    margin: 10px 0;
    color: #666;
}

.upload-hint {
    font-size: 0.9em;
    color: #999;
}

.progress-bar {
    margin-top: 15px;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Gallery Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.image-card {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.image-card img,
.image-card video {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.image-card video {
    background: #000;
    cursor: pointer;
}

.image-card video:hover {
    opacity: 0.9;
}

/* Video play indicator - removed, using browser's native controls */

.image-card-info {
    padding: 12px;
}

/* Image comparison checkbox */
.image-card-checkbox-container {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 10;
}

.image-compare-checkbox {
    display: none;
}

.image-compare-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.image-compare-label:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

.image-compare-checkbox:checked + .image-compare-label {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.image-compare-checkbox:checked + .image-compare-label i {
    display: block;
}

.image-compare-label i {
    display: none;
    font-size: 14px;
    color: white;
}

.image-card[data-selected="true"] {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.image-card-info h3 {
    font-size: 0.9em;
    margin-bottom: 5px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-card-info p {
    font-size: 0.8em;
    color: #666;
    margin: 3px 0;
}

.image-card-actions {
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
}

.btn-regenerate {
    padding: 6px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
}

.btn-regenerate:hover {
    background: #e0e0e0;
    border-color: #667eea;
}

.fingerprint-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    margin-top: 5px;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
}

.btn-primary i, .btn-secondary i, .btn-regenerate i {
    margin-right: 6px;
}
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Comparison Section */
.comparison-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.select-input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    background: white;
}

.select-input:focus {
    outline: none;
    border-color: #667eea;
}

.comparison-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.similarity-score {
    text-align: center;
    padding: 20px;
}

.similarity-value {
    font-size: 3em;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
}

.similarity-label {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 10px;
}

.similarity-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.detail-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.detail-item label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.detail-item value {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
}

.close:hover {
    color: #000;
}

.image-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.image-details img {
    width: 100%;
    border-radius: 8px;
}

.fingerprint-data {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.fingerprint-data pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Loading and Messages */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 4px solid #c33;
}

.success {
    background: #efe;
    color: #3c3;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
    border-left: 4px solid #3c3;
}

/* Comparison Methods */
.comparison-methods {
    margin-top: 20px;
}

.methods-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.method-result {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 2px solid #e0e0e0;
}

.method-result h4 {
    margin: 0 0 15px 0;
    color: #667eea;
    font-size: 1.1em;
}

.comparison-summary {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
}

.comparison-summary p {
    margin: 5px 0;
    color: #856404;
}

/* Responsive */
@media (max-width: 768px) {
    .comparison-controls {
        flex-direction: column;
    }

    .select-input {
        width: 100%;
    }

    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .image-details {
        grid-template-columns: 1fr;
    }

    .methods-grid {
        grid-template-columns: 1fr;
    }
}

/* Comparison Matrix */
.comparison-matrix-container {
    overflow-x: auto;
    margin-top: 20px;
}

.comparison-matrix {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.comparison-matrix th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.comparison-matrix th:first-child {
    position: sticky;
    left: 0;
    z-index: 11;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.comparison-matrix td {
    padding: 10px;
    text-align: center;
    border: 1px solid #e0e0e0;
    position: relative;
}

.comparison-matrix td:first-child {
    position: sticky;
    left: 0;
    background: #f8f9fa;
    font-weight: 600;
    z-index: 5;
    border-right: 2px solid #667eea;
}

.comparison-matrix .matrix-cell {
    min-width: 100px;
    padding: 8px;
}

.matrix-cell-same {
    background: #f0f0f0;
    font-weight: bold;
    color: #999;
}

.matrix-cell-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.matrix-score {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.matrix-score.very-similar {
    color: #28a745;
}

.matrix-score.similar {
    color: #17a2b8;
}

.matrix-score.somewhat {
    color: #ffc107;
}

.matrix-score.different {
    color: #dc3545;
}

.matrix-method-label {
    font-size: 0.75em;
    color: #666;
    margin-top: 2px;
}

.matrix-image-header {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.matrix-image-header img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid white;
}

.matrix-image-header span {
    font-size: 0.85em;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Analysis Section */
.analysis-section {
    padding: 20px;
}

.analysis-content {
    margin-top: 20px;
}

.analysis-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.stat-card h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.stat-card .stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

.stat-card .stat-label {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

