/* Test Page Styles */
.test-container {
    padding-top: 100px;
    padding-bottom: 60px;
    min-height: 100vh;
    background-color: var(--bg-light);
}

.test-card-container {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

/* Intro Section */
.test-intro .intro-title {
    font-size: 28px;
    color: var(--brand-main);
    text-align: center;
    margin-bottom: 20px;
}

.test-intro .intro-desc {
    color: var(--text-main);
    line-height: 1.8;
    margin-bottom: 30px;
    text-align: justify;
}

.test-intro .intro-tips {
    background: #F0F7FF;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.test-intro .intro-tips h4 {
    color: var(--brand-main);
    margin-bottom: 10px;
}

.test-intro .intro-tips ul {
    list-style-position: inside;
    color: var(--text-main);
    opacity: 0.8;
}

.test-intro .intro-tips li {
    margin-bottom: 8px;
}

/* Quiz Section */
.test-quiz {
    display: none;
    position: relative;
}

.quiz-timer {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 18px;
    font-weight: bold;
    color: var(--brand-main);
    background: #F0F7FF;
    padding: 5px 12px;
    border-radius: 20px;
    font-family: monospace;
}

.test-title {
    font-size: 24px;
    color: var(--text-main);
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
}

.progress-bar-container {
    height: 8px;
    background-color: #E2E8F0;
    border-radius: 4px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--brand-main);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: right;
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 10px;
    opacity: 0.7;
}

.question-card {
    margin-bottom: 30px;
}

.question-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 24px;
    line-height: 1.5;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-btn {
    padding: 16px 20px;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.option-btn:hover {
    border-color: var(--brand-main);
    background-color: #F0F7FF;
}

.option-btn.selected {
    border-color: var(--brand-main);
    background-color: var(--brand-main);
    color: white;
}

.option-label {
    font-weight: bold;
    margin-right: 12px;
    font-size: 18px;
}

/* Result Section */
.test-result {
    display: none;
    text-align: center;

.result-header {
    margin-bottom: 40px;
}

.result-type {
    font-size: 48px;
    font-weight: bold;
    color: var(--brand-main);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.result-name {
    font-size: 24px;
    color: var(--text-main);
    margin-bottom: 20px;
}

.result-desc {
    font-size: 16px;
    color: var(--text-main);
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* MBTI Chart Styles */
.mbti-chart-container {
    max-width: 900px;
    margin: 40px auto;
    font-family: sans-serif;
}

.chart-title {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--text-main);
    text-decoration: underline;
    text-underline-offset: 5px;
}

.chart-header-labels {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 2fr 1fr 1fr 1fr;
    margin: 0 140px 10px 140px; /* Match label width */
    text-align: center;
    font-size: 12px;
    color: var(--text-main);
}

.chart-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    height: 50px;
}

.chart-label-box {
    width: 140px;
    font-size: 16px;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.chart-label-box.left {
    justify-content: flex-end;
    padding-right: 15px;
}

.chart-label-box.right {
    justify-content: flex-start;
    padding-left: 15px;
}

.chart-label-box.active span {
    background-color: #5B2C6F; /* Purple */
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.chart-bar-area {
    flex: 1;
    height: 100%;
    position: relative;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}

/* Remove borders for first/last if needed, or keep for all rows */
.chart-row:first-child .chart-bar-area {
    border-top: 2px solid #000;
}
.chart-row:last-child .chart-bar-area {
    border-bottom: 2px solid #000;
}

.chart-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    z-index: 0;
}

.grid-col {
    border-right: 1px solid white;
    background-color: #A9CCE3; /* Light Blue */
    opacity: 0.6;
}

/* Varying opacity/shades for zones */
.grid-col:nth-child(1), .grid-col:nth-child(8) { background-color: #5499C7; opacity: 0.8; } /* Very Clear */
.grid-col:nth-child(2), .grid-col:nth-child(7) { background-color: #7FB3D5; opacity: 0.7; } /* Clear */
.grid-col:nth-child(3), .grid-col:nth-child(6) { background-color: #A9CCE3; opacity: 0.6; } /* Moderate */
.grid-col:nth-child(4), .grid-col:nth-child(5) { background-color: #D4E6F1; opacity: 0.4; } /* Slight */

.chart-center-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #000;
    transform: translateX(-50%);
    z-index: 2;
}

.chart-bar {
    position: absolute;
    top: 10px;
    bottom: 10px;
    background-color: #5B2C6F; /* Purple */
    z-index: 1;
    transition: width 0.6s ease;
}

.chart-bar.left {
    right: 50%;
    transform-origin: right;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.chart-bar.right {
    left: 50%;
    transform-origin: left;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.sub-dimension-container {
    max-width: 900px;
    margin: 40px auto 0;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.sub-dim-group {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #bbb;
}

.sub-dim-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.sub-row-wrapper {
    margin-bottom: 15px;
}

.sub-row-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand-main);
    text-align: center;
    margin-bottom: 8px;
}

.sub-chart-row {
    height: 36px;
    margin-bottom: 10px;
}

.sub-chart-row .chart-label-box {
    font-size: 14px;
}

.sub-chart-row .chart-label-box.active span {
    padding: 4px 8px;
    font-size: 13px;
}

/* Add origin dot for sub-dimension charts */
.sub-chart-row .chart-center-line::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background-color: #333;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

/* Mobile Responsiveness for Sub-dimensions */
@media (max-width: 768px) {
    .sub-chart-row .chart-label-box {
        width: 70px;
        font-size: 11px;
        padding: 0 4px;
    }
    
    .sub-chart-row .chart-label-box.active span {
        padding: 3px 6px;
        font-size: 11px;
    }
    
    .sub-row-title {
        font-size: 14px;
    }
}

.chart-footer-scale {
    display: flex;
    justify-content: space-between;
    margin: 10px 140px 0 140px;
    font-size: 14px;
    color: #333;
    position: relative;
    top: -5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chart-header-labels {
        font-size: 10px;
        margin: 0 80px 10px 80px;
        display: none; /* Hide top labels on small screens? Or stack? */
    }
    
    .chart-label-box {
        width: 80px;
        font-size: 12px;
    }
    
    .chart-label-box.active span {
        padding: 4px 8px;
    }
    
    .chart-footer-scale {
        margin: 10px 80px 0 80px;
        font-size: 10px;
    }
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--brand-main);
    color: var(--brand-main);
}

.btn-outline:hover {
    background: var(--brand-main);
    color: white;
}

/* Detailed Result Styles */
.result-details-container {
    margin-top: 40px;
    text-align: left;
    background: #fff;
    border-top: 1px solid #eee;
    padding-top: 30px;
    position: relative; /* For download button positioning */
}

.btn-download-report {
    position: absolute;
    top: 20px;
    right 
    padding: 8px 16px;
    background: var(--brand-main);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
    z-index: 10;
}

.btn-download-report:hover {
    background-color: #4a235a;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section h4 {
    color: var(--brand-main);
    font-size: 18px;
    margin-bottom: 15px;
    border-left: 4px solid var(--brand-main);
    padding-left: 10px;
}

.detail-section p {
    color: var(--text-main);
    line-height: 1.8;
    opacity: 0.9;
}

.detail-section ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    list-style: none;
    padding: 0;
}

.detail-section li {
    background: #f8fafc;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-main);
    border-left: 2px solid var(--brand-secondary);
}

.detail-section.strengths li {
    border-left-color: #10B981; /* Green */
}

.detail-section.weaknesses li {
    border-left-color: #EF4444; /* Red */
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .test-card-container {
        padding: 24px;
    }
    
    .result-type {
        font-size: 36px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

@media print {
    /* Hide non-printable areas */
    .header, .footer, .test-intro, .test-quiz, .result-actions, .btn-download-report {
        display: none !important;
    }
    
    .test-container {
        padding: 0;
        background: white;
    }
    
    .test-card-container {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
    
    .test-result {
        display: block !important; /* Ensure result is shown */
    }
    
    .dimension-charts, .result-desc, .result-details-container {
        display: block !important;
    }
    
    /* Ensure colors are printed */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    /* Layout adjustments for print */
    .result-type {
        font-size: 36px;
    }
    
    .chart-grid-bg .grid-col {
        opacity: 0.6 !important; /* Force opacity in print */
    }
    
    .chart-label-box.active span {
        background-color: #5B2C6F !important;
        color: white !important;
    }
    
    .chart-bar {
        background-color: #5B2C6F !important;
    }
    
    /* Prevent page breaks inside charts/lists */
    .mbti-chart-container, .sub-dim-group, .detail-section {
        page-break-inside: avoid;
    }
}
