/* MBTI 八維認知功能檢測樣式 */

/* 容器 */
.mbti-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    font-family: 'Microsoft JhengHei', 'PingFang TC', sans-serif;
}

/* 標題區 */
.mbti-header {
    text-align: center;
    margin-bottom: 30px;
}

.mbti-header h1 {
    font-size: 2.5rem;
    color: #2d6a4f;
    margin-bottom: 10px;
}

.mbti-header .subtitle {
    font-size: 1.1rem;
    color: #666;
}

/* 語言選擇 */
.lang-selector {
    text-align: center;
    margin-bottom: 20px;
}

.lang-selector select {
    padding: 10px 20px;
    border: 2px solid #52b788;
    border-radius: 10px;
    font-size: 1rem;
    background: #fff;
    color: #333;
    cursor: pointer;
}

/* 進度條 */
.progress-bar-container {
    background: #e9ecef;
    border-radius: 12px;
    height: 12px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #40916c, #52b788);
    border-radius: 12px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #666;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

/* 問題卡片 */
.question-card {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-number {
    color: #52b788;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.question-text {
    font-size: 1.15rem;
    color: #1f2937;
    line-height: 1.7;
    margin-bottom: 20px;
}

/* 李克特量表 */
.likert-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.likert-label {
    font-size: 0.8rem;
    color: #888;
    min-width: 60px;
    text-align: center;
}

.likert-label:first-child { text-align: left; }
.likert-label:last-child { text-align: right; }

.likert-options {
    display: flex;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.likert-option {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.2s ease;
}

.likert-option:hover {
    border-color: #52b788;
    color: #52b788;
}

.likert-option.selected {
    background: #52b788;
    border-color: #52b788;
    color: #fff;
}

/* 導航按鈕 */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 15px;
}

.btn-nav {
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-prev {
    background: #e9ecef;
    color: #495057;
}

.btn-prev:hover { background: #dee2e6; }

.btn-next, .btn-submit {
    background: linear-gradient(135deg, #40916c, #52b788);
    color: #fff;
    flex: 1;
}

.btn-next:hover, .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(82, 183, 136, 0.3);
}

.btn-next:disabled, .btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 結果頁面 ===== */

.result-container {
    animation: fadeIn 0.6s ease;
}

/* 類型標題卡 */
.type-card {
    background: linear-gradient(135deg, #40916c 0%, #2d6a4f 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    color: #fff;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(64, 145, 108, 0.25);
}

.type-letters {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 8px;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.type-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
    opacity: 0.95;
}

.type-summary {
    font-size: 1.1rem;
    opacity: 0.85;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* 雷達圖（Canvas） */
.radar-section {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.radar-section h2 {
    color: #2d6a4f;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

#radar-chart {
    max-width: 100%;
    margin: 0 auto;
}

/* 功能棧 */
.stack-section {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.stack-section h2 {
    color: #2d6a4f;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.stack-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stack-item {
    padding: 15px 20px;
    border-radius: 12px;
    background: #f0fdf4;
    border-left: 4px solid #52b788;
}

.stack-position {
    font-size: 0.85rem;
    color: #52b788;
    font-weight: 600;
    margin-bottom: 4px;
}

.stack-function {
    font-size: 1.1rem;
    color: #1f2937;
    font-weight: 500;
}

/* 功能詳情列表 */
.functions-section {
    margin-bottom: 30px;
}

.functions-section h2 {
    color: #2d6a4f;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.function-card {
    background: #fff;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

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

.function-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d6a4f;
}

.function-score {
    font-size: 1.2rem;
    font-weight: 700;
    color: #52b788;
}

.function-bar-bg {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: hidden;
}

.function-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #40916c, #52b788);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.function-short {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 8px;
}

.function-detail {
    font-size: 0.9rem;
    color: #888;
    line-height: 1.6;
    display: none;
}

.function-detail.expanded {
    display: block;
}

.btn-expand {
    border: none;
    background: none;
    color: #52b788;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 0;
}

.btn-expand:hover {
    text-decoration: underline;
}

/* 重新測試按鈕 */
.btn-retest {
    display: block;
    margin: 30px auto;
    padding: 16px 40px;
    background: linear-gradient(135deg, #40916c, #52b788);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-retest:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(82, 183, 136, 0.3);
}

/* 配額提示 */
.mbti-quota-info {
    text-align: center;
    margin-top: 20px;
    color: #888;
    font-size: 0.9rem;
}

/* 加載中 */
.mbti-loading {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.mbti-loading.active {
    display: flex;
}

.mbti-loading-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

.mbti-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #52b788;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
}

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

/* 歷史記錄 */
.history-container {
    animation: fadeIn 0.4s ease;
}

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

.history-header h2 {
    color: #2d6a4f;
    font-size: 1.5rem;
}

.btn-back-test, .btn-back-list {
    padding: 10px 24px;
    background: #e9ecef;
    color: #495057;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-back-test:hover, .btn-back-list:hover {
    background: #dee2e6;
}

.btn-back-list {
    margin-bottom: 20px;
}

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

.history-card {
    background: #fff;
    border-radius: 14px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-card:hover {
    box-shadow: 0 6px 20px rgba(82, 183, 136, 0.2);
    border-color: #52b788;
}

.history-type {
    font-size: 2rem;
    font-weight: 800;
    color: #2d6a4f;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.history-date {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 12px;
}

.btn-history-view {
    padding: 6px 18px;
    background: linear-gradient(135deg, #40916c, #52b788);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

/* 響應式 */
@media (max-width: 600px) {
    .mbti-header h1 { font-size: 1.8rem; }
    .type-letters { font-size: 3rem; letter-spacing: 4px; }
    .likert-options { gap: 6px; }
    .likert-option { width: 38px; height: 38px; font-size: 0.9rem; }
    .likert-label { font-size: 0.7rem; min-width: 40px; }
    .question-card { padding: 20px; }
    .stack-list { grid-template-columns: 1fr 1fr; }
    .history-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
