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

:root {
    --primary-teal: #14b8a6;
    --primary-dark: #0f766e;
    --accent-coral: #fb7185;
    --accent-mint: #6ee7b7;
    --success-green: #10b981;
    --warning-orange: #f59e0b;
    --danger-red: #ef4444;
    --bg-light: #f0fdfa;
    --bg-white: #ffffff;
    --text-dark: #134e4a;
    --text-gray: #64748b;
    --border-color: #ccfbf1;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #2dd4bf 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
    color: var(--text-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-teal) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo svg path {
    stroke: white;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
}

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

.warning-banner {
    background: #fef3c7;
    border: 2px solid var(--warning-orange);
    padding: 1rem;
    margin: 1.5rem;
    border-radius: 0.5rem;
    color: #92400e;
    text-align: center;
}

.info-toggle-container {
    text-align: center;
    margin: 1rem 1.5rem;
}

.info-toggle-btn {
    background: linear-gradient(135deg, var(--primary-teal) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow);
}

.info-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(20, 184, 166, 0.3);
}

.info-section {
    background: var(--bg-light);
    padding: 2rem;
    margin: 0 1.5rem 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary-teal);
    position: relative;
}

.info-close-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.close-info-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-info-btn:hover {
    background: rgba(20, 184, 166, 0.1);
    color: var(--primary-teal);
}

.info-section h2 {
    color: var(--primary-teal);
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.info-section h3 {
    color: var(--primary-dark);
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.info-section p {
    color: var(--text-dark);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.info-section ul, .info-section ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.info-section li {
    color: var(--text-dark);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.info-section li strong {
    color: var(--primary-teal);
}

.main-content {
    padding: 2rem;
    display: grid;
    gap: 2rem;
}

.form-section h2, .results-section h2 {
    color: var(--primary-teal);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.field-hint {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.lab-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.lab-input label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-gray);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-teal) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(20, 184, 166, 0.3);
}

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

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.stat-card {
    background: linear-gradient(135deg, var(--primary-teal) 0%, var(--accent-mint) 100%);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    color: white;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.report-card {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.report-card h3 {
    color: var(--primary-teal);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.diagnosis-item {
    background: white;
    padding: 1rem;
    border-left: 4px solid var(--primary-teal);
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}

.diagnosis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.diagnosis-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
}

.confidence-badge {
    background: var(--accent-coral);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.diagnosis-rationale {
    color: var(--text-gray);
    line-height: 1.6;
}

.list-item {
    background: white;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    border-left: 3px solid var(--primary-teal);
}

.reasoning-step {
    background: white;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    border-left: 4px solid var(--warning-orange);
}

.step-number {
    display: inline-block;
    background: var(--warning-orange);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: 600;
    font-size: 0.875rem;
    margin-right: 0.5rem;
}

.error-card {
    background: #fee2e2;
    border: 2px solid var(--danger-red);
    padding: 1.5rem;
    border-radius: 0.75rem;
}

.error-card h3 {
    color: var(--danger-red);
    margin-bottom: 0.5rem;
}

.error-card p {
    color: #991b1b;
}

pre {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

footer {
    background: var(--bg-light);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-gray);
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-teal);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.formatted-section {
    margin-bottom: 1.5rem;
}

.formatted-section h4 {
    color: var(--primary-teal);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.formatted-item {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-light);
    border-left: 3px solid var(--accent-mint);
    border-radius: 0.25rem;
}

.formatted-item strong {
    color: var(--text-dark);
    display: block;
    margin-bottom: 0.5rem;
}

.formatted-item p {
    color: var(--text-gray);
    line-height: 1.6;
    margin: 0;
}

.confidence-inline {
    color: var(--primary-teal);
    font-weight: 600;
    margin-left: 0.5rem;
    font-size: 0.9rem;
}

.formatted-text p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.formatted-text h4 {
    color: var(--primary-teal);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.formatted-text ul, .formatted-text ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.formatted-text li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.formatted-section ul, .formatted-section ol {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.formatted-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: var(--text-dark);
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    body {
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
}
