/* 设置面板样式 - 精确控制动画触发版本 */

/* Beta功能样式 */
.beta-notice {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #ffc107;
}

.beta-toggle {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 4px;
    padding: 6px 12px;
    color: #ffc107;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.beta-toggle:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.5);
}

.beta-features {
    border-left: 2px solid rgba(255, 193, 7, 0.3);
    padding-left: 10px;
    margin-top: 10px;
}

/* 禁用默认的transform transition，避免与动画冲突 */
body.settings-open.settings-animated header,
body.settings-open.settings-animated .container,
body.settings-open.settings-animated .video-player,
body.settings-open.settings-animated .mode-switcher,
body.settings-open.settings-animated .breadcrumb,
body.settings-open.settings-animated .category-grid,
body.settings-open.settings-animated .video-items,
body.settings-open.settings-animated .announcement,
body.settings-open.settings-animated .search-box,
body.settings-open.settings-animated .video-item,
body.settings-open.settings-animated .category-card {
    transition: none !important;
}

/* 排除标题文字，不参与躲避动画 */
body.settings-open.settings-animated header h1 {
    animation: none !important;
    transform: none !important;
}

/* 设置面板打开时的全局动画状态 - 只在有settings-animated类时触发 */
body.settings-open.settings-animated header {
    animation: avoidanceElastic 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

body.settings-open.settings-animated .container {
    animation: avoidanceElastic 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.05s forwards;
}

body.settings-open.settings-animated .video-player {
    animation: avoidanceElasticVideo 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s forwards;
    filter: brightness(0.9);
}

body.settings-open.settings-animated .mode-switcher {
    animation: avoidanceElastic 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.08s forwards;
}

body.settings-open.settings-animated .breadcrumb {
    animation: avoidanceElastic 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.06s forwards;
}

body.settings-open.settings-animated .category-grid {
    animation: avoidanceElastic 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.12s forwards;
}

body.settings-open.settings-animated .video-items {
    animation: avoidanceElastic 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.12s forwards;
}

/* 移除通知栏的动画效果 */
body.settings-open.settings-animated .announcement {
    /* 不应用动画 */
}

body.settings-open.settings-animated .search-box {
    animation: avoidanceElastic 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.04s forwards;
}

/* 设置面板关闭时的返回动画 - 只在有settings-animated类时触发 */
body:not(.settings-open).settings-animated header,
body:not(.settings-open).settings-animated .container,
body:not(.settings-open).settings-animated .mode-switcher,
body:not(.settings-open).settings-animated .breadcrumb,
body:not(.settings-open).settings-animated .category-grid,
body:not(.settings-open).settings-animated .video-items,
body:not(.settings-open).settings-animated .search-box {
    animation: returnElastic 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

body:not(.settings-open).settings-animated header h1 {
    animation: none !important;
    transform: none !important;
}

body:not(.settings-open).settings-animated .video-player {
    animation: returnElasticVideo 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    filter: brightness(1);
}

/* 移除通知栏的返回动画效果 */
body:not(.settings-open).settings-animated .announcement {
    /* 不应用动画 */
}

body:not(.settings-open).settings-animated .video-item,
body:not(.settings-open).settings-animated .category-card {
    animation: returnElastic 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* 视频卡片的个别动画效果 - 只在有settings-animated类时触发 */
body.settings-open.settings-animated .video-item:nth-child(odd) {
    animation: avoidanceElasticItem 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.15s forwards;
}

body.settings-open.settings-animated .video-item:nth-child(even) {
    animation: avoidanceElasticItemSmall 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.18s forwards;
}

/* 分类卡片的个别动画效果 */
body.settings-open .category-card:nth-child(1) {
    animation: avoidanceElasticCard1 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.1s forwards;
}

body.settings-open .category-card:nth-child(2) {
    animation: avoidanceElasticCard2 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.12s forwards;
}

body.settings-open .category-card:nth-child(3) {
    animation: avoidanceElasticCard3 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.14s forwards;
}

body.settings-open .category-card:nth-child(n+4) {
    animation: avoidanceElasticItemSmall 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.16s forwards;
}

/* 为背景添加遮罩效果 */
body.settings-open::before {
    opacity: 0.7;
    transition: opacity 0.4s ease;
}

/* 设置按钮 */
.settings-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: rgba(73, 73, 73, 0.503);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.settings-button:hover {
    background-color: rgba(54, 54, 54, 0.4);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.settings-button:active {
    transform: scale(0.95) rotate(180deg);
    transition: all 0.2s ease;
}

.settings-button.active {
    transform: rotate(180deg) scale(1.1);
    background-color: rgba(0, 150, 136, 0.8);
    box-shadow: 0 6px 20px rgba(0, 150, 136, 0.4);
}

/* 设置侧边栏 */
.settings-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background-color: rgba(106, 106, 106, 0.363);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 20px;
    overflow-y: auto;
    /* 隐藏滚动条 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 和 Edge */
    will-change: right; /* 优化性能 */
}

.settings-sidebar::-webkit-scrollbar {
    display: none; /* Chrome, Safari 和 Opera */
}

.settings-sidebar.active {
    right: 0;
    box-shadow: -15px 0 30px rgba(0, 0, 0, 0.3);
}

/* 设置项进入动画 */
.settings-sidebar.active .setting-item {
    animation: settingsItemSlide 0.4s ease-out forwards;
}

.settings-sidebar.active .setting-item:nth-child(1) {
    animation-delay: 0.1s;
}

.settings-sidebar.active .setting-item:nth-child(2) {
    animation-delay: 0.15s;
}

.settings-sidebar.active .setting-item:nth-child(3) {
    animation-delay: 0.2s;
}

.settings-sidebar.active .setting-item:nth-child(4) {
    animation-delay: 0.25s;
}

.settings-sidebar.active .setting-item:nth-child(5) {
    animation-delay: 0.3s;
}

.settings-sidebar.active .setting-item:nth-child(6) {
    animation-delay: 0.35s;
}

/* 移动端响应式调整 */
@media (max-width: 500px) { /* 降低断点，避免在768px附近突变 */
    .settings-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .settings-sidebar.active {
        right: 0;
    }
    
    /* 移动端的躲避动画幅度减小 */
    body.settings-open header,
    body.settings-open .container,
    body.settings-open .video-player,
    body.settings-open .mode-switcher,
    body.settings-open .breadcrumb,
    body.settings-open .category-grid,
    body.settings-open .video-items,
    body.settings-open .announcement,
    body.settings-open .search-box {
        animation: none;
        transform: none;
    }
}

@media (max-width: 480px) {
    .settings-sidebar {
        padding: 15px;
    }
    
    .settings-button {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

/* 设置头部 */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.settings-header h2 {
    margin: 0;
    color: white;
}

/* 设置项目 */
.setting-item {
    margin-bottom: 25px;
    border-radius: 12px;
    background-color: rgba(40, 40, 40, 0.3);
    padding: 15px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(30px);
}

/* 设置项目头部 */
.setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.setting-header h3 {
    margin: 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    display: flex;
    align-items: center;
}

/* 设置内容区域 */
.setting-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
    margin-top: 10px;
}

.setting-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
}

/* 折叠图标 */
.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 18px;
    margin-left: 8px;
    color: rgba(177, 177, 177, 0.95);
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

/* 设置表单元素 */
.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: white;
    font-weight: bold;
}

.setting-item select,
.setting-item input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

/* 音效和文本选择框的自定义样式 */
.settings-select {
    width: 100%;
    padding: 12px 20px;
    background: rgba(66, 66, 66, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.6)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
    padding-right: 45px;
    background-color: rgba(66, 66, 66, 0.85);
}

.settings-select:focus {
    border-color: rgba(0, 176, 155, 0.6);
    background: rgba(66, 66, 66, 0.25);
    box-shadow: 0 0 10px rgba(0, 176, 155, 0.2);
}

.settings-select:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background-color: rgba(66, 66, 66, 0.2);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.6)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-size: 27px; /* 放大箭头图标35% */
    background-position: right 15px center; /* 保持箭头位置不变 */
}

.settings-select option {
    background: rgba(66, 66, 66, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border: none;
}

/* 确保下拉框背景也是模糊的 */
.settings-select {
    background-color: rgba(66, 66, 66, 0.85) !important;
}

/* 修改下拉箭头背景，使其与模糊背景协调 */
.settings-select::-ms-expand {
    background-color: transparent;
    border: none;
}

/* 修改下拉框打开时的背景 */
.settings-select:focus {
    background-color: rgba(66, 66, 66, 0.85) !important;
}

/* 自定义输入框样式 */
.settings-input {
    width: 100%;
    padding: 12px 20px;
    background: rgba(66, 66, 66, 0.15);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: rgba(210, 210, 210, 0.9);
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
}

.settings-input:focus {
    border-color: rgba(0, 176, 155, 0.6);
    background: rgba(66, 66, 66, 0.25);
}

/* 背景预览 */
.background-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    margin-top: 10px;
    border-radius: 8px;
}

/* 音量滑块样式 */
.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.2);
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00b09b;
    cursor: pointer;
    transition: background 0.3s ease;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00b09b;
    cursor: pointer;
    transition: background 0.3s ease;
    border: none;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #00d4aa;
}

.volume-slider::-moz-range-thumb:hover {
    background: #00d4aa;
}

/* 保存设置按钮 */
.save-settings {
    background-color: #4CAF50;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.save-settings:hover {
    background-color: #45a049;
}

/* 设置面板遮罩层 */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-overlay.fade-in {
    opacity: 1;
}

.settings-overlay.fade-out {
    opacity: 0;
}
}
