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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    padding: 40px;
}

.section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 2px solid #f0f0f0;
}

.section:last-child {
    border-bottom: none;
}

.section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* Product Selection */
.product-select {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.product-select:focus {
    outline: none;
    border-color: #667eea;
}

.product-preview {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 10px;
    display: none;
}

.product-preview.active {
    display: block;
}

.product-preview img {
    max-width: 200px;
    height: auto;
    border-radius: 10px;
    margin-bottom: 15px;
}

.product-info h3 {
    color: #333;
    margin-bottom: 5px;
}

.product-info p {
    color: #666;
}

/* Product Image Gallery */
.product-image-single img {
    max-width: 300px;
    height: auto;
    border-radius: 10px;
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.product-image-gallery {
    margin-bottom: 20px;
}

.gallery-label {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.gallery-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    transition: all 0.3s;
}

.gallery-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.gallery-item img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
}

.gallery-item-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    font-weight: 500;
}

.image-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
}

/* Camera */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 20px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

#camera-video,
#captured-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 150px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    font-size: 1.2rem;
    padding: 20px 40px;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.4);
}

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

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Result */
.result-container {
    text-align: center;
    margin: 20px 0;
}

#result-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.processing-time {
    text-align: center;
    color: #666;
    margin: 10px 0 20px;
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid #f5c6cb;
}

/* Footer */
footer {
    background: #f9f9f9;
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 20px;
    }
    
    .btn {
        min-width: 120px;
        padding: 12px 20px;
    }
}


