﻿/* =========================================
           1. 變數與全域設定
           ========================================= */
:root {
    --primary-color: #2c3e50; /* 深藍灰 */
    --accent-color: #3498db; /* 亮藍 */
    --text-dark: #2c3e50;
    --text-grey: #7f8c8d;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --border-color: #ecf0f1;
    --price-color: #e67e22; /* 橘色價格 */
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-dark);
    line-height: 1.5;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
}

/* =========================================
           2. 導覽列 (Navbar)
           ========================================= */
.main-navbar {
    background-color: var(--card-bg);
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
}

    .nav-links a {
        text-decoration: none;
        color: var(--text-grey);
        font-weight: 600;
        font-size: 1rem;
        padding: 22px 0;
        border-bottom: 3px solid transparent;
        transition: all 0.3s;
    }

        .nav-links a:hover,
        .nav-links a.active {
            color: var(--accent-color);
            border-bottom-color: var(--accent-color);
        }

/* =========================================
           3. 標題與搜尋區塊
           ========================================= */
.page-header-section {
    padding: 40px 0 30px 0;
    text-align: center;
}

.main-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0 0 10px 0;
}

.sub-title {
    color: var(--text-grey);
    font-size: 16px;
    margin: 0;
}

/* 搜尋列 Grid 排版 */
.search-layout {
    display: grid;
    /* 電腦版：改為標準 3 欄位 */
    grid-template-columns: repeat(3, 1fr);
    gap: 20px; /* 間距加大一點比較舒適 */
    align-items: end; /* 讓按鈕跟隔壁的輸入框底部對齊 */

    background-color: #fff;
    padding: 30px; /* 增加內距讓整體大器一點 */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}

/* 針對輸入框與選單的統一樣式 */
.form-group {
    display: flex;
    flex-direction: column;
}

/* 讓「關鍵字」欄位在電腦版橫跨 2 個欄位 */
.keyword-group {
    grid-column: span 2;
}

.form-label {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 0.95rem;
}

.form-input {
    padding: 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    height: 48px; /* 設定固定高度 */
    box-sizing: border-box;
    width: 100%;
    background-color: #fff;
}

    .form-input:focus {
        border-color: var(--accent-color);
    }

.btn-search {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    height: 48px; /* 按鈕高度需與輸入框一致 */
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1.1rem;
    width: 100%; /* 按鈕填滿該格 */
    transition: background 0.2s;
    letter-spacing: 2px;
}

    .btn-search:hover {
        background-color: #34495e;
    }

/* =========================================
           4. 課程卡片 (Course Card)
           ========================================= */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.course-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

    .course-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 20px rgba(0,0,0,0.08);
        border-color: #d6e4ff;
    }

/* 標籤區 */
.card-header-badges {
    padding: 15px 20px 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.badge {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
}

.badge-primary {
    background-color: #e3f2fd;
    color: var(--accent-color);
}

.badge-secondary {
    background-color: #f1f3f5;
    color: #5d6d7e;
}

.badge-success {
    background-color: #e8f5e9;
    color: #27ae60;
    margin-left: auto;
}

/* 卡片內容 */
.card-body {
    padding: 20px;
    flex: 1;
}

.course-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 10px 0 15px 0;
    line-height: 1.4;
}

/* 資訊列表 */
.course-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .course-info-list li {
        display: flex;
        margin-bottom: 10px;
        color: #555;
        font-size: 0.95rem;
        line-height: 1.5;
    }

/* 替代 Emoji 的文字標籤樣式 */
.info-label {
    color: #999;
    font-weight: 500;
    min-width: 50px; /* 固定寬度讓冒號對齊 */
    display: inline-block;
}

.highlight-text {
    color: var(--accent-color);
    font-weight: 600;
}

/* 卡片底部 */
.card-footer {
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-tag {
    font-weight: 700;
    color: var(--price-color);
    font-size: 1.1rem;
}

.btn-detail {
    background-color: #fff;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

    .btn-detail:hover {
        background-color: var(--accent-color);
        color: #fff;
    }

/* =========================================
           5. 彈出視窗 (Modal)
           ========================================= */
.modal-mask {
    display: none; /* 預設隱藏，透過 JS 改為 flex */
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-container {
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.4rem;
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    color: #444;
}

.detail-section {
    margin-bottom: 25px;
}

.section-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-color);
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

/* 處理長文字換行 */
.text-content {
    white-space: pre-line;
    line-height: 1.6;
    text-align: justify;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

    .info-table td {
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .info-table strong {
        color: #555;
        margin-right: 10px;
    }

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    text-align: right;
}

.btn-modal-close {
    background-color: #95a5a6;
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

    .btn-modal-close:hover {
        background-color: #7f8c8d;
    }

/* RWD 調整 */
@media (max-width: 768px) {
    .search-layout {
        grid-template-columns: 1fr; /* 手機變單欄 */
        gap: 15px;
    }

    .keyword-group {
        grid-column: span 1; /* 手機版取消橫跨 */
    }

    .btn-search {
        margin-top: 10px;
    }
}
