* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
    align-items: start;
}

.main-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.example-section,
.upload-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.example-section {
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
    padding: 1.5rem;
}

.example-section h3 {
    color: #0369a1;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.example-section p {
    margin-bottom: 0.75rem;
    line-height: 1.5;
    color: #374151;
    font-size: 0.9rem;
}

.example-image {
    text-align: center;
    margin: 1rem 0;
}

#exampleImage {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.example-description {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 4px solid #0369a1;
}

.upload-area {
    position: relative;
    border: 3px dashed #e0e6ed;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f8fafc;
    margin-bottom: 1.5rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-content svg {
    color: #9ca3af;
    margin-bottom: 1rem;
}

.upload-content p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #374151;
}

.browse-text {
    color: #667eea;
    font-weight: 600;
}

.upload-content small {
    color: #6b7280;
}

#analyzeBtn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#analyzeBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

#analyzeBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.preview-section,
.result-section,
.error-section,
.loading-section {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.preview-section h3,
.result-section h3,
.error-section h3 {
    margin-bottom: 1rem;
    color: #374151;
    font-size: 1.3rem;
}

#imagePreview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.loading-section {
    text-align: center;
    background: #f0f4ff;
    border: 2px solid #e0e6ed;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-section p {
    color: #6b7280;
    font-size: 1.1rem;
}

.result-content {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

#resetBtn,
#retryBtn {
    padding: 0.8rem 2rem;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#resetBtn:hover,
#retryBtn:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.error-section {
    background: #fef2f2;
    border: 2px solid #fecaca;
}

.error-section h3 {
    color: #dc2626;
}

.error-content p {
    color: #991b1b;
    margin-bottom: 1rem;
}

#retryBtn {
    background: #dc2626;
}

#retryBtn:hover {
    background: #b91c1c;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .upload-section,
    .preview-section,
    .result-section,
    .error-section,
    .loading-section {
        padding: 1.5rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-content p {
        font-size: 1rem;
    }
}