/* Enable scrolling for this page */
body.assessments-page {
    overflow-y: auto !important;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
}

body.assessments-page #app {
    height: auto;
    min-height: 100vh;
}

/* Dereal Assessments - Styles */

/* Page-scoped overrides (base tokens come from /style.css) */
:root {
    /* Domain colors (assessments-specific) */
    --domain-cognitive: #3b82f6;
    --domain-emotional: #ec4899;
    --domain-trauma: #8b5cf6;
    --domain-somatic: #14b8a6;
    --domain-behavioral: #f59e0b;
    --domain-mindfulness: #6366f1;
    --domain-expression: #f472b6;
    --domain-attachment: #a855f7;
    --domain-identity: #fbbf24;
    --domain-anxiety: #ef4444;
    --domain-depression: #6b7280;
    --domain-anger: #dc2626;
    --domain-burnout: #78716c;
    --domain-inner-child: #c084fc;
    --domain-meaning: #22c55e;
}

body {
    background: var(--bg-dark);
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--accent-primary);
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* Intro Section */
.intro-section {
    text-align: center;
    margin-bottom: 40px;
}

.intro-section h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.intro-section p {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 30px;
}

/* Overall Score */
.overall-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 16px;
    margin-bottom: 30px;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-value {
    font-size: 32px;
    font-weight: 700;
}

.score-label {
    font-size: 12px;
    opacity: 0.8;
}

.score-info {
    text-align: left;
}

.score-info span {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Domains Grid */
.domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.domain-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.domain-card::before {
    content: '💬 Chat to assess';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(168, 85, 247, 0.9));
    color: var(--text-primary);
    padding: 8px;
    font-size: 12px;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.domain-card:hover::before {
    transform: translateY(0);
}

.domain-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15);
}

.domain-card.assessed {
    border-color: var(--border-color);
}

.domain-card.assessed::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: var(--accent-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.domain-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.domain-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.domain-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.domain-score {
    font-size: 14px;
    color: var(--text-muted);
}

.domain-score.high {
    color: var(--accent-success);
}

.domain-score.moderate {
    color: var(--accent-warning);
}

.domain-score.low {
    color: var(--accent-danger);
}

.domain-companions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.companion-tag {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--bg-elevated);
    border-radius: 10px;
    color: var(--text-secondary);
}

/* Assessment View */
.assessment-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
}

.btn-back {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 0;
    font-size: 14px;
}

.btn-back:hover {
    color: var(--accent-primary);
}

.domain-info h2 {
    font-size: 24px;
    margin-bottom: 6px;
}

.domain-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Progress Bar */
.progress-bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Question Container */
.question-container {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    min-height: 300px;
}

.question-text {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 30px;
    line-height: 1.5;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: var(--bg-elevated);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-size: 15px;
}

.option-btn:hover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.option-btn.selected {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.15);
}

.option-btn .option-letter {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    background: var(--bg-dark);
    border-radius: 6px;
    margin-right: 12px;
    font-weight: 600;
    font-size: 13px;
}

.option-btn.selected .option-letter {
    background: var(--accent-primary);
}

/* Navigation */
.assessment-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

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

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

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

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

/* Results View */
.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.results-header h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.results-header p {
    color: var(--accent-primary);
    font-size: 16px;
}

/* Score Ring */
.results-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.score-ring {
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 16px;
}

.score-ring svg {
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--bg-elevated);
    stroke-width: 8;
}

.score-ring-fill {
    fill: none;
    stroke: url(#scoreGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 1s ease;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number {
    font-size: 48px;
    font-weight: 700;
}

.score-max {
    font-size: 18px;
    color: var(--text-secondary);
}

.score-status {
    font-size: 18px;
    font-weight: 500;
    padding: 8px 20px;
    border-radius: 20px;
}

.score-status.healthy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.score-status.moderate {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.score-status.attention {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

/* Interpretation */
.results-interpretation {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
}

.results-interpretation h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.results-interpretation p {
    font-size: 15px;
    line-height: 1.7;
}

/* Companion Recommendation */
.companion-recommendation {
    margin-bottom: 30px;
}

.companion-recommendation h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.companion-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.companion-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.companion-details h4 {
    font-size: 18px;
    margin-bottom: 4px;
}

.companion-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Protocol Recommendations */
.protocol-recommendations {
    margin-bottom: 30px;
}

.protocol-recommendations h3 {
    font-size: 18px;
    margin-bottom: 16px;
}

.protocol-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.protocol-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.protocol-card:hover {
    border-color: var(--accent-primary);
}

.protocol-card h4 {
    font-size: 15px;
    margin-bottom: 6px;
}

.protocol-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.protocol-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.protocol-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Protocol View */
.protocol-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.protocol-header h2 {
    font-size: 24px;
}

.protocol-info {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.protocol-type, .protocol-duration {
    font-size: 13px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    color: var(--text-secondary);
}

.protocol-description {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    font-size: 15px;
    line-height: 1.7;
}

.protocol-steps {
    margin-bottom: 30px;
}

.protocol-step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.step-content {
    padding-top: 4px;
    font-size: 15px;
    line-height: 1.6;
}

.protocol-actions {
    text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
    .app-container {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .domains-grid {
        grid-template-columns: 1fr;
    }
    
    .question-text {
        font-size: 18px;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* ============================================
   Inferred Scores (from conversations)
   ============================================ */

.domain-card.inferred {
    border: 1px solid rgba(168, 85, 247, 0.3);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.05) 0%, transparent 100%);
}

.inferred-badge {
    display: inline-block;
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-right: 6px;
    vertical-align: middle;
}

.domain-score .inferred-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
}
