@charset "UTF-8";

/* ========================================= */
/* 1. 引入字體與圖標                         */
/* ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600&family=Noto+Serif+TC:wght@400;600;700&family=Noto+Sans+TC:wght@300;400;500&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* ========================================= */
/* 2. 核心變數與全域重置                     */
/* ========================================= */
:root {
    --primary-dark: #1a252f;
    --accent-gold: #c5a059;
    --bg-light: #f9f9f9;
    --text-grey: #555555;
    --font-main: "微軟正黑體", 'Noto Sans TC', sans-serif;
    --font-serif: 'Noto Serif TC', serif;
    --font-en: 'Montserrat', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: var(--font-main); 
    line-height: 1.7; 
    color: var(--text-grey); 
    background-color: var(--bg-light); 
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--primary-dark); font-weight: 700; }

/* ========================================= */
/* 3. 版面結構 (Layout)                      */
/* ========================================= */
#page-container {
    position: relative; width: 100%; 
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    background-color: var(--bg-light); z-index: 2; 
    box-shadow: -5px 0 20px rgba(0,0,0,0.05);
    min-height: 100vh; display: flex; flex-direction: column;
}
body.menu-open #page-container { transform: translateX(-280px); }

.overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26, 37, 47, 0.6); opacity: 0; visibility: hidden; 
    transition: 0.4s; z-index: 998; backdrop-filter: blur(2px);
}
body.menu-open .overlay { opacity: 1; visibility: visible; }

/* ========================================= */
/* 4. 頁首與導覽列 (Header & Nav)            */
/* ========================================= */
.top-bar {
    background-color: var(--primary-dark); color: white; padding: 12px 8%;
    display: flex; justify-content: space-between; align-items: center;
    font-family: var(--font-en); font-size: 0.85em; letter-spacing: 1.5px;
}
.slogan { color: #bdc3c7; text-transform: uppercase; font-weight: 400; }
.btn-join-main {
    background-color: var(--accent-gold); color: white; padding: 6px 20px; 
    border-radius: 50px; font-weight: 500; font-size: 0.9em; letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(197, 160, 89, 0.3);
}
.btn-join-main:hover { background-color: #b08d4a; transform: translateY(-2px); }

header {
    background-color: #ffffff; padding: 0 8%; height: 90px;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
}

.logo a { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 50px; height: 50px; object-fit: contain; border-radius: 5px; }
.logo-text { font-family: var(--font-serif); font-size: 1.4em; color: var(--primary-dark); letter-spacing: 1px; }

.desktop-menu { display: flex; gap: 40px; }
.menu-item { position: relative; overflow: hidden; height: 50px; display: flex; align-items: center; }
.menu-link { display: block; font-weight: 500; color: var(--primary-dark); transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); height: 30px; line-height: 30px; }
.menu-link span.zh { display: block; height: 30px; }
.menu-link span.en { display: block; font-family: var(--font-en); font-size: 0.75em; letter-spacing: 1px; color: var(--accent-gold); text-transform: uppercase; text-align: center; height: 30px; padding-top: 5px; }
.menu-item:hover .menu-link { transform: translateY(-35px); }
.hamburger { display: none; font-size: 1.6em; cursor: pointer; color: var(--primary-dark); }

#mobile-menu {
    position: fixed; top: 0; right: 0; width: 280px; height: 100vh;
    background-color: var(--primary-dark); padding-top: 80px; z-index: 2001; 
    transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
}
body.menu-open #mobile-menu { transform: translateX(0); }
#mobile-menu a { display: block; padding: 20px 30px; color: rgba(255,255,255,0.8); font-family: var(--font-main); font-weight: 500; font-size: 1.1em; border-bottom: 1px solid rgba(255,255,255,0.05); }
#mobile-menu a:hover { color: var(--accent-gold); padding-left: 35px; background: rgba(0,0,0,0.2); }
.btn-close { position: absolute; top: 20px; right: 25px; color: white; font-size: 1.5em; cursor: pointer; opacity: 0.7; }

@media (max-width: 900px) {
    .top-bar { flex-direction: column; gap: 10px; text-align: center; padding: 10px 5%; }
    header { padding: 0 5%; height: 70px; }
    .desktop-menu { display: none; }
    .hamburger { display: block; }
}

/* ========================================= */
/* 5. 首頁元件 (Index Components)            */
/* ========================================= */
.slider-container { position: relative; width: 100%; height: 550px; overflow: hidden; }
@media (max-width: 768px) { .slider-container { height: 400px; } }
.slide {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; transition: opacity 1.2s ease; transform: scale(1.05);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; color: white;
    background-size: cover; background-position: center;
}
.slide.active { opacity: 1; z-index: 1; transform: scale(1); transition: opacity 1s, transform 6s; }
.slide::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to bottom, rgba(26,37,47,0.3), rgba(26,37,47,0.7)); z-index: -1; }
.slide-content h2 { font-size: 3.5em; margin-bottom: 10px; font-weight: 700; color: white; letter-spacing: 2px; text-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.slide-content p { font-family: var(--font-en); font-size: 1.2em; letter-spacing: 3px; margin-bottom: 40px; text-transform: uppercase; color: rgba(255,255,255,0.9); }
@media (max-width: 768px) { .slide-content h2 { font-size: 2em; } .slide-content p { font-size: 0.9em; } }
.slide-btn { padding: 12px 35px; background: transparent; border: 1px solid rgba(255,255,255,0.6); color: white; font-family: var(--font-en); letter-spacing: 2px; font-size: 0.9em; transition: 0.3s; }
.slide-btn:hover { background: var(--accent-gold); border-color: var(--accent-gold); color: white; }
.slider-nav { position: absolute; bottom: 30px; right: 8%; z-index: 10; display: flex; gap: 10px; }
.nav-btn { background: transparent; border: 1px solid rgba(255,255,255,0.4); color: white; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; transition: 0.3s; }
.nav-btn:hover { background: white; color: var(--primary-dark); }

/* --- 分頁籤樣式 --- */
.course-tabs-container {
    text-align: center; margin: 60px 0 30px; 
}
.course-tab-btn {
    background: transparent; border: none; font-size: 1.8em; font-weight: 700;
    color: #ccc; margin: 0 20px; cursor: pointer; transition: 0.3s;
    font-family: var(--font-serif); padding-bottom: 10px;
    border-bottom: 4px solid transparent;
    display: inline-block; text-align: center;
}
.course-tab-btn span {
    display: block; font-size: 0.45em; font-family: var(--font-en); 
    font-weight: 400; letter-spacing: 2px; margin-top: 5px; color: #999;
}
.course-tab-btn:hover { color: var(--primary-dark); }
.course-tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--accent-gold); }
.course-tab-btn.active span { color: var(--accent-gold); }

/* --- 手機版專用標題 --- */
.mobile-section-title {
    display: none; 
    font-size: 1.5em; color: var(--primary-dark); font-family: var(--font-serif);
    margin: 30px 20px 15px; border-left: 5px solid var(--accent-gold); padding-left: 10px;
}

/* 課程容器 */
.courses-container-wrapper { width: 85%; max-width: 1200px; margin: 0 auto; overflow: hidden; min-height: 400px; }

/* [重點修正] 分頁切換顯示邏輯 */
/* 使用 !important 確保 active 狀態能覆蓋 display: none */
.course-group { 
    display: none; 
    animation: fadeIn 0.5s; 
} 
.course-group.active { 
    display: grid; 
} 

/* 課程網格設定 */
.course-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 40px;
    /* 注意：這裡不再設定 display: grid，改由 .course-group.active 控制 */
}

/* 手機版橫向捲動 */
@media (max-width: 768px) {
    .course-tabs-container { display: none; }
    .mobile-section-title { display: block; }
    
    .course-group { 
        display: flex !important; /* 強制顯示所有群組，覆蓋上面的 display: none */
        flex-wrap: nowrap; overflow-x: auto; gap: 20px;
        padding-bottom: 20px; scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch; width: 100%; margin-bottom: 30px;
    }
    
    .courses-container-wrapper { width: 100%; padding-left: 20px; }
    .course-card { min-width: 85%; scroll-snap-align: center; margin-right: 10px; }
}

/* 課程卡片 */
.course-card { background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); transition: 0.4s; display: flex; flex-direction: column; }
.course-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.1); }
.card-img-wrap { overflow: hidden; height: 220px; }
.card-img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.course-card:hover .card-img { transform: scale(1.1); }
.card-content { padding: 25px; flex-grow: 1; display: flex; flex-direction: column; }
.card-tag { font-size: 0.75em; color: var(--accent-gold); font-weight: bold; letter-spacing: 1px; margin-bottom: 10px; display: block; }
.card-title { font-size: 1.3em; margin-bottom: 10px; color: var(--primary-dark); line-height: 1.4; }
.card-desc { color: #888; font-size: 0.95em; margin-bottom: 20px; line-height: 1.6; }

/* 進度條 */
.progress-area { margin-top: auto; padding-top: 15px; border-top: 1px solid #eee; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.85em; color: #666; margin-bottom: 5px; }
.progress-track { width: 100%; height: 6px; background-color: #eee; border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background-color: var(--accent-gold); border-radius: 3px; }
.btn-text { display: block; text-align: center; margin-top: 15px; color: var(--primary-dark); font-weight: 600; font-size: 0.9em; }
.btn-text:hover { color: var(--accent-gold); }

/* 通用標題 */
.section-header { text-align: center; margin: 80px 0 50px; }
.section-title { font-size: 2.2em; color: var(--primary-dark); position: relative; display: inline-block; margin-bottom: 10px; }
.section-subtitle { display: block; font-family: var(--font-en); font-size: 0.85em; color: var(--accent-gold); letter-spacing: 3px; text-transform: uppercase; margin-top: 5px; font-weight: 600; }
.section-header::after { content: ''; display: block; width: 40px; height: 2px; background: var(--accent-gold); margin: 20px auto 0; }

/* [修正] 最新消息 */
.news-section { width: 85%; max-width: 900px; margin: 0 auto 100px; }
.news-list { border-top: 2px solid var(--primary-dark); }
.news-item { 
    display: flex; align-items: baseline; padding: 20px 10px; 
    border-bottom: 1px solid #eee; transition: 0.3s; 
    cursor: pointer; text-decoration: none; color: inherit;
}
.news-item:hover { background-color: white; padding-left: 20px; }
.news-date { 
    font-family: var(--font-en); color: var(--accent-gold); font-weight: 600; font-size: 0.9em; 
    margin-right: 30px; min-width: 100px; 
    flex-shrink: 0; /* 防止日期被擠壓 */
}
.news-title { 
    flex-grow: 1; font-size: 1.1em; color: #444; font-weight: 500; 
    line-height: 1.5; /* 增加行高避免文字打架 */
}
@media (max-width: 600px) { .news-item { flex-direction: column; gap: 8px; } }

/* Footer */
.footer { background-color: var(--primary-dark); color: #888; padding: 80px 10% 30px; font-size: 0.95em; margin-top: auto;}
.footer-content { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 60px; margin-bottom: 60px; }
@media (max-width: 768px) { .footer-content { grid-template-columns: 1fr; gap: 40px; } }
.footer h3 { color: white; margin-bottom: 25px; font-size: 1.1em; letter-spacing: 1px; }
.footer p { margin-bottom: 15px; font-weight: 300; }
.footer a { color: #888; transition: 0.3s; display: inline-flex; align-items: center; gap: 10px; }
.footer a:hover { color: var(--accent-gold); }
.social-icon { width: 20px; text-align: center; }
.copyright { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 30px; text-align: center; font-family: var(--font-en); font-size: 0.8em; letter-spacing: 1px; }

/* Modal 樣式 */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(26, 37, 47, 0.75); backdrop-filter: blur(5px); z-index: 2000; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-box { background: white; width: 90%; max-width: 450px; padding: 40px; border-radius: 10px; box-shadow: 0 15px 30px rgba(0,0,0,0.3); position: relative; transform: translateY(20px); transition: transform 0.3s ease; text-align: center; }
.modal-overlay.active .modal-box { transform: translateY(0); }
.modal-close { position: absolute; top: 15px; right: 20px; font-size: 1.5em; color: #999; cursor: pointer; transition: 0.2s; }
.modal-close:hover { color: var(--accent-gold); }
.modal-title { font-size: 1.5em; color: var(--primary-dark); margin-bottom: 30px; font-family: var(--font-serif); }
.member-section { margin-bottom: 30px; }
.member-input-group { position: relative; margin-bottom: 15px; }
.member-input { width: 100%; padding: 12px 15px; padding-left: 40px; border: 2px solid #eee; border-radius: 5px; font-size: 1em; outline: none; transition: 0.3s; }
.member-input:focus { border-color: var(--accent-gold); }
.input-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #ccc; }
.btn-modal-primary, .btn-modal-member { width: 100%; padding: 12px; background-color: var(--primary-dark); color: var(--accent-gold); border: none; border-radius: 5px; font-weight: bold; font-size: 1.1em; cursor: pointer; transition: 0.3s; }
.btn-modal-primary:hover, .btn-modal-member:hover { background-color: #2c3e50; }
.modal-divider { display: flex; align-items: center; color: #aaa; font-size: 0.9em; margin: 20px 0; }
.modal-divider::before, .modal-divider::after { content: ''; flex: 1; height: 1px; background: #eee; }
.modal-divider span { margin: 0 10px; }
.btn-modal-secondary, .btn-modal-guest { width: 100%; padding: 12px; background-color: transparent; color: #666; border: 2px solid #ddd; border-radius: 5px; font-weight: bold; font-size: 1em; cursor: pointer; transition: 0.3s; }
.btn-modal-secondary:hover, .btn-modal-guest:hover { border-color: #999; color: #333; }