/* TMJ Diagnosis Demo System - Styles */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Input Section */
.input-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

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

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

textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* Algorithm Selection */
.algorithm-section {
    margin-bottom: 1.5rem;
}

.algorithm-section > label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.algorithm-card {
    position: relative;
}

.algorithm-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.algorithm-card label {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card-bg);
}

.algorithm-card input[type="radio"]:checked + label {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.algorithm-card input[type="radio"]:hover + label {
    border-color: var(--primary-color);
}

.algo-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.algo-type {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    width: fit-content;
    margin-bottom: 0.25rem;
}

.algo-type.llm {
    background: #dbeafe;
    color: #1e40af;
}

.algo-type.ml {
    background: #dcfce7;
    color: #166534;
}

.algo-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Diagnose Button */
#diagnose-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#diagnose-btn:hover {
    background: var(--primary-dark);
}

#diagnose-btn:active {
    transform: scale(0.98);
}

#diagnose-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

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

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

/* Results Section */
.results-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.results-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.diagnosis-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.diagnosis-card {
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
}

.diagnosis-card h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.diagnosis-status {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.diagnosis-label {
    font-size: 1.1rem;
    font-weight: 600;
}

.diagnosis-card.normal {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.diagnosis-card.normal .diagnosis-status {
    color: var(--success-color);
}

.diagnosis-card.normal .diagnosis-label {
    color: var(--success-color);
}

.diagnosis-card.disorder {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.diagnosis-card.disorder .diagnosis-status {
    color: var(--danger-color);
}

.diagnosis-card.disorder .diagnosis-label {
    color: var(--danger-color);
}

/* Reasoning Section */
.reasoning-section {
    margin-bottom: 1.5rem;
}

.reasoning-section h3,
.visualization-section h3,
.features-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.reasoning-content {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.reasoning-content code {
    background: #e2e8f0;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
}

.reasoning-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

/* Visualization Section */
.visualization-section {
    margin-bottom: 1.5rem;
}

.visualization-container {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    overflow-x: auto;
}

.visualization-container img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Features Section */
.features-section {
    margin-bottom: 1rem;
}

.features-content {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
}

.feature-tag .feature-name {
    color: var(--text-color);
}

.feature-tag .feature-value {
    color: var(--primary-color);
    font-weight: 600;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

footer p {
    font-size: 0.9rem;
}

.footer-note {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    color: var(--warning-color);
}

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

    header h1 {
        font-size: 1.5rem;
    }

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

    .diagnosis-cards {
        grid-template-columns: 1fr;
    }
}
