/* ================================================================ */
/* Schedule Taxonomy - Final CSS (整合優化版 v2)                      */
/* ================================================================ */

/* ============================================================
   1. 播出資訊專用樣式
   ============================================================ */
.schedule-broadcast-date {
    display: inline-block;
    background-color: #f2f2f2;
    color: #555555;
    font-size: 0.9rem;
    padding: 4px 12px;
    border-radius: 12px;
    margin-top: 16px;
    margin-bottom: 8px;
}

.schedule-info-section {
    margin-top: 40px;
}

.broadcast-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.broadcast-grid-column {}

.broadcast-group-label {
    font-size: 1.1em;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.8em;
    display: block;
}

.broadcast-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.broadcast-list-item {
    line-height: 1.6;
    font-size: 0.95rem;
}

.broadcast-list-item a {
    text-decoration: underline;
}

/* ============================================================
   2. 導覽與返回連結
   ============================================================ */
.schedule-back-link { 
    margin-top: 24px;
    margin-bottom: 24px; 
} 

.schedule-back-link a { 
    display: inline-block; 
    padding: 8px 16px; 
    background-color: #f1f1f1; 
    color: #333; 
    font-weight: 500; 
    border-radius: 8px; 
    text-decoration: none; 
    transition: background-color 0.2s; 
}

.schedule-back-link a:hover {
    background-color: #e0e0e0;
}

/* ============================================================
   3. 篩選導覽 (年份/月份) - RWD 滾動優化版 [最終修正]
   ============================================================ */
.rtlist-navigation { 
    margin: 20px 0;
    width: 100%;
    overflow: hidden; /* 防止容器本身產生滾動 */
} 

.top-buttons, 
.month-buttons { 
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto; /* 改用 scroll 強制顯示滾動條 */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 10px 10px 10px 5px;
}

/* 美化滾動條 (Webkit 瀏覽器) */
.top-buttons::-webkit-scrollbar,
.month-buttons::-webkit-scrollbar {
    height: 6px;
}

.top-buttons::-webkit-scrollbar-track,
.month-buttons::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.top-buttons::-webkit-scrollbar-thumb,
.month-buttons::-webkit-scrollbar-thumb {
    background: #d20243;
    border-radius: 10px;
}

.top-buttons::-webkit-scrollbar-thumb:hover,
.month-buttons::-webkit-scrollbar-thumb:hover {
    background: #a80033;
}

/* 篩選按鈕樣式 [簡化版] */
.filter-button { 
    flex: 0 0 auto;
    padding: 10px 20px; 
    margin-right: 16px; /* 使用 margin 取代 gap */
    border: 1px solid #cccccc; 
    background-color: #f9f9f9; 
    border-radius: 8px; 
    font-size: 0.9rem; 
    white-space: nowrap; 
    transition: all 0.2s ease; 
    text-decoration: none; 
    color: #444;
    cursor: pointer;
    user-select: none;
}

.filter-button:last-child {
    margin-right: 0; /* 最後一個按鈕不需要右邊距 */
}

/* 移除複雜的 ::before 動畫,改用簡單的 hover 效果 */
.filter-button:hover { 
    background-color: #d20243; 
    color: #ffffff; 
    border-color: #d20243;
    box-shadow: 0 2px 8px rgba(210, 2, 67, 0.3);
}

.filter-button.active { 
    background-color: #d20243; 
    color: #ffffff; 
    border-color: #d20243; 
    font-weight: 600;
}

.filter-button:focus {
    outline: 2px solid #d20243;
    outline-offset: 2px;
}

.filter-button:active {
    transform: translateY(0);
}

/* ============================================================
   4. 列表顯示區域
   ============================================================ */
.rtlist-display { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 16px; 
    margin: 20px auto; 
}

.rtlist-item { 
    background-color: #ffffff; 
    border-radius: 8px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    transition: transform 0.2s, box-shadow 0.2s;
}

.rtlist-item:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
}

.rtlist-image { 
    position: relative; 
    width: 100%; 
    padding-top: 56.25%; 
    background-color: #f5f5f5; 
}

.rtlist-image img { 
    position: absolute; 
    top: 0; 
    left: 0; 
    height: 100%; 
    width: 100%; 
    object-fit: cover; 
}

.rtlist-image .placeholder-image { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 100%; 
    width: 100%; 
    position: absolute; 
    top: 0; 
    left: 0; 
    color: #aaa; 
    font-weight: 500; 
    text-align: center; 
    padding: 1rem; 
}

.rtlist-content { 
    padding: 16px; 
    display: flex; 
    flex-direction: column; 
    flex: 1; 
}

.rtlist-content h4 { 
    margin: 0 0 8px; 
    font-size: 1.1rem; 
    color: #1f2937; 
} 

.rtlist-content h4 a { 
    text-decoration: none; 
    color: inherit; 
}

.release-date { 
    font-size: 0.85rem; 
    color: #555555; 
    margin-top: auto; 
}

.item-category { 
    font-size: 0.8rem; 
    color: #777; 
    margin-top: 8px; 
    padding-top: 8px; 
    border-top: 1px solid #eee;
}

.no-results { 
    padding: 2rem; 
    text-align: center; 
    color: #777; 
    background: #f9f9f9; 
    border-radius: 8px; 
}

/* ============================================================
   5. 分頁導覽
   ============================================================ */
.pagination-container { 
    margin-top: 20px; 
} 

.pagination { 
    display: flex; 
    justify-content: center; 
    list-style: none; 
    padding: 0; 
    gap: 5px; 
} 

.pagination a, 
.pagination span, 
ul.page-numbers li a, 
ul.page-numbers li span { 
    padding: 8px 12px; 
    border: 1px solid #ccc; 
    background-color: #fff; 
    text-decoration: none; 
    color: inherit; 
    border-radius: 4px; 
} 

.pagination .active span, 
.pagination .page-item.active .page-link, 
ul.page-numbers li .current { 
    background-color: #d20243; 
    color: #fff; 
    border-color: #d20243; 
} 

.pagination a:hover, 
ul.page-numbers li a:hover { 
    background-color: #e0e0e0; 
} 

.pagination .dots, 
ul.page-numbers li .dots { 
    border: none; 
    background: none; 
}

/* ============================================================
   6. 標題與描述
   ============================================================ */
h1.schedule-page-title { 
    font-size: 2rem; 
    font-weight: 700; 
    color: #111; 
    border-bottom: 3px solid #d20243; 
    padding-bottom: 8px; 
    margin: 24px 0 16px; 
}

.schedule-broadcast { 
    display: inline-block; 
    background-color: #f2f2f2; 
    color: #555555; 
    font-size: 0.9rem; 
    padding: 4px 12px; 
    border-radius: 12px; 
    margin-bottom: 16px; 
}

.broadcast-note { 
    font-size: 0.9em; 
    color: #777; 
}

.schedule-description { 
    border-left: 4px solid #d20243; 
    padding-left: 16px; 
    color: #333333; 
    line-height: 1.7; 
    margin-bottom: 24px; 
}

.schedule-description p { 
    margin-block-start: 0px; 
    margin-block-end: 0px;
    font-size: 1rem;
}

/* ============================================================
   7. 搜尋功能
   ============================================================ */
.schedule-search-container { 
    margin: 24px 0; 
}

.schedule-search-form { 
    margin-bottom: 12px; 
}

.search-input-group { 
    position: relative; 
    display: flex; 
    align-items: center; 
    max-width: 500px; 
}

.schedule-search-input { 
    flex: 1; 
    padding: 12px 50px 12px 16px; 
    border: 2px solid #e1e5e9; 
    border-radius: 8px; 
    font-size: 1rem; 
    background-color: #fff;
    transition: border-color 0.2s;
}

.schedule-search-input:focus { 
    outline: none; 
    border-color: #d20243; 
    box-shadow: 0 0 0 3px rgba(210, 2, 67, 0.1);
}

.schedule-search-button { 
    position: absolute; 
    right: 32px; 
    background: none; 
    border: none; 
    color: #666; 
    cursor: pointer; 
    padding: 8px; 
    transition: color 0.2s;
}

.schedule-search-button:hover { 
    color: #d20243; 
}

.schedule-search-button:focus,
.schedule-clear-search:focus {
    outline: 2px solid #d20243;
    outline-offset: 2px;
    border-radius: 4px;
}

.schedule-clear-search { 
    position: absolute; 
    right: 8px; 
    background: none; 
    border: none; 
    color: #999; 
    cursor: pointer; 
    padding: 8px; 
    transition: color 0.2s;
    text-decoration: none;
}

.schedule-clear-search:hover { 
    color: #d20243; 
}

.search-results-info { 
    color: #666; 
    font-size: 0.9rem; 
    padding: 8px 12px; 
    background-color: #f8f9fa; 
    border-radius: 6px; 
    border-left: 4px solid #d20243;
}

.search-summary { 
    margin-bottom: 20px; 
    padding: 12px; 
    background-color: #e8f4fd; 
    border-radius: 6px; 
    color: #2c5282;
}

.search-scope { 
    color: #888; 
    font-style: italic; 
}

.search-highlight {
    background-color: rgba(210, 2, 67, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

/* ============================================================
   8. 終端頁詳細資訊區塊
   ============================================================ */
.schedule-section-title { 
    font-size: 1.5rem; 
    font-weight: 700; 
    color: #111; 
    border-bottom: 3px solid #d20243; 
    padding-bottom: 8px; 
    margin: 40px 0 20px; 
}

.info-grid-item .schedule-section-title { 
    margin-top: 0; 
}

.schedule-content-box { 
    background-color: #fdfdfd; 
    padding: 20px; 
    border-radius: 8px; 
    border: 1px solid #eee; 
}

.schedule-content-box p { 
    margin: 0 0 1em; 
    line-height: 1.7; 
    font-size: 1rem;
}

.schedule-content-box p:last-child { 
    margin-bottom: 0; 
}

.schedule-content-box p > strong { 
    display: block; 
    margin-bottom: 0.5em; 
    color: #111; 
    font-size: 1.05em; 
}

.schedule-copyright { 
    text-align: center; 
    color: #777; 
    font-size: 0.9rem; 
    background: #f9f9f9; 
    padding: 15px; 
    border-radius: 8px; 
}

/* ============================================================
   9. 終端頁排版
   ============================================================ */
.terminal-header-grid { 
    display: grid; 
    grid-template-columns: 300px 1fr; 
    gap: 24px; 
    margin: 24px 0; 
    align-items: flex-start; 
}

.terminal-image-container { 
    width: 100%; 
    position: relative; 
}

.terminal-image-container img { 
    width: 100%; 
    height: auto; 
    display: block; 
    border-radius: 8px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
}

.terminal-image-container .placeholder-image { 
    position: relative; 
    width: 100%; 
    padding-top: 141%; 
    background-color: #f5f5f5; 
    border-radius: 8px; 
}

.terminal-image-container .placeholder-image span { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 100%; 
    width: 100%; 
    position: absolute; 
    top: 0; 
    left: 0; 
    color: #aaa; 
    font-weight: 500; 
    text-align: center; 
    padding: 1rem; 
}

.terminal-summary-container .schedule-broadcast { 
    margin-top: 0; 
}

.terminal-summary-container .schedule-description { 
    margin-bottom: 0; 
}

.terminal-summary-container h2 {
    padding-bottom: 20px;
}

.note-container { 
    margin-bottom: 40px; 
    color: #555; 
    font-size: 0.9em; 
    background-color: #f9f9f9; 
    padding: 20px; 
    border-radius: 8px; 
}

.note-container p:last-child { 
    margin-bottom: 0; 
}

.info-grid-container { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 24px; 
    margin-top: 40px; 
}

.full-width-info-box { 
    margin-top: 40px; 
}

.music-grid-container { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
}

.music-divider { 
    border: 0; 
    border-top: 1px solid #eee; 
    margin: 20px 0; 
}

.text-link-list p { 
    margin-bottom: 0.8em; 
    font-size: 1em; 
}

.text-link-list p:last-child { 
    margin-bottom: 0; 
}

.text-link-list a { 
    color: #d20243; 
    text-decoration: underline; 
    word-break: break-all; 
}

.text-link-list a:hover { 
    text-decoration: none; 
}

/* ============================================================
   10. 響應式設計 (RWD)
   ============================================================ */
@media (max-width: 768px) {
    /* 篩選按鈕在小螢幕上的調整 */
    .top-buttons, 
    .month-buttons {

    }
    
    .filter-button {
        padding: 8px 16px;
        margin-right: 12px;
        font-size: 0.85rem;
    }
    
    /* 播出平台格線變單欄 */
    .broadcast-grid-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* 終端頁排版變單欄 */
    .terminal-header-grid, 
    .info-grid-container, 
    .music-grid-container { 
        grid-template-columns: 1fr;
    }
    
    /* 標題字型縮小 */
    h1.schedule-page-title, 
    .schedule-section-title { 
        font-size: 1.6rem; 
    } 
    
    .rtlist-content h4 { 
        font-size: 1rem; 
    }
    
    /* 搜尋框調整 */
    .search-input-group { 
        max-width: 100%; 
    }
    
    .schedule-search-input { 
        font-size: 16px; /* 防止 iOS 自動縮放 */
    }
    
    /* 列表變單欄 */
    .rtlist-display { 
        grid-template-columns: 1fr; 
        gap: 12px;
    }
}

@media (max-width: 480px) {
    /* 搜尋按鈕位置調整 */
    .schedule-search-input { 
        padding: 10px 45px 10px 12px; 
    }
    
    .schedule-search-button { 
        right: 28px; 
    }
    
    .schedule-clear-search { 
        right: 6px; 
    }
    
    /* 更小的標題 */
    h1.schedule-page-title { 
        font-size: 1.4rem; 
    }
    
    .schedule-section-title { 
        font-size: 1.3rem; 
    }
    
    /* 列表項目間距 */
    .rtlist-item { 
        margin-bottom: 12px; 
    }
    
    .rtlist-content { 
        padding: 12px; 
    }
    
    /* 篩選按鈕更小 */
    .filter-button {
        padding: 6px 12px;
        margin-right: 10px;
        font-size: 0.8rem;
    }
}

/* ============================================================
   11. 列印樣式
   ============================================================ */
@media print {
    .schedule-search-container,
    .rtlist-navigation,
    .pagination-container {
        display: none;
    }
    
    .rtlist-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ============================================================
   12. 滾動行為優化 (補充)
   ============================================================ */
html {
    scroll-behavior: smooth;
}

/* 確保按鈕容器不會因為內容過多而破版 */
.rtlist-navigation {
    max-width: 100%;
    overflow: hidden;
}
