/* --- 基礎設定與字體 --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;700&display=swap');

:root {
    --color-newmain: #007AB0; /* 專業藍色 */
    --color-newsecondary: #0056b3; 
    --color-text-dark: #333333; /* 更深沈的文字色 */
    --color-bg-light: #f4f7f9; /* 輕微藍調的背景色 */
    --color-bg-white: #ffffff;
    --shadow-base: 0 4px 12px rgba(0, 0, 0, 0.08); /* 專業度提升: 陰影更深邃 */
    --color-blue: #007AB0;
    --color-red: #dc3545;
    --color-orange: #ffc107;
    --color-alert-bg: #fff3cd; 
    --color-alert-border: #ffc107;
    --color-alert-text: #856404; 
}

/* --- 頁首 --- */
.system-header {
    background-color: var(--color-newmain);
    color: white;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.system-header h1 { font-size: 2em; margin-bottom: 5px; }

/* --- 容器 --- */
.main-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 25px;
}

/* **修正閃爍問題：Tab 內容預設隱藏** */
.tab-content {
    display: none; 
    transition: opacity 0.3s ease-in-out;
}
/* JS 載入後，只有 active 的 Tab 顯示 */
.tab-content.active {
    display: block; 
}

.tab-content-wrapper {
    padding: 30px 0;
}

.section-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--color-newsecondary);
    margin-bottom: 30px;
    border-left: 6px solid var(--color-newmain);
    padding-left: 15px;
}

/* --- 區域導航列 (Tab Bar) --- */
.tab-navigation {
    display: flex;
    justify-content: center;
    border-bottom: 2px solid #e0e0e0;
    margin-top: 25px;
    background-color: var(--color-bg-white);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tab-button {
    background-color: transparent;
    border: none;
    padding: 15px 35px;
    font-size: 1.1em;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab-button:hover {
    color: var(--color-newmain);
    background-color: #f8f9fa;
}

.tab-button.active {
    color: var(--color-newmain);
    border-bottom: 3px solid var(--color-newmain);
    background-color: var(--color-bg-light);
    font-weight: 700;
}

/* --- 階層收合區塊 (Accordion Group) --- */
.accordion-group {
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background-color: var(--color-bg-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* 移除 details 預設箭頭 */
.accordion-group > summary {
    list-style: none;
    outline: none;
}
.accordion-group > summary::-webkit-details-marker {
    display: none;
}

/* 專業標題 (Summary) */
.accordion-title {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--color-text-dark);
    padding: 18px 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    background-color: #fcfcfc;
    border-bottom: 1px solid transparent;
}

.accordion-group[open] > .accordion-title {
    border-bottom: 1px solid #e0e0e0;
}

.accordion-title:hover {
    background-color: #f7f7f7;
}

/* 展開/收合箭頭 */
.accordion-title::after {
    content: '\f054'; /* Font Awesome 右箭頭 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 25px;
    font-size: 0.7em;
    color: #999;
    transition: transform 0.3s;
}

/* 展開狀態的箭頭旋轉 */
.accordion-group[open] > .accordion-title::after {
    transform: rotate(90deg);
}

.accordion-title i {
    font-size: 1.8em;
}

.icon-blue { color: var(--color-blue); }
.icon-red { color: var(--color-red); }
.icon-orange { color: var(--color-orange); }

.accordion-content {
    padding: 25px;
    padding-top: 15px;
}

/* --- 提示訊息區塊 --- */
.alert-box {
    background-color: var(--color-alert-bg);
    border: 1px solid var(--color-alert-border);
    padding: 15px 20px;
    margin-bottom: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    color: #e1264a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.alert-box i {
    font-size: 1.6em;
    margin-right: 15px;
    color: var(--color-alert-border);
}

.alert-box p {
    margin: 0;
    font-size: 1.3em;
}


/* --- 模組卡片網格 (Grid) --- */
.module-grid {
    display: grid;
    gap: 20px;
    
    /* **** 核心修正: 限制卡片網格的寬度並居中 **** */
    max-width: 1000px; /* 限制最大寬度，避免卡片過度延伸 */
    margin: 0 auto;    /* 居中對齊 */
}

.module-grid.four-col {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.module-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    max-width: 750px; /* 交易績效區塊卡片較少，限制更窄 */
}
.module-grid.three-col {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    max-width: 1000px; /* 理財工具箱，三欄適中寬度 */
}
.module-grid.one-col {
    grid-template-columns: 1fr;
    max-width: 500px; /* 人力資本家，單欄更窄 */
    margin: 0 auto;
}

.module-card-placeholder {
    visibility: hidden; 
    display: none; 
}

/* 基礎卡片樣式 */
.module-card {
    background-color: var(--color-bg-white);
    padding: 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text-dark);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-base);
    border-color: var(--color-newmain);
}

.module-card i {
    font-size: 2em;
    color: var(--color-newmain);
    margin-bottom: 10px;
}

.module-card h4 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0;
}

/* --- RWD：手機版適應 --- */
@media (min-width: 769px) {
    .module-card-placeholder {
        display: block; 
    }
}

@media (max-width: 768px) {
    /* **RWD 修正：手機上取消寬度限制，讓卡片填滿螢幕** */
    .module-grid {
        max-width: 100%; /* 恢復 100% 寬度 */
        margin: 0;
    }
    
    .module-grid.two-col, 
    .module-grid.three-col,
    .module-grid.four-col,
    .module-grid.one-col {
        grid-template-columns: 1fr; 
        max-width: 100%; /* 確保所有網格都變成單欄並佔滿空間 */
    }

    /* ... (其他 RWD 樣式保持不變) ... */

    .tab-navigation {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 5px;
    }

    .tab-button {
        flex-shrink: 0;
        padding: 10px 15px;
        font-size: 1em;
    }
    .tab-button i {
        display: none;
    }

    .section-title {
        font-size: 1.4em;
        margin-bottom: 20px;
    }
    
    .module-card-placeholder {
        display: none;
    }

    .alert-box {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    .alert-box i {
        margin: 0 0 10px 0;
    }
    
    .accordion-title {
        font-size: 1.2em;
    }

    .accordion-title::after {
        right: 15px;
    }
}