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

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

/* Dereal Personality Lab - Styles */

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

.app-container {
    max-width: 900px;
    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: 40px;
}

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

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

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

.header-actions {
    display: flex;
    gap: 16px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

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

.view.active {
    display: block;
}

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

.intro-section h2 {
    font-size: 32px;
    margin-bottom: 12px;
}

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

.progress-overview {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 24px;
    background: var(--bg-card);
    border-radius: 16px;
}

.progress-stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Categories */
.chapter-categories {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

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

.category-title {
    font-size: 20px;
    margin-bottom: 8px;
}

.category-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

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

.chapter-card::before {
    content: '💬 Chat to discover';
    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: 6px;
    font-size: 11px;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

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

.chapter-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.chapter-card.completed {
    border-color: var(--accent-success);
}

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

.chapter-number {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.chapter-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.chapter-result {
    font-size: 12px;
    color: var(--accent-primary);
}

.chapter-result.empty {
    color: var(--text-muted);
}

/* Test View */
.test-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);
}

.test-info {
    flex: 1;
}

.test-chapter {
    font-size: 12px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.test-info h2 {
    font-size: 24px;
    margin: 6px 0;
}

.test-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: 320px;
}

.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-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 */
.test-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;
    text-decoration: 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: 32px;
    margin-bottom: 8px;
}

.results-header p {
    color: var(--text-secondary);
}

.results-card {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 20px;
    margin-bottom: 30px;
}

.result-primary, .result-secondary {
    text-align: center;
}

.result-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.result-value {
    font-size: 32px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-secondary .result-value {
    font-size: 24px;
    opacity: 0.8;
}

.result-description {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
}

.result-description h4 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--accent-primary);
}

.result-description p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.result-integration {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    border-left: 4px solid var(--accent-success);
}

.result-integration h4 {
    font-size: 16px;
    margin-bottom: 8px;
}

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

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

/* Responsive */
@media (max-width: 600px) {
    .header {
        flex-direction: column;
        gap: 16px;
    }
    
    .progress-overview {
        flex-direction: column;
        gap: 20px;
    }
    
    .chapters-grid {
        grid-template-columns: 1fr;
    }
    
    .results-card {
        flex-direction: column;
        gap: 20px;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
}

/* ============================================
   Inferred Personality Section (NEW)
   ============================================ */

.inferred-section {
    margin-bottom: 40px;
}

.inferred-header {
    text-align: center;
    margin-bottom: 24px;
}

.inferred-header h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.inferred-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.inferred-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.inferred-loading {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.inferred-loading p {
    margin-top: 16px;
    color: var(--text-secondary);
}

.inferred-progress {
    margin-bottom: 24px;
}

.inferred-progress .progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

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

#inferredConfidence {
    color: var(--accent-primary);
    font-weight: 600;
}

.progress-track {
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

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

.progress-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.traits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.trait-item {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.trait-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.trait-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
}

.trait-confidence {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.trait-confidence.high {
    color: var(--accent-success);
}

.trait-confidence.medium {
    color: var(--accent-warning);
}

.trait-confidence.low {
    color: var(--text-muted);
}

.inferred-description {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-elevated);
    border-radius: 8px;
}

.inferred-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.inferred-empty {
    text-align: center;
    padding: 40px;
}

.inferred-empty p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.inferred-empty .btn {
    margin-top: 16px;
}

.section-divider {
    text-align: center;
    margin: 40px 0;
    position: relative;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.section-divider span {
    background: var(--bg-dark);
    padding: 0 20px;
    position: relative;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Corrections modal */
.corrections-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.corrections-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.corrections-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.corrections-content h3 {
    margin-bottom: 16px;
}

.correction-item {
    margin-bottom: 16px;
}

.correction-item label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.correction-item select {
    width: 100%;
    padding: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.correction-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.correction-actions .btn {
    flex: 1;
}

/* =============================================================================
   CHAPTER 22: COMPREHENSIVE PERSONALITY REPORT
============================================================================= */

.comprehensive-section {
    margin-bottom: 32px;
}

.comprehensive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.comprehensive-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.badge-chapter22 {
    background: linear-gradient(135deg, #9333ea, #4f46e5);
    color: var(--text-primary);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.comprehensive-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(147, 51, 234, 0.3);
}

.comprehensive-loading {
    text-align: center;
    padding: 40px;
}

/* Fusion Type Hero */
.fusion-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.15), rgba(79, 70, 229, 0.15));
    border-radius: 12px;
    margin-bottom: 24px;
}

.fusion-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(147, 51, 234, 0.2);
    border-radius: 50%;
}

.fusion-info {
    flex: 1;
}

.fusion-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fusion-name {
    font-size: 1.4rem;
    font-weight: 600;
    color: #a78bfa;
    margin: 4px 0;
}

.fusion-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* UCI Score Section */
.uci-section {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.uci-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.uci-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.uci-score {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a78bfa, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.uci-stage-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(147, 51, 234, 0.2);
    color: #a78bfa;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 16px;
    text-transform: capitalize;
}

.uci-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.uci-bar {
    display: grid;
    grid-template-columns: 100px 1fr 50px;
    align-items: center;
    gap: 12px;
}

.bar-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.bar-track {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.bar-fill.bar-blue {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.bar-fill.bar-purple {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.bar-fill.bar-gold {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.bar-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    text-align: right;
}

/* Dimensions Grid */
.dimensions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.dimension-chip {
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.dimension-chip-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.dimension-chip-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: capitalize;
}

/* Twin Seed Section */
.twin-seed-section {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.twin-seed-section h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.twin-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.twin-trait {
    background: rgba(147, 51, 234, 0.15);
    border: 1px solid rgba(147, 51, 234, 0.3);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    color: #a78bfa;
}

/* Insights Section */
.insights-section {
    margin-bottom: 24px;
}

.insights-section h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.strengths-list {
    margin-bottom: 16px;
}

.strength-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.strength-item::before {
    content: '✓';
    color: #22c55e;
    font-weight: bold;
}

.growth-edges {
    padding: 12px;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 8px;
    border-left: 3px solid #fbbf24;
}

.growth-edge-label {
    font-size: 0.8rem;
    color: #fbbf24;
    font-weight: 500;
    margin-bottom: 8px;
}

.growth-edge-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Actions */
.comprehensive-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.comprehensive-empty {
    text-align: center;
    padding: 40px;
}

.comprehensive-empty p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .fusion-hero {
        flex-direction: column;
        text-align: center;
    }
    
    .uci-bar {
        grid-template-columns: 80px 1fr 40px;
    }
    
    .dimensions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
