/* --- 海神游泳學苑 全域風格檔 (V20.0 - 終極修正版) --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700;900&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css');

:root {
    --primary-blue: #006994;
    --secondary-blue: #4FC3F7;
    --accent-orange: #FF9800;
    --bg-light: #E0F7FA;
    --text-dark: #333333;
    --white: #ffffff;
    --dark-blue: #004d6a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { 
    font-family: 'Noto Sans TC', sans-serif; 
    line-height: 1.6; 
    color: var(--text-dark); 
    background-color: var(--white); 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    overflow-x: hidden; 
    position: relative; 
}

/* 左側裝飾性波浪背景 */
body::before {
    content: ''; position: fixed; top: 0; left: 0; width: 250px; height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 1200'%3E%3Cpath fill='%23e0f7fa' fill-opacity='0.8' d='M0,0 C50,100 0,200 0,300 C50,400 0,500 0,600 C50,700 0,800 0,900 C50,1000 0,1100 0,1200 L0,0 Z'%3E%3C/path%3E%3C/svg%3E") repeat-y left center / contain; 
    z-index: -1; pointer-events: none; opacity: 0.7; 
}
@media (max-width: 900px) { body::before { width: 100px; } }

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
video { max-width: 100%; height: auto; display: block; }

/* 導覽列 */
header { background-color: var(--white); box-shadow: 0 2px 10px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 1000; }
.navbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding: 0.5rem 5%; max-width: 1200px; margin: 0 auto; }
.logo { font-size: 1.8rem; font-weight: 900; color: var(--primary-blue); display: flex; align-items: center; gap: 15px; min-width: 200px; }
.logo img { height: 80px; width: auto; } 
.nav-links { display: flex; flex-wrap: wrap; gap: 15px; font-size: 1rem; align-items: center; }
.nav-links a { font-weight: 700; color: var(--primary-blue); padding: 5px 10px; border-radius: 5px; transition: 0.3s; }
.nav-links a:hover, .nav-links a.active { background-color: var(--bg-light); color: var(--accent-orange); }
.btn-signup-nav { background-color: var(--accent-orange) !important; color: var(--white) !important; border-radius: 20px !important; padding: 8px 20px !important;}

/* 頁面標題區 (共用) */
.page-header { background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue)); color: white; padding: 3rem 5%; text-align: center; margin-bottom: 3rem; }
.page-title { font-size: 2.5rem; font-weight: 900; }

/* --- ★★★ 主視覺區 (V20.0) ★★★ --- */
.hero-section { 
    background: 
        radial-gradient(circle at 15% 70%, rgba(255,255,255,0.15) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23ffffff' fill-opacity='0.12' d='M0,160L48,176C96,192,192,224,288,208C384,192,480,128,576,90.7C672,53,768,43,864,64C960,85,1056,139,1152,149.3C1248,160,1344,128,1392,112L1440,96L1440,0L1392,0C1344,0,1248,0,1152,0C1056,0,960,0,864,0C768,0,672,0,576,0C480,0,384,0,288,0C192,0,96,0,48,0L0,0Z'%3E%3C/path%3E%3C/svg%3E") no-repeat center bottom / cover,
        linear-gradient(160deg, #36D1DC 0%, #5B86E5 100%); 
    color: var(--white); 
    position: relative;
    padding: 0 5% 25rem 5%; 
    overflow: hidden; 
    min-height: 750px; 
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    height: 100%;
    display: flex;
    justify-content: flex-end; 
}

/* 絕對定位的海神 Logo */
.bg-watermark-absolute {
    position: absolute;
    left: -10%; 
    top: 5%;
    width: 65%; 
    max-width: 900px;
    opacity: 1;
    z-index: 1;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.3));
}

/* 右側文字區塊 (V20.0：更下移，置中對齊) */
.hero-text-wrapper {
    position: relative;
    z-index: 5;
    text-align: center; /* ★ 文字內容置中 */
    width: 45%; /* 寬度稍微放寬一點點 */
    margin-right: 2%; 
    padding-top: 280px; /* ★ 繼續往下推 */
}

.hero-title { 
    font-size: 4.8rem; 
    margin-bottom: 20px; 
    text-shadow: 0 4px 12px rgba(0,0,0,0.4); 
    letter-spacing: 4px; 
    font-weight: 900; 
    line-height: 1.3;
}
.title-indent {
    display: block;
    margin-left: 2rem; 
}

.hero-subtitle { 
    font-size: 1.3rem; 
    opacity: 0.98; 
    font-weight: 700; 
    text-shadow: 0 2px 6px rgba(0,0,0,0.3);
    margin-top: 15px;
}


/* --- ★★★ 主要內容容器 ★★★ --- */
.main-content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
}

/* 右側內容框 (位置) */
.layout-stagger-high {
    margin-top: -180px; 
    margin-left: 60px; 
}

/* 左側海報框 */
.layout-stagger-low {
    margin-top: 50px; 
}


/* 左側直式海報區塊 */
.featured-poster-wrapper {
    flex: 0 0 44%; 
    max-width: 580px; 
    position: relative;
}
.featured-poster {
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4); 
    border: 6px solid white; 
    transform: rotate(-3deg); 
    transition: transform 0.3s ease;
}
.featured-poster-wrapper:hover .featured-poster { transform: rotate(0deg) scale(1.02); }
.poster-badge {
    position: absolute; top: -10px; left: -10px; background: var(--accent-orange); color: white; padding: 8px 15px; font-weight: 900; font-size: 1.1rem; border-radius: 50px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); z-index: 25; transform: rotate(-5deg);
}

/* 右側文字框 */
.news-box { 
    flex: 0 0 50%;
    max-width: 500px; 
    background: var(--white); 
    padding: 3rem; 
    border-radius: 20px; 
    box-shadow: 0 25px 60px rgba(0,0,0,0.3); 
    border-left: 10px solid var(--primary-blue); 
    position: relative; 
    display: flex;
    flex-direction: column;
}
.news-badge { background: var(--primary-blue); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold; font-size: 1rem; display: inline-block; width: fit-content; }
.news-title { color: var(--primary-blue); margin: 15px 0; font-size: 2rem; }
.news-content { font-size: 1.3rem; color: #555; line-height: 1.8; }
.news-actions { margin-top: 15px; display: flex; align-items: center; flex-wrap: wrap; gap: 15px; }
.btn-primary-action { background-color: var(--accent-orange); color: white; padding: 10px 25px; border-radius: 30px; font-weight: bold; display: inline-block; transition: 0.3s; box-shadow: 0 5px 15px rgba(255, 152, 0, 0.3); }
.btn-primary-action:hover { background-color: #e68900; transform: translateY(-2px); }
.promotion-link { color: var(--primary-blue); text-decoration: underline; font-weight: bold; font-size: 1.1rem; transition: 0.3s; }
.promotion-link:hover { color: var(--accent-orange); }
.news-divider { margin: 30px 0; border: 0; border-top: 1px solid #eee; }
.news-subtitle { color: var(--text-dark); font-size: 1.3rem; margin-bottom: 15px; opacity: 0.8; }

/* 歷史活動列表 */
.history-list-container { background-color: #f9f9f9; padding: 15px 20px; border-radius: 10px; max-height: 280px; overflow-y: auto; }
.history-list { list-style: none; padding: 0; margin: 0; }
.history-list li { padding: 10px 0; border-bottom: 1px solid #eee; font-size: 1.05rem; }
.history-list li:last-child { border-bottom: none; }
.list-item-content { display: flex; flex-direction: column; }
.list-header { display: flex; align-items: center; margin-bottom: 5px; }
.history-list .date { background-color: #e0e0e0; color: #555; padding: 2px 8px; border-radius: 4px; font-size: 0.9rem; margin-right: 15px; font-weight: bold; min-width: 80px; text-align: center; }
.history-list .date.current-date { background-color: var(--accent-orange); color: white; }
.list-link { color: var(--text-dark); transition: 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-link:hover { color: var(--primary-blue); }
.list-desc { font-size: 0.9rem; color: #666; margin-left: 95px; display: block; line-height: 1.4; }


/* --- 關於與歡迎區塊 --- */
.video-wrapper { margin-top: 2rem; text-align: center; margin-bottom: 5rem; } 
.video-box { width: 100%; border-radius: 20px; box-shadow: 0 15px 40px rgba(0,0,0,0.2); overflow: hidden; background: #000; }
.section-heading { color: var(--primary-blue); margin-bottom: 1.5rem; font-size: 2rem; }

.welcome-section { 
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23dff9ff' fill-opacity='1' d='M0,160L48,176C96,192,192,224,288,208C384,192,480,128,576,90.7C672,53,768,43,864,64C960,85,1056,139,1152,149.3C1248,160,1344,128,1392,112L1440,96L1440,0L1392,0C1344,0,1248,0,1152,0C1056,0,960,0,864,0C768,0,672,0,576,0C480,0,384,0,288,0C192,0,96,0,48,0L0,0Z'%3E%3C/path%3E%3C/svg%3E") no-repeat center bottom / cover, linear-gradient(180deg, #f4f8fb 0%, #e0f7fa 100%); 
    padding: 6rem 0; margin-bottom: 0; width: 100%; position: relative; overflow: hidden; 
}
.welcome-header { text-align: center; margin-bottom: 2rem; }
.welcome-header h2 { font-size: 2.5rem; color: #555; font-weight: 700; margin: 0; }
.welcome-header h1 { font-size: 3.5rem; color: var(--primary-blue); font-weight: 900; margin: 10px 0 0 0; }
.welcome-desc { font-size: 1.1rem; color: #555; line-height: 1.8; margin-bottom: 1.5rem; }
.welcome-right-content { display: flex; flex-direction: column; align-items: center; gap: 2rem; }
.welcome-img { border-radius: 20px; box-shadow: 0 15px 30px rgba(0,0,0,0.2); width: 100%; height: auto; }

/* 核心價值區 */
.values-section { padding: 6rem 0; position: relative; background-color: #ffffff; overflow: hidden; }
.values-section::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('values_bg.jpg'); background-size: cover; background-position: right center; 
    opacity: 0.4; z-index: 0;
}
.values-section .container { position: relative; z-index: 1; }
.section-title { text-align: center; color: var(--primary-blue); font-size: 2.5rem; margin-bottom: 3rem; font-weight: 900; }

.value-card {
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.9); border-radius: 15px; padding: 2.5rem; text-align: center; box-shadow: 0 10px 30px rgba(0, 105, 148, 0.15); transition: transform 0.3s, box-shadow 0.3s; height: 100%; 
    display: flex; flex-direction: column; justify-content: flex-start; align-items: center;
}
.value-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0, 105, 148, 0.25); background: rgba(255, 255, 255, 0.95); }
.value-img { width: 180px; height: 180px; object-fit: cover; border-radius: 50%; margin-bottom: 1.5rem; box-shadow: 0 8px 20px rgba(0,0,0,0.2); border: 5px solid white; }
.value-card h3 { color: #333; font-size: 1.6rem; margin-bottom: 1rem; font-weight: 900; white-space: normal; overflow: visible; text-overflow: clip; width: 100%; padding: 0 10px; line-height: 1.3; }
.value-card p { color: #666; font-size: 1.1rem; line-height: 1.6; }

/* 滾動相框 */
.marquee-container { width: 100%; overflow: hidden; background: var(--text-dark); padding: 30px 0; margin-top: 3rem; margin-bottom: 0; position: relative; z-index: 5; }
.marquee-content { display: flex; gap: 20px; width: max-content; animation: scroll 120s linear infinite; }
.marquee-content img { height: 250px; width: 350px; object-fit: cover; border-radius: 10px; border: 4px solid white; flex-shrink: 0; }
@keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* 內容區塊通用 */
.container { max-width: 1200px; margin: 0 auto; padding: 0 5% 4rem 5%; flex-grow: 1; position: relative; z-index: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; align-items: start; }

/* 頁尾 */
footer { background-color: var(--dark-blue); color: white; position: relative; margin-top: 150px; padding-bottom: 2rem; }
.footer-wave-container { position: absolute; top: -140px; left: 0; width: 100%; height: 145px; overflow: hidden; line-height: 0; z-index: 1; pointer-events: none; }
.footer-wave { position: absolute; bottom: 0; left: 0; width: 200%; height: 100%; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23004d6a' fill-opacity='1' d='M0,224L48,213.3C96,203,192,181,288,181.3C384,181,480,203,576,224C672,245,768,267,864,261.3C960,256,1056,224,1152,197.3C1248,171,1344,149,1392,138.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E"); background-size: 50% 100%; background-repeat: repeat-x; animation: wave-animation 20s linear infinite; }
@keyframes wave-animation { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.footer-content { max-width: 1200px; margin: 0 auto; padding: 2rem 5% 0 5%; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 30px; position: relative; z-index: 2; }
.footer-left, .footer-center, .footer-right { flex: 1; min-width: 280px; color: white; }
.footer-left h3, .footer-center h3, .footer-right h3 { color: var(--secondary-blue); margin-bottom: 1rem; }
.footer-left p { margin-bottom: 0.5rem; font-size: 0.95rem; }
.footer-center { text-align: center; line-height: 1.8; font-size: 0.9rem; padding: 0 15px; }
.footer-center span { display: inline-block; margin: 0 5px; background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 4px; margin-bottom: 5px;}
.footer-nav-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 1rem; }
.footer-nav-grid a { background-color: var(--primary-blue); color: white; padding: 8px 15px; border-radius: 5px; text-align: center; transition: 0.3s; font-size: 0.9rem; }
.footer-nav-grid a:hover { background-color: var(--accent-orange); transform: translateY(-2px); }
.copyright { text-align: center; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; color: rgba(255,255,255,0.7); position: relative; z-index: 2;}

/* -----------------------------------------------------------
   Promotion Page Styles (New for V20.0)
----------------------------------------------------------- */
.promotion-container {
    width: 100%;
    max-width: 100%; /* Full width */
    display: flex;
    justify-content: center;
    background-color: #f0f8ff; /* Light background */
    padding-bottom: 3rem;
}

.full-width-dm {
    width: 100%;
    max-width: 1200px; /* Limit max width for huge screens */
    height: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: block;
}

/* -----------------------------------------------------------
   [新增] 側邊欄頁籤切換樣式
----------------------------------------------------------- */
.tab-buttons {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 15px;
    margin-top: 20px;
}
.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 700;
    color: #888;
    font-size: 1rem;
    transition: 0.3s;
    font-family: 'Noto Sans TC', sans-serif;
}
.tab-btn:hover {
    background-color: #e2e6ea;
    color: var(--primary-blue);
}
/* 被選中時：背景白、字變黑、上緣出現橘色條 */
.tab-btn.active {
    background-color: #fff;
    border-top: 4px solid var(--accent-orange); 
    color: var(--text-dark);
    border-bottom: 2px solid transparent;
}
.tab-content {
    animation: fadeEffect 0.5s;
    display: none; /* 預設隱藏，由 JS 控制顯示 */
}
/* 讓預設的第一個頁籤顯示 */
.tab-content.default-show {
    display: block;
}
@keyframes fadeEffect {
    from {opacity: 0;}
    to {opacity: 1;}
}
/* 修正列表日期標籤顏色 (知識類) */
.knowledge-badge {
    color: white !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-right: 15px;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
    display: inline-block;
}

/* 模擬紅色的播放按鈕 */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255,0,0,0.9); /* YouTube 紅 */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: 0.3s;
    z-index: 10; /* 確保按鈕浮在最上面 */
}

/* 滑鼠移過去時，播放按鈕放大 */
.video-link:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.1);
    background: #ff0000;
}

/* 定義一個「只在手機版生效」的換行標籤 */
.mobile-br {
    display: none; /* 電腦版隱藏 (不換行) */
}


/* ==========================================================================
   手機版 RWD 終極整合版 (V30.0)
   這個區塊必須放在整個 CSS 檔案的最後面！
   ========================================================================== */
@media (max-width: 900px) { 
    /* --- 1. 防止整個網頁左右亂晃 (最重要的一行) --- */
    html, body {
        overflow-x: hidden !important;
        width: 100%;
    }

    /* --- 2. 導覽列 (Navbar) 修正：按鈕自動換行不撐破 --- */
    .navbar { flex-direction: column; gap: 10px; padding: 10px; } 
    .logo { margin-bottom: 5px; }
    .nav-links { 
        justify-content: center; 
        flex-wrap: wrap; 
        width: 100%;
        gap: 8px; 
    } 
    .nav-links a { font-size: 0.85rem; padding: 5px 8px; }
    .btn-signup-nav { width: 100%; text-align: center; margin-top: 5px; }

    /* --- 3. 首頁：大圖海報區 (Hero Section) 縮小留白 --- */
    .hero-section { 
        display: block; 
        text-align: center; 
        padding: 4rem 5% 5rem 5%; 
        min-height: auto;
    }
    .hero-container { display: block; }
    .bg-watermark-absolute {
        position: relative; left: 0; top: 0;
        width: 90%; max-width: 100%;
        margin: 0 auto 1.5rem auto; display: block;
    }
    .hero-text-wrapper {
        width: 100%; max-width: 100%; text-align: center; 
        margin-right: 0; padding-top: 0;
    }
    .hero-title { font-size: 2.4rem; letter-spacing: 1px; line-height: 1.3; } 
    .title-indent { display: block !important; margin-left: 0 !important; } 
    .hero-subtitle { font-size: 1.1rem; margin-top: 10px; }

    /* --- 4. 首頁：招生簡章與最新消息區 (絕對限制寬度) --- */
    .main-content-container { 
        flex-direction: column; align-items: center; gap: 2rem; margin-top: -3rem; 
    }
    .layout-stagger-high, .layout-stagger-low { margin-top: 0; margin-left: 0; }
    .featured-poster-wrapper { flex: auto; max-width: 100%; width: 100%; padding: 0; }
    .featured-poster { transform: rotate(0deg); width: 100%; }
    .poster-badge { font-size: 0.9rem; padding: 5px 10px; transform: rotate(0deg); top: 0; left: 0; }
    
    .news-box { 
        flex: auto; max-width: 100%; width: 100%; 
        padding: 1.5rem; 
        box-sizing: border-box !important; /* 防止 padding 撐大寬度 */
    }
    .news-title { font-size: 1.4rem; line-height: 1.4; }
    .news-content { font-size: 1rem; }

    /* --- 5. 首頁：過往簡章列表 (防止超長文字超出版面) --- */
    .history-list-container { padding: 10px; }
    .list-item-content { width: 100%; }
    .list-header { flex-wrap: wrap; gap: 5px; }
    .history-list .date, .knowledge-badge { margin-right: 5px; }
    .list-link { white-space: normal; font-size: 1rem; line-height: 1.4; }
    .list-desc { margin-left: 0; margin-top: 5px; font-size: 0.9rem; } 

    /* --- 6. 課程介紹頁面：圖片不被切頭 --- */
    .course-feature, .course-feature:nth-child(odd), .course-feature:nth-child(even) {
        flex-direction: column; gap: 20px; padding: 25px;
    }
    .course-img-box, .course-text-box { width: 100%; }
    .course-img-box { height: auto; aspect-ratio: unset; }
    .course-img-box img {
        height: auto; 
        object-fit: contain; 
        object-position: center; 
        width: 100%; 
        border-radius: 10px;
    }

    /* --- 7. 共用格線與其他雜項設定 --- */
    .grid-3, .grid-2 { grid-template-columns: 1fr !important; gap: 20px !important; } 
    .level-grid { grid-template-columns: repeat(2, 1fr); }
    .mobile-br { display: block; margin-top: 5px; content: ""; }
    .page-header p { line-height: 1.6; }

    /* --- 8. Footer (頁尾) 垂直排列 --- */
    .footer-content { flex-direction: column; text-align: center; } 
    .footer-center { order: 3; } 
    .footer-right { order: 2; margin-top: 2rem; } 
    .footer-left { order: 1; } 
    .footer-nav-grid { max-width: 100%; margin: 0 auto; } 
    .footer-wave-container { height: 80px; top: -75px; } 
    footer { margin-top: 80px; } 
    .welcome-header h1 { font-size: 2.2rem; }
}