/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --dark: #1F2937;
    --light: #F9FAFB;
    --border: #E5E7EB;
    --text: #374151;
    --text-light: #6B7280;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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;
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s ease-out;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out;
}

.card h2 {
    color: var(--dark);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Upload Area */
.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    border: 3px dashed var(--border);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--light);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

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

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #EEF2FF;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.upload-hint {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Image Preview */
.image-preview {
    position: relative;
    margin: 1rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.image-preview img {
    width: 100%;
    display: block;
    max-height: 500px;
    object-fit: contain;
    background: var(--light);
}

.btn-remove {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: #DC2626;
    transform: scale(1.05);
}

/* Custom Answer Section */
.custom-answer-section {
    margin: 1.5rem 0;
}

.custom-answer-section details {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    background: var(--light);
}

.custom-answer-section summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    user-select: none;
}

.custom-answer-section summary:hover {
    opacity: 0.8;
}

.custom-answer-content {
    margin-top: 1rem;
}

.custom-answer-content textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.custom-answer-content textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Buttons */
.btn-primary, .btn-secondary {
    width: 100%;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

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

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

.btn-primary:disabled {
    background: var(--border);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
}

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

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

/* Images Grid */
.images-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.images-grid-three {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.image-card {
    background: var(--light);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.image-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 0.95rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.image-card img {
    width: 100%;
    border-radius: 8px;
    border: 2px solid var(--border);
    display: block;
}

.image-caption {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.4;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
}

/* Progress Bar */
.progress-container {
    margin: 2rem 0;
}

.progress-bar {
    height: 30px;
    background: var(--light);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), #34D399);
    transition: width 0.6s ease;
    border-radius: 15px;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-left: 4px solid var(--warning-color);
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.detail-item {
    padding: 0.75rem;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--light);
    transition: all 0.3s ease;
}

.detail-item.correct {
    border-color: var(--secondary-color);
    background: #D1FAE5;
}

.detail-item.wrong {
    border-color: var(--danger-color);
    background: #FEE2E2;
}

.detail-item.multiple {
    border-color: var(--warning-color);
    background: #FEF3C7;
}

.detail-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.detail-question {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--dark);
}

.detail-answer {
    font-size: 0.9rem;
    color: var(--text);
}

.detail-status {
    font-size: 1.2rem;
    margin-top: 0.25rem;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

/* Error Card */
.error-card {
    background: #FEE2E2;
    border-left: 4px solid var(--danger-color);
}

.error-card h2 {
    color: var(--danger-color);
}

.error-card p {
    color: var(--text);
    margin: 1rem 0;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    margin-top: 3rem;
    padding: 2rem 0;
}

.footer-content p {
    margin: 0.5rem 0;
    opacity: 0.95;
}

.footer-meta {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Info Panel */
.info-panel {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: var(--shadow);
}

.info-panel h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.info-content p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.info-tips {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--light);
    border-radius: 8px;
}

.info-tips h4 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.info-tips ul {
    list-style: none;
    padding-left: 0;
}

.info-tips li {
    margin: 0.5rem 0;
    color: var(--text);
}

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

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

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

    .header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .card {
        padding: 1.5rem;
    }

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

    .images-grid-three {
        grid-template-columns: 1fr;
    }

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

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .details-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .camera-container video {
        max-height: 400px;
    }

    .mode-toggle {
        flex-direction: column;
    }

    .mode-btn {
        width: 100%;
    }
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.mode-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    position: relative;
    bottom: -2px;
}

.mode-btn:hover {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.mode-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.mode-content {
    animation: fadeIn 0.3s ease-out;
}

/* Camera Container */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 1rem auto;
}

.camera-container video {
    width: 100%;
    height: auto;
    max-height: 600px;
    border-radius: 12px;
    background: #000;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.camera-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1rem;
    backdrop-filter: blur(10px);
}

.camera-guide p {
    margin: 0;
    font-weight: 500;
}

.camera-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.camera-controls .btn {
    min-width: 150px;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .upload-section,
    .action-buttons,
    .info-panel,
    .footer {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border);
    }
}

