/* --- App Layout --- */
#app-container {
    display: flex;
}

#sidebar {
    width: 240px;
    background-color: var(--color-neutral-bg-subtle);
    color: var(--color-neutral-text-primary);
    padding: 20px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    border-right: 1px solid var(--color-neutral-border-light);
}

.sidebar-header h2 {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: left;
    margin-bottom: 24px;
    color: var(--color-primary-dark);
}

#lesson-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#lesson-list .lesson-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    border: 1px solid transparent;
    color: var(--color-neutral-text-secondary);
}

#lesson-list .lesson-item:hover {
    background-color: var(--color-primary-bg-active);
    color: var(--color-primary-dark);
}

#lesson-list .lesson-item.active {
    background-color: transparent;
    color: var(--color-primary-interactive);
    font-weight: 700;
    border-color: transparent;
}

#main-content {
    margin-left: 240px;
    /* padding: 30px 4vw; */ /* Moved to lesson-container */
    width: calc(100% - 240px);
}

#lesson-container {
    padding: 30px 15vw; /* Apply consistent padding here */
}

/* Remove padding from body as it's now handled by main-content */
body {
    padding-left: 0;
    padding-right: 0;
    line-height: 2;
}

/* --- 整體與排版 --- */
:root {
    /* Primary Blue */
    --color-primary-interactive: #1565c0;
    --color-primary-dark: #0056b3;
    --color-primary-text-on-light: #004085;
    --color-primary-bg-light: #e7f1ff;
    --color-primary-bg-active: #cfe2ff;
    /* Neutral Gray */
    --color-neutral-text-primary: #343a40;
    --color-neutral-text-secondary: #6c757d;
    --color-neutral-text-muted: #495057;
    --color-neutral-bg-body: #f8f9fa;
    --color-neutral-bg-subtle: #e9ecef;
    --color-neutral-border-strong: #ced4da;
    --color-neutral-border-light: #dee2e6;
    --color-neutral-disabled-bg: #e9ecef;
    --color-white: #ffffff;
    /* Success */
    --color-success-main: #28a745;
    --color-success-text: #28a745;
    --color-success-bg: #d4edda;
    --color-success-border: #c3e6cb;
    /* Error */
    --color-error-main: #dc3545;
    --color-error-text: #dc3545;
    --color-error-bg: #f8d7da;
    --color-error-border: #f5c6cb;
    /* Warning */
    --color-warning-main: #ffc107;
    --color-warning-text: #856404;
    --color-warning-bg: #fffcf2;
    --color-warning-border: #ffecb5;
    /* Info */
    --color-info-text: #004085;
    --color-info-bg: #cce5ff;
    --color-info-border: #b8daff;
    /* Layout/Radius/Shadow/Spacing */
    --border-radius: 6px;
    --shadow-card: 0 2px 8px rgba(0,0,0,0.07);
    --shadow-btn: 0 2px 4px rgba(0,0,0,0.10);
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
}

/* --- Lesson Selector --- */
#lesson-selector-container {
    text-align: center;
    margin-bottom: 24px;
    padding: 12px;
    background-color: var(--color-neutral-bg-subtle);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-neutral-border-light);
}

#lesson-selector-container label {
    margin-right: 12px;
    font-weight: 500;
    color: var(--color-neutral-text-secondary);
}

#lesson-selector-container select {
    padding: 8px 12px;
    border: 1px solid var(--color-neutral-border-strong);
    border-radius: var(--border-radius);
    background-color: var(--color-white);
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    min-width: 300px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#lesson-selector-container select:hover {
    border-color: var(--color-primary-interactive);
}

#lesson-selector-container select:focus {
    outline: none;
    border-color: var(--color-primary-interactive);
    box-shadow: 0 0 0 3px var(--color-primary-bg-active);
}

/* 字體層次設定 */
html, body, p, details .toggle-content, .vocabulary-card .toggle-content, .tooltip .tooltiptext {
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', Arial, sans-serif;
}

h1, h2, h3, .lesson-title, .base-header, .section-header, .concept-header, .subsection-header {
    font-family: 'M PLUS Rounded 1c', 'Noto Sans TC', Arial, sans-serif;
}

h1, .lesson-title {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    letter-spacing: .01em;
}
h2.base-header, .section-header, .concept-header {
    font-size: 1.7rem;
    font-weight: 600;
    letter-spacing: .01em;
}
.tabs-container, .tab-button, .concept1-tab-btn, .concept2-tab-btn, .concept3-tab-btn {
    font-weight: 600;
    font-size: 1.08em;
}
.subsection-header {
    font-size: 1.3em;
    font-weight: 600;
}
p, ul, ol, label, .feedback, .learning-objectives-table, .interactive-board, .block-selection-quiz, .matching-quiz, .example-content, .tutorial-content, .text-with-dropdown {
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: .03em;
}
/* 詳解/詞彙卡/tooltip 用 Serif */
details .toggle-content, .vocabulary-card .toggle-content, .tooltip .tooltiptext {
    font-size: 0.98rem;
    font-weight: 400;
    letter-spacing: .01em;
}
.tooltip .tooltiptext {
    font-size: 0.9rem;
}
/* 按鈕字體 */
button, .button-like, .option-button, .quiz-option, .example-option, .behavior-option {
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', Arial, sans-serif;
    font-weight: 500;
    letter-spacing: .01em;
}
button, .button-like {
    font-size: 1rem;
}
/* Pro Tip/關鍵問句/芫荽點綴 */
.pro-tip, .pro-tip li, .key-question, .iansui-span {
    font-family: 'Iansui', 'Noto Sans TC', sans-serif;
    font-size: 1.08em;
    letter-spacing: .02em;
}
/* 等寬字體 */
code, pre, .math-mono, .feedback code, .feedback pre {
    font-family: 'Noto Sans Mono', 'Noto Sans TC', monospace;
    font-size: 0.98em;
}
/* 強調/小字註解 */
.note, .annotation, .small, .tooltip .tooltiptext {
    font-size: 0.9rem;
}
/* 其他細節可依需求再微調 */

/* --- 標題樣式 --- */
.lesson-title {
    text-align: left;
    font-weight: bold;
    font-size: 2.2em;
    margin-bottom: 40px;
    padding-bottom: 10px;
    position: relative;
}

.lesson-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 4px;
    background-color: var(--color-primary-dark);
    border-radius: 2px;
}

/* **優化:** 基礎標頭樣式 */
.base-header {
    font-weight: 600; /* Semi-bold */
    color: var(--color-neutral-text-primary); /* Darker text */
    margin-top: 40px; /* Increase top margin for separation */
    margin-bottom: 20px;
    font-size: 1.7em;
    text-align: left;
    position: relative;
    background-color: transparent;
    border-radius: 2px;
}

.base-header::before {
    content: '';
    position: absolute;
    left: -16px; /* Position to the left of the text block */
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background-color: var(--color-primary-dark);
    border-radius: 2px;
}

/* .section-header, .concept-header 現在繼承 .base-header */

.subsection-header {
    font-weight: bold;
    padding: 8px 0;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.3em;
    color: #1d3557;
    text-align: left;
    border-bottom: 2px solid var(--color-neutral-border-light);
}
/* 讓「我學會了」按鈕與小標題同一行 */
.subsection-header + .c1-learned-btn {
    display: inline-block;
    margin-left: 18px;
    vertical-align: middle;
}

/* --- 學習目標表格 --- */
.learning-objectives-table {
    width: auto;
    border-collapse: collapse;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
}

.learning-objectives-table th,
.learning-objectives-table td {
    border: 1px solid #dee2e6;
    padding: 12px 15px;
    text-align: left;
    vertical-align: top;
}

.learning-objectives-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #495057;
}
.learning-objectives-table td {
    background-color: white;
}

.learning-objectives-table input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
    width: 16px;
    height: 16px;
}
 .learning-objectives-table label {
    display: inline-block;
    margin-bottom: 5px;
    cursor: pointer;
    color: #495057;
}
 .learning-objectives-table input[type="checkbox"]:disabled + label {
     font-style: normal !important;
}

/* --- 互動元件通用樣式 --- */
.interactive-checkbox-group label {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}
.interactive-checkbox-group label:hover {
    background-color: #e9ecef;
}

.interactive-board {
    border: 1px solid #ced4da;
    padding: 20px;
    margin-bottom: 20px;
    background-color: #ffffff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    text-align: center;
}
.interactive-board p { margin-bottom: 12px; }
/* **優化:** 合併互動板塊內的輸入與選擇框樣式 */
.interactive-board input[type="number"],
.interactive-board select {
    width: 60px;
    margin: 0 8px;
    padding: 5px 8px;
    border: 1px solid #ced4da;
    border-radius: 3px;
}
.interactive-board button { margin: 8px 5px; }

/* --- Dropdown in text --- */

.text-with-dropdown button {
    display: block;
    margin-top: 15px;
}

/* **優化:** 合併填空題內的輸入與選擇框樣式 */
.text-with-dropdown select, .text-with-dropdown input[type="text"] {
    border: none;
    border-bottom: 2.5px solid #ced4da;
    border-radius: 0;
    background-color: #fff;
    min-width: 50px;
    padding: 4px 6px;
    margin: 0 5px;
    outline: none;
    transition: border-bottom-color 0.2s;
    appearance: auto;
    font-family: inherit;
    font-size: inherit;
}
.text-with-dropdown select:hover, .text-with-dropdown input[type="text"]:hover {
    border-bottom-color: #007bff;
}
.text-with-dropdown select.correct, .text-with-dropdown input[type="text"].correct {
    border-bottom-color: #28a745 !important;
}
.text-with-dropdown select.incorrect, .text-with-dropdown input[type="text"].incorrect {
    border-bottom-color: #dc3545 !important;
}

.text-with-dropdown select:disabled {
    color: inherit;
    opacity: 1; /* 確保文字清晰可見 */
}

/* --- 按鈕樣式 --- */
button, .button-like {
    display: inline-block;
    padding: 10px 18px;
    margin: 5px 5px 10px 0;
    cursor: pointer;
    border: none;
    background-color: var(--color-primary-interactive);
    color: var(--color-white);
    border-radius: 4px;
    text-align: center;
    vertical-align: middle;
    font-weight: bold;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.15s cubic-bezier(.34,1.56,.64,1);
}
button:hover, .button-like:hover {
    background-color: var(--color-primary-dark);
}
button:disabled, .button-like.disabled {
    cursor: not-allowed;
    background-color: var(--color-neutral-disabled-bg);
    color: var(--color-neutral-text-secondary);
    border-color: var(--color-neutral-border-strong);
}
/* **優化:** 特定按鈕微調 (選項按鈕) - 基礎樣式 */
.option-button { /* 取代 .quiz-option, .example-option, .behavior-option 的共同部分 */
    background-color: var(--color-white); /* 白色底 */
    color: var(--color-neutral-text-primary); /* 黑色字 */
    border: 1px solid var(--color-neutral-border-strong); /* 灰色邊框 */
    font-weight: normal;
    box-shadow: none;
    transition: background 0.18s, color 0.18s, border-bottom 0.18s, transform 0.15s cubic-bezier(.34,1.56,.64,1);
}
/* **優化:** 選項按鈕懸停 */
.option-button:hover {
    background-color: var(--color-neutral-bg-subtle); /* 懸停淡灰 */
    box-shadow: none;
}
/* **優化:** 選項按鈕選中 */
.option-button.selected {
    background-color: var(--color-primary-interactive); /* 選中變藍底 */
    color: var(--color-white); /* 白字 */
    border-color: var(--color-primary-dark); /* 深藍邊框 */
}
/* 特定功能按鈕顏色 */
button[onclick^="showQuiz"] {
    background-color: var(--color-success-main);
    color: var(--color-white);
}
button[onclick^="showQuiz"]:hover {
    background-color: #218838;
}
/* Check 按鈕黃白樣式 */
button[onclick^="check"] {
    background-color: var(--color-white); /* 白色背景 */
    color: var(--color-warning-main); /* 黃色文字 */
    border: 1.5px solid var(--color-warning-main); /* 黃色邊框 */
}
button[onclick^="check"]:hover {
    color: var(--color-warning-main); /* 懸停時黃色文字 */
    border-color: var(--color-warning-main); /* 懸停時邊框保持黃色 */
    background-color: var(--color-warning-bg); /* 懸停時淡黃色背景 */
}


/* --- 配對題樣式 --- */
.matching-quiz {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
}
.matching-quiz .column {
    width: 48%;
}
.matching-quiz ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.matching-quiz li {
    border: 1px solid #ced4da;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    background-color: white;
    border-radius: 4px;
    transition: all 0.2s ease;
}
.matching-quiz li:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}
.matching-quiz li.selected {
    background-color: #cfe2ff;
    border-color: #0d6efd;
}
.matching-quiz li.matched {
    opacity: 0.7;
    cursor: default;
    background-color: #ced4da ;
}
@keyframes flash-red {
    0% { background-color: #f8d7da; }
    100% { background-color: white; }
}
/* 反饋訊息樣式 */
.feedback {
    margin-top: 12px;
    padding: 8px 0; /* Adjusted for text-only feedback */
    font-weight: bold;
    font-size: 0.95em;
    background-color: transparent;
    border: none;
}
.feedback:empty {
    display: none;
}
.feedback.correct {
    color: var(--color-success-text);
    background-color: transparent;
    border-color: transparent;
}
.feedback.correct.solution-display {
    background-color: transparent;
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
    color: var(--color-neutral-text-primary);
    font-weight: normal;
}
.feedback.incorrect {
    color: var(--color-error-text);
    background-color: transparent;
    border-color: transparent;
}
.feedback.info {
    color: var(--color-info-text);
    background-color: transparent;
    border-color: transparent;
}

/* --- 教學步驟樣式 (Cumulative Display) --- */
.tutorial-content .step {
    padding: 15px;
    margin-bottom: 10px;
    background-color: var(--color-white);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid #E0E0E0; /* Subtle grey border */
    overflow: hidden;
    /* clip-path 動畫初始狀態：由左至右展開 */
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1s cubic-bezier(.34,1.56,.64,1);
}
.tutorial-content .step.step-animate-in {
    clip-path: inset(0 0 0 0);
}
.tutorial-content .step.step-animate-out {
    clip-path: inset(0 100% 0 0);
}
.tutorial-content p:last-child {
     margin-bottom: 0; /* Adjusted from margin-top */
}
.tutorial-content > div:last-of-type { /* Selects the div containing buttons */
    margin-top: 15px;
}


/* --- Toggle List (詳解/詞彙卡) --- */
details {
    border: none;
    border-radius: 0;
    margin-bottom: 15px;
    background-color: transparent;
    overflow: visible;
}
summary {
    font-weight: bold;
    cursor: pointer;
    padding: 12px 15px 12px 35px;
    background-color: transparent;
    border-bottom: none;
    list-style: none;
    position: relative;
    color: #495057;
    transition: color 0.2s;
}
summary:hover {
    background-color: transparent;
    color: var(--color-primary-dark);
}
summary::-webkit-details-marker { display: none; }
summary::before {
    content: '▶ ';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary-interactive);
    font-size: 0.8em;
    transition: transform 0.2s, color 0.2s;
}
details[open] summary {
     background-color: transparent;
     color: var(--color-primary-dark);
     border-bottom: none;
}
details[open] summary::before {
    transform: translateY(-50%) rotate(90deg);
}
summary:hover::before {
    transform: translateY(-50%) scale(1.3);
    color: var(--color-primary-dark);
}
details[open] summary:hover::before {
    transform: translateY(-50%) rotate(90deg) scale(1.3);
}
.toggle-content {
     padding: 10px 15px 10px 25px;
     border-top: none;
     margin-left: 17px;
     border-left: 2px solid var(--color-neutral-border-light);
}

/* --- Pro Tip List --- */
 .pro-tip ul {
    list-style: none;
    padding-left: 0;
    margin-top: 10px;
}
 .pro-tip li {
    margin-bottom: 10px;
    padding-left: 40px;
    position: relative;
    padding-top: 5px;
    padding-bottom: 5px; /* Added for better spacing */
    padding-right: 10px;
}
 .pro-tip li::before {
    content: '⚡';
    position: absolute;
    left: 10px;
    top: 0.9em; /* Adjusted slightly for potentially taller lines */
    transform: translateY(-50%);
    color: var(--color-warning-main);
    font-size: 1.2em;
}

/* --- 箭頭按鈕 --- */
 .arrow-button {
     font-size: 1.8em;
     cursor: pointer;
     padding: 0 12px;
     user-select: none;
     color: var(--color-primary-interactive);
     vertical-align: middle;
     transition: color 0.2s;
}
.arrow-button:hover { color: var(--color-primary-dark); }
.arrow-button.disabled {
     color: #ced4da;
     cursor: not-allowed;
}
 /* **優化:** 使用類別選擇器 */
 .step-counter {
     font-weight: bold;
     vertical-align: middle;
     margin: 0 10px;
     display: inline-block;
     background-color: #e9ecef;
     padding: 4px 10px;
     border-radius: 10px;
     font-size: 0.9em;
     min-width: 50px;
     text-align: center;
}

/* --- 拖放區樣式 --- */
.dropzone {
    border: 2px dashed #adb5bd;
    padding: 20px;
    margin: 10px 0;
    text-align: center;
    min-height: 60px;
    background-color: #f8f9fa;
    border-radius: 4px;
    transition: background-color 0.3s, border-color 0.3s;
}
.dropzone.dragover {
    background-color: #cfe2ff;
    border-color: #007bff;
}
.draggable-root {
    border: 1px solid #adb5bd;
    padding: 6px 12px;
    margin: 5px;
    display: inline-block;
    cursor: grab;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: opacity 0.2s, transform 0.15s cubic-bezier(.34,1.56,.64,1);
}
.draggable-root:active { cursor: grabbing; }
.draggable-root.dropped-anim {
    transform: rotate(3deg) scale(1.03);
}

/* --- 回饋訊息樣式 --- */
/* This section has been merged and moved up. */

/* --- Tooltip 樣式 --- */
.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted #0056b3;
    cursor: help;
    color: var(--color-primary-dark);
    font-weight: bold;
}
.tooltip .tooltiptext {
    visibility: hidden;
    width: 180px;
    background-color: var(--color-neutral-text-primary);
    color: var(--color-white);
    text-align: center;
    border-radius: 4px;
    padding: 8px;
    position: absolute;
    z-index: 10;
    bottom: 130%;
    left: 50%;
    margin-left: -90px;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 0.9em;
    font-weight: normal;
}
.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* --- 圖片樣式 --- */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 10px 0;
}

/* --- 其他微調 --- */
hr {
    border: none;
    border-top: 1px solid #dee2e6;
    margin: 25px 0;
}

/* --- Error Analysis (Spot the Error Quiz) 樣式 --- */
.spot-the-error-quiz {
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #ced4da;
}

.error-analysis-title {
    font-size: 1.25em;
    font-weight: bold;
    color: #222;
    margin-bottom: 4px;
    display: block;
    letter-spacing: 0.5px;
}

.error-analysis-desc {
    display: block;
    font-size: 1.05em;
    color: #222;
    margin-bottom: 12px;
    margin-left: 2px;
    font-weight: 400;
}

.spot-the-error-quiz button.spot-the-error-step {
    display: block;
    width: calc(100% - 24px);
    text-align: left;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid #ced4da;
    background-color: #fff;
    color: #222;
    font-weight: normal;
}

.spot-the-error-quiz button.spot-the-error-step:hover {
    background-color: #fff; /* 設為白色或 transparent */
    border-color: var(--color-primary-interactive); /* 改為藍色 */
    /* color: var(--color-primary-dark); 文字不用有hover效果 */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 選擇錯誤時的樣式 (維持不變) */
.spot-the-error-quiz button.spot-the-error-step.incorrect-selection {
    border-color: var(--color-error-main);    /* 紅色邊框 */
    color: var(--color-error-text);           /* 深紅色文字 */
}

/* 找到正確錯誤步驟時的樣式 (維持不變) */
.spot-the-error-quiz button.spot-the-error-step.correct-selection {
    border-color: var(--color-success-main);    /* 綠色邊框 */
    color: var(--color-success-text);           /* 深綠色文字 */
    cursor: default;           /* 不再可點擊 */
}

/* 錯誤解釋區塊樣式 */
.error-explanation {
    margin-top: 10px;
    padding: 8px 0; /* 與 .feedback 一致 */
    color: var(--color-error-text);
    display: none; /* Initially hidden */
    font-weight: bold;
}

.error-explanation.show {
    display: block;
    opacity: 1;
    max-height: 200px;
}

/* 修正 Matching Quiz 閃爍效果樣式 */
.incorrect-flash {
    animation: flash-red 0.5s ease;
}

/* 由上往下展開的動畫 */
@keyframes expandDown {
    from {
        opacity: 0;
        transform: scaleY(0);
        transform-origin: top;
    }
    to {
        opacity: 1;
        transform: scaleY(1);
        transform-origin: top;
    }
}

/* --- 通用 Concept Tabs 樣式 --- */
.tabs-container {
    display: flex;
    flex-wrap: nowrap; /* Prevent wrapping */
    overflow-x: auto; /* Allow horizontal scrolling */
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 5px; /* Space for scrollbar */
}

/* Custom scrollbar for tab container */
.tabs-container::-webkit-scrollbar {
    height: 8px; /* Increased thickness */
    background-color: transparent; /* Ensure no background color */
}
.tabs-container::-webkit-scrollbar-thumb {
    background-color: var(--color-neutral-text-secondary);
    border-radius: 10px;
}
.tabs-container::-webkit-scrollbar-track {
    background: transparent;
    margin: 0 -30px; /* Pull track to extend under the buttons */
}
/* Add decorative arrows to scrollbar */
.tabs-container::-webkit-scrollbar-button {
    display: block; /* Make them visible */
    width: 30px;
}
.tabs-container::-webkit-scrollbar-button:start:decrement,
.tabs-container::-webkit-scrollbar-button:end:increment {
    background-color: transparent;
    border: none;
    background-repeat: no-repeat;
    background-size: 15px;
    background-position: center;
}
/* Left Arrow SVG */
.tabs-container::-webkit-scrollbar-button:start:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3E%3Cpath d='M20,6 Q20,4 18,4 L6,11 Q4,12 6,13 L18,20 Q20,20 20,18 Z'/%3E%3C/svg%3E");
}
/* Right Arrow SVG */
.tabs-container::-webkit-scrollbar-button:end:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3E%3Cpath d='M4,6 Q4,4 6,4 L18,11 Q20,12 18,13 L6,20 Q4,20 4,18 Z'/%3E%3C/svg%3E");
}
.tabs-container::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-neutral-text-primary);
}
.tab-button {
    padding: 12px 20px 10px 20px;
    background: var(--color-primary-bg-light);
    color: var(--color-primary-dark);
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-bottom: 2.5px solid transparent;
    transition: background 0.18s, color 0.18s, border-bottom 0.18s, transform 0.18s;
    flex-shrink: 0; /* Prevents shrinking */
    display: flex;
    align-items: center;
    gap: 8px;
}
.tab-button:hover {
    background: var(--color-primary-bg-active);
    color: var(--color-primary-interactive);
    transform: scale(1.08); /* 新增放大效果 */
}
.tab-button.active {
    background-color: var(--color-primary-dark);
    color: var(--color-white);
    border-bottom-color: transparent;
}
.tab-content {
    padding: 20px;
    border: 1px solid var(--color-neutral-border-light);
    display: none; /* Hide by default */
    background-color: var(--color-white);
    border-radius: var(--border-radius); /* Apply radius to all corners */
}
.tab-content.active {
    display: block;
    animation: expandDown 0.35s ease-out;
}

/* --- 進度條樣式 --- */
.progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    margin: 20px 0 40px 0;
    padding: 0;
    position: relative;
}
.progress-bar::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 18px;
    right: 18px;
    height: 2px;
    background-color: var(--color-primary-bg-light);
    z-index: 1;
}
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    flex: 1;
}
.progress-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-white);
    border: 2px solid var(--color-primary-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--color-neutral-text-secondary);
    font-size: 0.9em;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    z-index: 2;
    opacity: 0.7;
}
/* 未解鎖狀態 */
.progress-circle.locked {
    background-color: var(--color-white);
    border-color: var(--color-primary-bg-light);
    color: var(--color-neutral-text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}
/* 進行中狀態 */
.progress-circle.active {
    background-color: var(--color-primary-bg-light);
    border-color: var(--color-primary-dark);
    color: var(--color-primary-dark);
    cursor: pointer;
    opacity: 1;
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.1);
}

/* 保留 pop 動畫 */
@keyframes progressPop {
    0% { transform: scale(1); }
    30% { transform: scale(1.12); }
    60% { transform: scale(0.97); }
    100% { transform: scale(1); }
}
.progress-circle.pop-animate {
    animation: progressPop 0.45s cubic-bezier(.34,1.56,.64,1);
}

/* 已完成狀態 */
.progress-circle.completed {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: var(--color-white);
    cursor: pointer;
    opacity: 1;
}
/* Hover 效果 */
.progress-circle:not(.locked):hover {
    transform: translateY(-2px);
}
.progress-circle.active:hover {
    background-color: var(--color-primary-bg-active);
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.2);
}
.progress-circle.completed:hover {
    background-color: var(--color-primary-dark);
    box-shadow: 0 4px 8px rgba(0, 86, 179, 0.2);
}
.progress-label {
    font-size: 0.85em;
    color: var(--color-neutral-text-secondary);
    text-align: center;
    transition: all 0.3s ease;
    white-space: nowrap;
}
.progress-circle:not(.locked):hover + .progress-label,
.progress-circle.active + .progress-label {
    color: var(--color-primary-dark);
    font-weight: 500;
}
.progress-circle.completed + .progress-label {
    color: var(--color-primary-dark);
}
.progress-line {
    position: absolute;
    top: 18px;
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
    height: 2px;
    background-color: var(--color-primary-bg-light);
    z-index: 1;
}
.progress-line.completed {
    background-color: var(--color-primary-dark);
}

/* --- Example Content --- */
.example-content {
    background-color: var(--color-white);
    padding: var(--space-lg); /* 24px */
    margin-bottom: var(--space-lg); /* 24px */
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-neutral-border-light);
}
.example-content:last-child {
    margin-bottom: 0;
}
.example-content > p:first-child {
    margin-top: 0;
}

/* --- Unit Objective Progress Bar --- */
.objective-progress-bar-container {
  display: flex;
  align-items: center;
  margin-top: 16px;
  margin-bottom: 4px;
}
.objective-progress-bar-bg {
  flex: 1;
  height: 8px;
  background: #e3eaf3;
  border-radius: 6px;
  overflow: hidden;
  margin-right: 10px;
}
.objective-progress-bar-fill {
  height: 100%;
  background: #2196f3;
  border-radius: 6px 0 0 6px;
  transition: width 0.3s;
}
.objective-progress-percent {
  font-weight: bold;
  color: var(--color-primary-dark);
  min-width: 36px;
  text-align: right;
}

/* === Learning Map 卡片樣式（每行兩張卡片，灰底灰框） === */
.objectives-card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.objective-card {
  background: #fff;
  border: 1.5px solid #cccccc;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 20px;
  width: calc(50% - 12px);
  min-width: 320px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 220px;
}

.objective-card-footer {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

/* === Objectives details 內容左線條與對齊（精簡覆蓋） === */
.objective-card summary {
  color: var(--color-primary-dark);
}

.objective-card details > *:not(summary) {
  padding-left: 25px;
  border-left: none;
  margin-top: 8px;
  margin-left: 0;
}

.objective-card label {
  display: block;
  margin-bottom: 4px;
  margin-left: 0;
}