/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --gray: #64748b;
    --light-gray: #f1f5f9;
    --border: #e2e8f0;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== HERO ===== */
.hero {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 48px 0;
    margin-bottom: 40px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.hero-content {
    text-align: center;
    color: white;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.logo-icon {
    font-size: 32px;
}

.logo-text {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.hero-title {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 16px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 20px;
    font-weight: 400;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== STATUS CARD ===== */
.status-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.status-card.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.status-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.status-text h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.status-text p {
    font-size: 14px;
    opacity: 0.8;
}

/* ===== SECTION CARD ===== */
.section-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.section-header {
    margin-bottom: 32px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.section-description {
    color: var(--gray);
    font-size: 16px;
    margin-left: 56px;
}

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 3px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--light-gray);
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f8faff;
    transform: translateY(-2px);
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: #f8faff;
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.1);
}

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

.upload-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.upload-area h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.upload-area p {
    color: var(--gray);
    margin-bottom: 16px;
}

.upload-hint {
    display: inline-block;
    font-size: 13px;
    color: var(--gray);
    background: white;
    padding: 6px 16px;
    border-radius: 20px;
}

.upload-preview {
    position: relative;
    display: inline-block;
    max-width: 400px;
}

.upload-preview img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.btn-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-remove:hover {
    background: var(--danger);
    transform: scale(1.1);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-top: 24px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-secondary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-icon {
    font-size: 20px;
}

/* ===== PROGRESS BAR ===== */
.progress-container {
    margin-top: 24px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--light-gray);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    transition: width 0.4s ease;
    width: 0%;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* ===== FILES INFO ===== */
.files-info {
    margin-top: 16px;
    padding: 12px 20px;
    background: var(--light-gray);
    border-radius: var(--radius);
    text-align: center;
}

.files-count {
    font-weight: 600;
    color: var(--primary);
}

/* ===== PROCESSING STATUS ===== */
.processing-status {
    margin-top: 24px;
    text-align: center;
}

.spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

#processing-text {
    font-weight: 600;
    color: var(--primary);
}

/* ===== RESULTS ===== */
.results-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
}

.results-legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.legend-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
}

.legend-badge.match {
    background: #d1fae5;
    color: #059669;
}

.legend-badge.probable {
    background: #fed7aa;
    color: #d97706;
}

.legend-badge.no-match {
    background: #fee2e2;
    color: #dc2626;
}

/* ===== IMAGE GALLERY ===== */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.gallery-item {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 3px solid transparent;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.gallery-item.match {
    border-color: var(--success);
}

.gallery-item.probable {
    border-color: var(--warning);
}

.gallery-item.no-match {
    border-color: var(--danger);
}

.gallery-item-header {
    padding: 16px 20px;
    color: white;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-item.match .gallery-item-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.gallery-item.probable .gallery-item-header {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.gallery-item.no-match .gallery-item-header {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.gallery-item-badge {
    font-size: 24px;
}

.gallery-item-image {
    position: relative;
    width: 100%;
    padding-top: 75%;
    overflow: hidden;
    background: #f8fafc;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-item-image:hover {
    opacity: 0.9;
}

.gallery-item-image::after {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.gallery-item-image:hover::after {
    opacity: 0.7;
}

.gallery-item-image img,
.gallery-item-image canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-image canvas {
    pointer-events: none;
}

.gallery-item-info {
    padding: 20px;
}

.gallery-item-info p {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--gray);
}

.gallery-item-info strong {
    color: var(--dark);
    font-weight: 600;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 32px 0;
    color: white;
    font-size: 14px;
    opacity: 0.9;
}

/* ===== LIGHTBOX ===== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

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

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: var(--transition);
    z-index: 10001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img,
.lightbox-content canvas {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.lightbox-content canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.lightbox-info {
    margin-top: 20px;
    color: white;
    text-align: center;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.1);
    padding: 16px 32px;
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
}

.lightbox-info strong {
    color: white;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .section-card {
        padding: 24px;
    }
    
    .section-title {
        font-size: 22px;
    }
    
    .upload-area {
        padding: 32px 20px;
    }
    
    .image-gallery {
        grid-template-columns: 1fr;
    }
    
    .results-legend {
        flex-direction: column;
        gap: 12px;
    }
    
    .lightbox-content {
        max-width: 95vw;
        max-height: 70vh;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-info {
        font-size: 14px;
        padding: 12px 20px;
    }
}
