/* 全域變數 */
:root {
    --primary-color: #1E3A8A; /* 深海藍 */
    --secondary-color: #0D9488; /* 柔和湖綠 */
    --accent-color: #EA580C; /* 暖橘色 */
    --accent-hover: #C2410C;
    --bg-color: #FFFFFF;
    --bg-light: #F8FAFC; /* 淺藍灰背景 */
    --text-main: #334155;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-color);
    line-height: 1.6;
    letter-spacing: 0.02em;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 輔助類別 */
.bg-light { background-color: var(--bg-light); }
.text-center { text-align: center; }
.mt-30 { margin-top: 30px; }
/* 提升後的卡片顏色 - 使用更深邃的複合漸層 */
.bg-color-1 { background: linear-gradient(135deg, #9F1239 0%, #E11D48 100%) !important; color: #fff; } /* 寶石紅 */
.bg-color-2 { background: linear-gradient(135deg, #1E3A8A 0%, #3B82F6 100%) !important; color: #fff; } /* 皇家藍 */
.bg-color-3 { background: linear-gradient(135deg, #064E3B 0%, #10B981 100%) !important; color: #fff; } /* 森林綠 */
.bg-color-4 { background: linear-gradient(135deg, #4C1D95 0%, #8B5CF6 100%) !important; color: #fff; } /* 皇家紫 */
.bg-color-5 { background: linear-gradient(135deg, #78350F 0%, #F59E0B 100%) !important; color: #fff; } /* 琥珀橘 */

/* 按鈕樣式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-align: center;
}

.btn-primary { background-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background-color: #122847; color: #fff; }
.btn-accent { background-color: var(--accent-color); color: #fff; }
.btn-accent:hover { background-color: var(--accent-hover); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-outline { background-color: transparent; border: 2px solid var(--primary-color); color: var(--primary-color); }
.btn-outline:hover { background-color: var(--primary-color); color: #fff; }
.btn-disabled { background-color: #E2E8F0; color: #A0AEC0; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-dark { background-color: #343a40; color: #fff; }
.btn-dark:hover { background-color: #23272b; color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-blue { background-color: #1877F2; color: #fff; }
.btn-blue:hover { background-color: #166fe5; color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-orange { background-color: #FF7A00; color: #fff; }
.btn-orange:hover { background-color: #E66D00; color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.status-text { font-size: 0.95rem; color: var(--text-main); font-weight: bold; }

/* 導覽列 */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 15px 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: bold;
}

.main-nav ul {
    display: flex;
    gap: 30px;
}

.main-nav a {
    color: var(--text-main);
    font-weight: bold;
    padding: 5px 0;
    position: relative;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--accent-color);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: var(--transition);
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
}

/* 首圖區 */
.hero-section {
    position: relative;
    height: 60vh;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: #2C3E50; /* 背景 */
    background-image: url('../img/banner.jpg'); /* 首圖 */ 
    background-size: cover;
    background-position: center;
    color: #fff;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.4)); /* 遮罩 */
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 20px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: 0.05em;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 40px;
    opacity: 0.95;
    font-weight: 300;
}

.hero-btn {
    font-size: 1.15rem;
    padding: 14px 40px;
    background-color: var(--accent-color);
    border-radius: 30px; /* 圓角 */
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.4);
}

.hero-btn:hover {
    background-color: var(--accent-hover);
}

/* 共用區塊 */
.section {
    padding: 80px 0;
}

.section-title {
    font-size: 2rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: var(--accent-color);
}

/* 甄試報名 */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    background-color: #EBF8FF;
    border-left: 5px solid #3182CE;
    color: #2B6CB0;
}

.alert-icon {
    margin-right: 15px;
    display: flex;
}

/* 列表設計 */
.registration-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
    max-width: 1000px;
    margin: 0 auto;
}

.card {
    background: var(--bg-color);
    border-radius: var(--radius);
    overflow: hidden; /* 恢復裁切，確保邊界整齊 */
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: row; /* 橫向排列 */
    align-items: stretch;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(0,0,0,0.05);
}

.card-header {
    position: relative; /* 為了放置裝飾元素 */
    padding: 30px;
    text-align: center;
    width: 240px; /* 固定寬度 */
    flex: 0 0 240px; /* 不縮放 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: var(--radius) 0 0 var(--radius); /* 左側圓角 */
    overflow: hidden;
    box-shadow: inset -5px 0 15px rgba(0,0,0,0.1); /* 加入細微內陰影增加厚度感 */
}

/* 加上微細幾何紋路與斜紋裝飾 */
.card-header::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /* 第一層：斜向條紋 */
    background-image: 
        repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 2px, transparent 2px, transparent 10px),
        /* 第二層：細小網格點 */
        radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 100% 100%, 15px 15px;
    pointer-events: none;
    z-index: 0;
}

/* 加上上方光澤感與抽象裝飾大圓 */
.card-header::after {
    content: "";
    position: absolute;
    top: -20%; left: -20%;
    width: 140%; height: 140%;
    /* 營造左上角的抽象柔光圓形 */
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.15) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* 增加左側亮邊裝飾線 */
.card-header::after {
    box-shadow: inset 4px 0 0 rgba(255,255,255,0.2);
}

.card-header h4 {
    font-size: 1.3rem;
    font-weight: 500; /* 稍微增加字重 */
    line-height: 1.4;
    letter-spacing: 0.1em; /* 增加字距更具現代感 */
    text-shadow: 0 2px 4px rgba(0,0,0,0.2); /* 讓文字浮現出來 */
    z-index: 1;
}

.card-header span {
    font-size: 1.95rem; /* 字體稍微調大一點 */
    font-weight: 800;
    display: block;
    margin-top: 10px;
    letter-spacing: 0.02em;
    z-index: 1;
}

.card-body {
    padding: 20px 30px; /* 稍微減少內距 */
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-grow: 1;
    gap: 20px; /* 稍微減少間距 */
    min-width: 0; /* 關鍵：允許內容縮小 */
}

.schedule-list {
    margin-bottom: 0;
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 1fr; /* 改為比例分配，不再強行撐開 */
    row-gap: 15px;
    column-gap: 20px;
    align-items: center;
    min-width: 0;
}

.schedule-list li {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: var(--text-main);
    white-space: nowrap; /* 不斷行 */
}

.schedule-list li:last-child {
    margin-bottom: 0;
}

.card-action {
    width: 200px; /* 稍微減小按鈕區塊寬度 */
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.detail-link, .rules-link {
    font-size: 0.95rem;
    color: var(--secondary-color);
    font-weight: bold;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.detail-link:hover, .rules-link:hover {
    color: var(--accent-color);
}

.schedule-list .icon {
    margin-right: 8px;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
}

.schedule-list .icon svg {
    width: 1em;
    height: 1em;
}

/* 最新公告 */
.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
}

.announcement-item {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid transparent;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.announcement-item:hover {
    border-left-color: var(--accent-color);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
    background-color: var(--bg-light);
}

.announcement-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
    margin-right: 20px;
}

.announcement-date .month {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: bold;
}

.announcement-date .day {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1;
}

.announcement-content {
    flex-grow: 1;
}

.announcement-title {
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: 1.5;
}

.announcement-tags {
    display: flex;
    gap: 8px;
}

.tag {
    font-size: 0.9rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.tag-important { background-color: #FED7D7; color: #C53030; }
.tag-principal { background-color: #EBF8FF; color: #2B6CB0; }
.tag-director { background-color: #E6FFFA; color: #285E61; }

/* 分頁導覽 */
.pagination { display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
.page-btn { padding: 8px 16px; border: 1px solid var(--border-color); background: #fff; cursor: pointer; border-radius: var(--radius); color: var(--text-main); font-size: 1.1rem; font-weight: bold; transition: var(--transition); }
.page-btn:hover:not(.disabled) { background: var(--bg-light); border-color: var(--primary-color); color: var(--primary-color); }
.page-btn.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.page-btn.disabled { color: #A0AEC0; cursor: not-allowed; background: #F4F7F6; border-color: #E2E8F0; }

/* 檔案下載 */
.tabs-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: #F8FAFC;
}

.tab-btn {
    flex: 1;
    padding: 18px 20px;
    background: none;
    border: none;
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background-color: #EDF2F7;
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--accent-color);
    background-color: var(--bg-color);
}

.tabs-content {
    padding: 30px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

/* 頁籤切換 */
.tab-pane.active {
    display: block;
}

/* 漸進動畫 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.download-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px dashed var(--border-color);
}

.download-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.download-info {
    flex-grow: 1;
    padding-right: 20px;
}

.file-name {
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: normal;
}

.download-action {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background-color: #F4F7F6;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
    white-space: nowrap;
}

.file-icon {
    margin-right: 6px;
    width: 18px;
    height: 18px;
}

.pdf-icon { color: #E53E3E; }
.word-icon { color: #3182CE; }
.excel-icon { color: #38A169; }

.download-action:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.download-action:hover .file-icon {
    color: #fff;
}

/* 頁尾 */
.main-footer {
    background-color: #2D3748;
    color: #fff;
    padding-top: 50px;
}

.footer-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: #fff;
    font-weight: bold;
}

.friendly-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
}

.footer-link-btn {
    border-color: rgba(255, 255, 255, 0.3);
    color: #E2E8F0;
    transition: var(--transition);
}

.footer-link-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #fff;
}

.footer-bottom {
    background-color: #1A202C;
    padding: 20px 0;
    margin-top: 20px;
}

.footer-bottom p {
    margin-bottom: 5px;
    color: #A0AEC0;
}

.footer-maintenance {
    color: #A0AEC0;
    transition: var(--transition);
}

.footer-maintenance:hover {
    color: #fff;
}

/* 短首圖 */
.hero-sm { height: 30vh; min-height: 250px; }
.hero-sm .hero-title { font-size: 2.2rem; margin-bottom: 0px; }

/* 文章公告 */
.article-container { max-width: 800px; margin: 0 auto; background: var(--bg-color); padding: 50px; border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.article-header { border-bottom: 2px solid var(--border-color); padding-bottom: 20px; margin-bottom: 30px; }
.article-title { font-size: 2rem; color: var(--primary-color); line-height: 1.4; margin-bottom: 15px;}
.article-meta { color: var(--text-muted); font-size: 1rem; display: flex; gap: 20px; align-items: center; }
.article-body { font-size: 1.15rem; line-height: 1.8; color: var(--text-main); }
.article-body p { margin-bottom: 1.5rem; }
.article-body img { max-width: 100%; height: auto; margin: 20px 0; border-radius: var(--radius); }
.file-download-box { background: var(--bg-light); border: 1px dashed var(--border-color); padding: 20px; border-radius: var(--radius); margin-top: 40px; }
.file-download-box h5 { margin-bottom: 15px; color: var(--primary-color); font-size: 1.1rem;}

/* 登入表單 */
.login-container { max-width: 450px; margin: 0 auto; }
.login-card { background: var(--bg-color); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); border: 1px solid var(--border-color); }
.login-header { padding: 20px; text-align: center; color: #fff; font-size: 1.4rem; font-weight: bold; }
.login-body { padding: 30px; }
.form-group { margin-bottom: 25px; }
.form-label { display: block; font-weight: bold; margin-bottom: 8px; color: var(--text-main); font-size: 1.1rem; }
.form-control { width: 100%; padding: 12px 15px; font-size: 1rem; border: 1px solid var(--border-color); border-radius: var(--radius); transition: var(--transition); background-color: #fff;}
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(26,54,93,0.1); }
.captcha-group { display: flex; gap: 15px; align-items: center; }
.captcha-input { flex: 1; }
.captcha-img-wrapper { height: 50px; border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; background: #f8f9fa; min-width: 140px;}
.captcha-img { height: 100%; width: 100%; object-fit: cover; cursor: pointer; }

/* 登入配色 */
/* 管理員 */
.theme-admin .login-header { background-color: #2D3748; }
.theme-admin .btn-submit { background-color: #2D3748; color: #fff; border: none; font-size: 1.1rem; padding: 12px; }
.theme-admin .btn-submit:hover { background-color: #1A202C; transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* 考生報名 */
.theme-candidate-reg .login-header { background-color: #008080; }
.theme-candidate-reg .btn-submit { background-color: #008080; color: #fff; border: none; font-size: 1.1rem; padding: 12px; }
.theme-candidate-reg .btn-submit:hover { background-color: #005f5f; transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* 考生查詢 */
.theme-candidate-query .login-header { background-color: #DD6B20; }
.theme-candidate-query .btn-submit { background-color: #DD6B20; color: #fff; border: none; font-size: 1.1rem; padding: 12px; }
.theme-candidate-query .btn-submit:hover { background-color: #C05621; transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* 響應式 */


/* 手機版 */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.2rem;
    }
    
    .registration-grid {
        gap: 20px;
    }

    .card {
        flex-direction: column;
    }

    .card-header {
        width: 100%;
        padding: 20px;
    }

    .card-body {
        flex-direction: column;
        padding: 25px 20px;
        gap: 20px;
    }

    .schedule-list {
        display: flex; /* 從 grid 改回 flex */
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .schedule-list li {
        white-space: normal;
    }

    .card-action {
        width: 100%;
    }
    
    .announcement-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .announcement-date {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 10px;
        margin-right: 0;
        margin-bottom: 15px;
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
    }
    
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
    }
    
    .tab-btn.active {
        border-left-color: var(--accent-color);
        border-bottom-color: transparent;
    }
    
    .download-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .main-nav {
        display: none; /* 隱藏選單 */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #fff;
        box-shadow: var(--shadow-md);
    }
    
    .main-nav.active {
        display: block;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }
    
    .main-nav li {
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-nav a {
        display: block;
        padding: 15px 20px;
    }
    
    .main-nav a::after {
        display: none;
    }
}