/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --normal-color: #10b981;
    --affected-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

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

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0;
    color: white;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* Main content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Upload section */
.upload-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-primary);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-icon {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Preview container */
.preview-container {
    margin-top: 20px;
    text-align: center;
}

.preview-container img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 16px;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

.spinner-circle {
    stroke-dasharray: 50;
    stroke-dashoffset: 20;
}

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

/* Results section */
.results-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.results-section h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.result-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 24px;
}

.result-label {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.result-label.normal {
    background: rgba(16, 185, 129, 0.1);
    color: var(--normal-color);
}

.result-label.affected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--affected-color);
}

.result-confidence {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.result-confidence span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* Probability bars */
.probability-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.prob-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prob-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.prob-label span:first-child {
    color: var(--text-secondary);
}

.prob-label span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.prob-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.prob-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.prob-fill.normal {
    background: var(--normal-color);
}

.prob-fill.affected {
    background: var(--affected-color);
}

/* Disclaimer */
.disclaimer {
    margin-top: 20px;
    padding: 16px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-left: 4px solid var(--warning-color);
}

.disclaimer strong {
    color: var(--warning-color);
}

/* Error section */
.error-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.error-message {
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: white;
}

.model-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning-color);
}

.status-indicator.connected {
    background: var(--success-color);
}

.status-indicator.error {
    background: var(--danger-color);
}

footer p {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .upload-area {
        padding: 30px 16px;
    }

    .result-label {
        font-size: 1.5rem;
    }
}
