/* ================= 核心變數與重置 ================= */
:root {
    --primary: #FF9F1C;        /* 主色：活力橘 */
    --primary-hover: #E88D0C;
    --secondary: #2EC4B6;      /* 輔色：科技青 */
    --dark: #2B2D42;           /* 文字深色 */
    --gray: #6D7278;           /* 文字灰色 */
    --light-bg: #F9FAFB;       /* 背景淺灰 */
    --white: #FFFFFF;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 15px 35px rgba(255, 159, 28, 0.15);
    --radius: 20px;
    --font-main: 'Noto Sans TC', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-main);
    background-color: var(--light-bg);
    color: var(--dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;

    -ms-overflow-style: none; /*避免 IE 瀏覽器瀏覽網頁時出現滑桿*/
}

/* 當頁面載入完成，JS 會加上這個 class 讓頁面顯示 */
body.fade-in {
    opacity: 1;
}

body::-webkit-scrollbar {/*避免 Safari 和 Chromium 瀏覽器瀏覽網頁時出現滑桿*/
  display: none;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
b { color:#3a537e;}
b.gray { color:#8f8f8f;}
ul { list-style: none; }

/* ================= 導覽列 (Navbar) ================= */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--dark);
}

.brand img { height: 45px; width: auto; }

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--gray);
    position: relative;
    padding: 5px 0;
}

.nav-link:hover, .nav-link.active { color: var(--primary); }

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

/* 手機選單按鈕 */
.hamburger { display: none; font-size: 1.5rem; cursor: pointer; color: var(--dark); }

/* 社群 Icon */
.social-icons { display: flex; gap: 12px; margin-left: 1rem; }
.social-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #EEE;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark);
    font-size: 1rem;
}
.social-btn:hover { background: var(--primary); color: white; }

/* ================= 頁面標題區 (Page Header) ================= */
.page-header {
    background: linear-gradient(135deg, #FFF8F0 0%, #FFFFFF 100%);
    padding: 60px 20px;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: -50%; left: -10%;
    width: 300px; height: 300px;
    background: rgba(255, 159, 28, 0.05);
    border-radius: 50%;
    filter: blur(50px);
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    position: relative;
}

.page-subtitle { color: var(--gray); font-size: 1.1rem; }

/* 首頁 Hero 特別樣式 */
.hero {
    text-align: center;
    padding: 100px 20px 60px;
    background: linear-gradient(135deg, #FFFBF5 0%, #FFFFFF 100%);
}
.hero h1 { font-size: 3rem; margin-bottom: 1rem; line-height: 1.2; }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--gray); font-size: 1.2rem; max-width: 600px; margin: 0 auto 2rem; }
.btn-main {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 12px 32px;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 159, 28, 0.4);
}
.btn-main:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(255, 159, 28, 0.5); }

/* ================= 內容容器與卡片 ================= */
/* ================= 內容容器與卡片 ================= */
/* ================= 內容容器與格狀佈局修正 ================= */

/* 確保容器寬度正確 */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px 60px;
    width: 100%; /* 確保佔滿可用空間 */
}

/* 修正工具箱的格狀佈局 */
.grid-4 {
    display: grid;
    /* 電腦版預設：強制 3 欄排列，不再讓它因為寬度不足就隨意擠壓成直行 */
    grid-template-columns: repeat(4, 1fr); 
    gap: 25px;
    width: 100%;
}

/* 平板與大螢幕手機：改為 2 欄排列 */
@media (max-width: 900px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* 小型手機：縮小間距，維持 2 欄（避免佔滿畫面高度） */
@media (max-width: 500px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .tool-item {
        padding: 15px 10px; /* 手機版再縮小一點內距 */
    }
    
    .tool-icon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
}

/* 修改後的格狀佈局：讓它在小螢幕也能並排 */
.grid-2 { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 20px; 
}

.grid-4 { 
    display: grid; 
    /* 核心修改：將 250px 改為 140px，讓手機版能容納兩欄 */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); 
    gap: 15px; 
}

/* ================= 元件樣式微調 ================= */
/* 讓工具箱項目在手機上更精緻 */
.tool-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 10px; /* 減少內距 */
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: 0.3s;
}

.tool-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

.tool-item h4 {
    font-size: 0.95rem; /* 稍微縮小字體以免折行 */
    margin-top: 5px;
}

.tool-icon {
    font-size: 1.5rem; /* 稍微縮小圖標 */
    margin-bottom: 10px;
    width: 50px; 
    height: 50px;
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    background: #FFF5E5; 
    color: var(--primary);
}

/* 針對超小螢幕 (如 iPhone SE) 的特別優化 */
@media (max-width: 350px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr); /* 強制兩欄 */
        gap: 10px;
    }
}

/* 2. 公告列表 */
.ann-item {
    background: white;
    padding: 20px 25px;
    border-radius: 16px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    border-left: 5px solid var(--primary);
    cursor: pointer;
    transition: 0.2s;
}
.ann-item:hover { transform: translateX(5px); box-shadow: 0 6px 15px rgba(0,0,0,0.08); }
.ann-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 5px; }
.ann-meta { font-size: 0.9rem; color: #888; }

/* 3. 時間軸 (History) */
.timeline { position: relative; max-width: 800px; margin: 0 auto; }
.timeline::after {
    content: ''; position: absolute; width: 4px; background: #EEE;
    top: 0; bottom: 0; left: 50%; transform: translateX(-50%); border-radius: 2px;
}
.tl-item { padding: 10px 40px; position: relative; width: 60%; box-sizing: border-box; }
.tl-left { left: -10%; text-align: right; }
.tl-right { left: 50%; }

.tl-content {
    padding: 20px; background: white; border-radius: var(--radius);
    box-shadow: var(--card-shadow); position: relative;
}

/* 4. 組織圖 (Org) */
.org-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--dark); color: white; padding: 15px;
    border-radius: 12px; margin-top: 20px; width: 100%; text-align: center;
}
.dept-card { text-align: center; padding: 30px 20px; }
.dept-icon { font-size: 2.5rem; color: var(--secondary); margin-bottom: 15px; }

/* ================= Loading & Pagination ================= */
.spinner {
    width: 40px; height: 40px; border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite; margin: 20px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.pagination { display: flex; justify-content: center; gap: 10px; margin-top: 30px; }
.page-btn {
    border: none; background: white; width: 36px; height: 36px;
    border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer; font-weight: bold; color: var(--gray);
}
.page-btn.active, .page-btn:hover { background: var(--primary); color: white; }

/* ================= Footer ================= */
footer {
    background: var(--dark); color: white; padding: 40px 20px; text-align: center;
    margin-top: auto; /* Push to bottom */
}
.footer-content p { opacity: 0.7; font-size: 0.9rem; margin-top: 10px; }

/* ================= Modal (彈出視窗) 優化版 ================= */
.modal {
    display: none; /* 預設隱藏，由 JS 控制顯示 */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* 背景變暗 */
    backdrop-filter: blur(5px); /* 背景模糊 */
    /* 讓內容上下左右置中 */
    justify-content: center;
    align-items: center;
    padding: 20px; /* 避免手機版貼邊 */
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 700px; /* 最大寬度 */
    max-height: 85vh; /* 避免視窗太高超出螢幕 */
    border-radius: var(--radius);
    box-shadow: 0 15px 50px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    animation: zoomIn 0.3s ease;
    position: relative;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- 標題區 (Header) --- */
.modal-header {
    background: var(--primary);
    color: white;
    padding: 20px 25px;
    display: flex;            /* 使用 Flex 排版 */
    justify-content: space-between; /* 標題靠左，X靠右 */
    align-items: flex-start;  /* 靠上對齊 */
    border-radius: var(--radius) var(--radius) 0 0;
    flex-shrink: 0; /* 防止標題被壓縮 */
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.4;
    padding-right: 20px; /* 確保文字不會碰到 X 按鈕 */
    word-break: break-word; /* 避免長單字撐破 */
}

/* --- X 關閉按鈕 --- */
.close-btn {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: 0.2s;
    margin-left: 10px; /* 與標題保持距離 */
    background: transparent;
    border: none;
}

.close-btn:hover {
    color: white;
    transform: scale(1.1);
}

/* --- 內容區 (Body) --- */
.modal-body {
    padding: 30px;
    overflow-y: auto; /* 內容太長時出現捲軸 */
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--dark);
    word-break: break-word; /* 防止長網址撐破版面 */
}

/* --- 連結樣式優化 --- */
.modal-body a {
    color: #007bff; /* 鮮豔的藍色，符合使用者習慣 */
    text-decoration: underline; /* 加上底線 */
    font-weight: 500;
    transition: 0.2s;
    word-break: break-all; /* 針對超長網址強制換行 */
}

.modal-body a:hover {
    color: #0056b3; /* 滑鼠懸停變深藍 */
    background-color: rgba(0, 123, 255, 0.1); /* 增加一點背景色回饋 */
    border-radius: 4px;
}

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

/* ================= RWD ================= */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed; top: 70px; left: 0; width: 100%; background: white;
        flex-direction: column; padding: 20px; box-shadow: 0 10px 10px rgba(0,0,0,0.05);
        display: none;
    }
    .nav-menu.active { display: flex; }
    .hamburger { display: block; }
    .timeline::after { left: 20px; }
    .tl-item { width: 100%; padding-left: 50px; padding-right: 0; text-align: left; }
    .tl-left {left: 10px; right: auto; }
    .tl-right {left: 10px; right: auto; }
}

/* ================= 檔案專區 (File Zone) 樣式 ================= */

/* 檔案列表容器 (預設單欄，但在大螢幕可以改雙欄) */
#files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* 檔案卡片 */
.file-item {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.02);
    display: flex; /* 讓圖示在左，文字在右 */
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.file-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

/* 左側圖示區 */
.file-icon-box {
    width: 60px;
    height: 60px;
    background: #FFF5E5; /* 淺橘色背景 */
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0; /* 防止被擠壓 */
}

/* 右側內容區 */
.file-content {
    flex: 1;
    overflow: hidden; /* 防止文字溢出 */
}

.file-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--dark);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* 版本號標籤 */
.file-version {
    background: var(--secondary);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
}

.file-meta {
    font-size: 0.85rem;
    color: var(--gray);
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.file-meta i {
    margin-right: 4px;
    opacity: 0.7;
}

/* 標籤區域 (共用 tag-badge 樣式，但稍微調整間距) */
.file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag-badge {
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: #555;
}

/* RWD: 手機版調整 */
@media (max-width: 480px) {
    #files-list {
        grid-template-columns: 1fr; /* 手機版強制單欄 */
    }
    
    .file-item {
        padding: 15px;
        gap: 15px;
    }
    
    .file-icon-box {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .file-title {
        font-size: 1rem;
    }
}

/* ================= 幹部介紹頁面樣式 ================= */

/* 分區標題 */
.section-title {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 25px;
    padding-left: 10px;
    border-left: 5px solid var(--primary);
}

/* 幹部卡片 (繼承 card 但增加特定置中) */
.team-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px 20px;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
}

/*.team-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}*/

/* 頭像容器與圖片 */
.profile-box {
    width: 120px;
    height: 120px;
    margin-bottom: 15px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, var(--primary), var(--secondary)); /* 外框漸層 */
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover; /* 確保照片不變形 */
    background-color: white;
    border: 3px solid white; /* 內圈白邊 */
}

/* 職稱 */
.team-role {
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 15px;
    font-size: 0.95rem;
    background: #FFF5E5;
    padding: 2px 12px;
    border-radius: 20px;
    display: inline-block;
}

/* Email 區塊 */
.team-contact {
    margin-bottom: 20px;
    width: 100%;
}

.team-contact a {
    color: var(--gray);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.2s;
    /* 如果 email 太長，自動省略 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-contact a:hover {
    color: var(--primary);
}

/* 更多資訊按鈕 */
.team-more-btn {
    margin-top: auto; /* 將按鈕推到底部 */
    padding: 8px 20px;
    border: 1px solid var(--gray);
    border-radius: 50px;
    color: var(--gray);
    font-size: 0.9rem;
    transition: 0.3s;
}

.team-more-btn:hover {
    background: var(--dark);
    color: white;
    border-color: var(--dark);
}

.team-more-btn i {
    margin-left: 5px;
    font-size: 0.8rem;
}

/* 手機版微調：確保 grid 間距適當 */
@media (max-width: 500px) {
    .section-title {
        font-size: 1.3rem;
        margin-top: 20px;
    }
}