/* 基础样式 */
body {
    color: #FFFFFF;
    line-height: 1.8;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#main_box {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    padding: 8px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5);
}

#logo_box {
    padding: 10px 0;
    color:#009ad6;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#input_box {
    position: relative;
    width: calc(100% - 40px);
    height: 30px;
    margin-bottom: 15px;
    border: 2px solid rgba(14, 144, 210, 0.8);
    border-radius: 8px;
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

#url_box {
    width: 85%;
    padding: 8px 12px;
    border: 0;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: #333;
}

#url_btn {
    width: 15%;
    min-width: 30px;
    background-color: rgba(14, 144, 210, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

#url_btn:hover {
    background-color: rgba(14, 144, 210, 1);
}

#btn_logo {
    width: 18px;
    height: 18px;
    fill: #ffffff;
}

#play_history {
    position: absolute;
    top: 42px;
    left: 0;
    width: 100%;
    z-index: 9999;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    background: #fff;
    color: #333;
    text-align: left;
    display: none;
    max-height: 300px;
    overflow-y: auto;
}
/* 历史记录标题栏样式更新 */
#play_history .history_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 14px;
}

#play_history .history_title {
    font-weight: bold;
    color: #333;
}

#play_history .history_actions {
    display: flex;
    gap: 12px;
}

#play_history .history_close,
#play_history .history_clear {
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    padding: 4px;
    border-radius: 4px;
}

#play_history .history_close:hover {
    color: #0e90d2;
    background-color: #e3f2fd;
}

#play_history .history_clear:hover {
    color: #ff0000;
    background-color: #ffebee;
}

/* 历史记录条目样式微调 */
#play_history .history_item {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#play_history .history_item:hover {
    background: #f0f8ff;
    color: #0e90d2;
}


/* 主内容区域 */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-radius: 5px;
    overflow: hidden;
}

@media (min-width: 992px) {
    .main-content {
        flex-direction: row;
    }
}

/* 视频区域 - 关键修复 */
#video_box {
    flex: 1;
    width: 100%;
    background: #000;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 5px 5px rgba(0,0,0,0.3);
    
    /* 保持16:9宽高比 */
    aspect-ratio: 16/9;
}

#video_player {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    object-fit: cover; /* 保持比例，可能有黑边 */
	object-position: center;
}

/* 侧边栏样式 */
.sidebar {
    width: 100%;
    background: rgba(30, 30, 46, 0.9);
    border-radius: 10px;
    padding: 6px;
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

@media (min-width: 992px) {
    .sidebar {
        width: 300px;
    }
}

/* 移动设备优化 - 关键修复 */
@media (max-width: 991px) {
    body {
        padding: 5px; /* 减少整体内边距 */
    }
    
    #main_box {
        padding: 15px; /* 减少内边距 */
    }
    
    .main-content {
        gap: 10px; /* 减少间隙 */
    }
    
    #video_box {
        margin-bottom: 0; /* 移除底部外边距 */
    }
    
    .sidebar {
        width: 100%;
        padding: 8px; /* 减少内边距 */
        margin-top: 0; /* 移除顶部外边距 */
    }
    
    .sidebar-section {
        margin-bottom: 5px;
    }
    
    .section-title {
        font-size: 14px;
        margin: 3px 0;
    }
    
    .channel-item, .category-item-container, .entry-item {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .entries-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 4px;
    }
}

.sidebar-header {
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.sidebar-title {
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4cc9f0;
    margin-bottom: 10px;
}

/* 搜索框样式 */
.sidebar-search {
    display: flex;
    width: 100%;
    margin-top: 5px;
}

#sidebar-search-input {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 0 20px 20px 0; /* 右侧圆角 */
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
}

#sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#sidebar-search-btn {
    background: rgba(76, 201, 240, 0.7);
    border: none;
    border-radius: 20px 0 0 20px; /* 左侧圆角 */
    padding: 0 15px;
    cursor: pointer;
    transition: background 0.3s;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sidebar-search-btn:hover {
    background: rgba(76, 201, 240, 1);
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-section {
    margin-bottom: 3px;
    margin-top: 0;
}

.section-title {
    font-size: 15px;
    margin-top: 5px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #a8c7fa;
}

/* 滚动区域 */
.channels-scroll, .category-scroll {
    max-height: 100px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

/* 列表样式 */
.channel-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 8px;
}

.channel-item {
    padding: 6px 12px;
    background: rgba(67, 97, 238, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.channel-item:hover, .channel-item.active {
    background: rgba(67, 97, 238, 0.8);
    transform: translateY(-2px);
}

.category-grid {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 8px;
    white-space: nowrap;
}

.category-item-container {
    padding: 6px 12px;
    background: rgba(114, 9, 183, 0.3);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.category-item-container:hover, .category-item-container.active {
    background: rgba(114, 9, 183, 0.8);
    transform: translateY(-2px);
}

.entries-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 300px;
}

.entries-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 5px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.entry-item {
    padding: 6px;
    background: rgba(247, 37, 133, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.entry-item:hover {
    background: rgba(247, 37, 133, 0.6);
    transform: translateY(-3px);
}

.entry-item.active {
    background: rgba(247, 37, 133, 0.8);
    box-shadow: 0 0 0 2px #fff;
}

.entry-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    color: rgba(255, 255, 255, 0.8);
    justify-content: center;
    font-size: 14px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #4cc9f0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(67, 97, 238, 0.6);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(67, 97, 238, 0.8);
}

/* 搜索结果弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.modal-content {
    background-color: #1e1e2e;
    margin: 5% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    color: #4cc9f0;
    font-size: 24px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover,
.close:focus {
    color: white;
    text-decoration: none;
}

.modal-body {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 30px;
    font-size: 18px;
    color: #a8c7fa;
}

.no-results {
    text-align: center;
    padding: 30px;
    font-size: 18px;
    color: #f72585;
}

.search-summary {
    padding: 10px 0;
    margin-bottom: 15px;
    color: #4cc9f0;
    font-size: 16px;
    border-bottom: 1px solid rgba(76, 201, 240, 0.3);
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.search-result-item {
    background: rgba(114, 9, 183, 0.3);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.search-result-item:hover {
    background: rgba(114, 9, 183, 0.6);
    transform: translateY(-3px);
}

.result-name {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 16px;
}

.result-category {
    font-size: 14px;
    color: #a8c7fa;
}

.highlight {
    background-color: #f72585;
    color: white;
    padding: 0 2px;
    border-radius: 3px;
}
