/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 頁面容器 */
.page {
    display: none;
    min-height: 100vh;
    background-color: #fff;
}

.page.active {
    display: block;
}

/* 頭部 */
.header {
    background-color: #cc0000;
    color: #fff;
    padding: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.header h1 {
    font-size: 18px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.btn-back {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 5px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    position: absolute;
    left: 15px;
}

.btn-back:hover {
    background: rgba(255,255,255,0.3);
}

/* 內容區域 */
.content {
    padding: 15px;
    padding-bottom: 80px;
    min-height: calc(100vh - 120px);
}

/* 分類列表 */
.category-list {
    list-style: none;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.category-list li {
    border-bottom: 1px solid #eee;
}

.category-list li:last-child {
    border-bottom: none;
}

.category-list a {
    display: block;
    padding: 18px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    transition: background-color 0.2s;
}

.category-list a:hover {
    background-color: #f0f0f0;
}

.category-list a:active {
    background-color: #e0e0e0;
}

/* 搜索框 */
.search-box {
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #cc0000;
}

/* 頻道列表 */
.channel-list {
    list-style: none;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.channel-list li {
    border-bottom: 1px solid #eee;
}

.channel-list li:last-child {
    border-bottom: none;
}

.channel-list a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.2s;
}

.channel-list a:hover {
    background-color: #f0f0f0;
}

.channel-list a:active {
    background-color: #e0e0e0;
}

/* 播放器容器 */
.player-container {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
    padding-top: 56.25%; /* 16:9 比例 */
}

.player-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 播放器控制 */
.player-controls {
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.route-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-selector label {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

.route-selector select {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: #fff;
    outline: none;
}

/* EPG 區域 */
.epg-section {
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.epg-section h3 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #333;
}

/* 日期導航 */
.date-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    -webkit-overflow-scrolling: touch;
}

.date-nav a {
    flex-shrink: 0;
    padding: 8px 15px;
    background: #f0f0f0;
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    font-size: 13px;
    transition: all 0.2s;
}

.date-nav a:hover {
    background: #e0e0e0;
}

.date-nav a.active {
    background: #cc0000;
    color: #fff;
}

/* EPG 列表 */
.epg-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.epg-list li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.epg-list li:last-child {
    border-bottom: none;
}

.epg-list .time {
    color: #666;
    font-size: 14px;
    min-width: 50px;
}

.epg-list .program {
    flex: 1;
    margin-left: 15px;
    font-size: 14px;
}

.epg-list .status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 10px;
    background: #e0e0e0;
    color: #666;
}

.epg-list .status.live {
    background: #cc0000;
    color: #fff;
}

.epg-list .status.replay {
    background: #4CAF50;
    color: #fff;
}

/* 底部 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #333;
    color: #999;
    text-align: center;
    padding: 12px;
    font-size: 12px;
}

/* 載入中 */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 響應式設計 */
@media (max-width: 480px) {
    .header h1 {
        font-size: 16px;
    }
    
    .category-list a {
        padding: 15px;
        font-size: 15px;
    }
    
    .channel-list a {
        padding: 12px 15px;
        font-size: 14px;
    }
}

/* 動畫 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page.active {
    animation: fadeIn 0.2s ease-out;
}
