/* ==========================================================================
   PixelShare 新版主题切换按钮样式
   ========================================================================== */

/* 隐藏原有切换按钮的input和slider */
.menu-theme-switch .theme-toggle input {
    display: none !important;
}

.menu-theme-switch .theme-toggle .slider {
    display: none !important;
}

/* 重新设计切换按钮容器 */
.menu-theme-switch {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.menu-theme-switch .theme-toggle {
    position: relative !important;
    width: 62px !important;
    height: 28px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 25px !important;
    cursor: pointer !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 2px !important;
}

/* 暗黑模式背景 */
body.dark-theme .menu-theme-switch .theme-toggle {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.4) !important;
}

/* 切换滑块 */
.menu-theme-switch .theme-toggle::before {
    content: '☀️' !important;
    position: absolute !important;
    top: 50% !important;
    left: 2px !important;
    width: 22px !important;
    height: 22px !important;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%) !important;
    border-radius: 50% !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    z-index: 2 !important;
    transform: translateY(-50%) !important;
}

body.dark-theme .menu-theme-switch .theme-toggle::before {
    content: '🌙' !important;
    transform: translateY(-50%) translateX(30px) !important;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%) !important;
}

/* 背景装饰元素 */
.menu-theme-switch .theme-toggle::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    right: 8px !important;
    width: 16px !important;
    height: 16px !important;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%) !important;
    border-radius: 50% !important;
    transform: translateY(-50%) !important;
    transition: all 0.4s ease !important;
    opacity: 0.7 !important;
}

/* 悬停效果 */
.menu-theme-switch .theme-toggle:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

body.dark-theme .menu-theme-switch .theme-toggle:hover {
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.5) !important;
}

.menu-theme-switch .theme-toggle:hover::after {
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.2) !important;
}

/* 点击动画 */
.menu-theme-switch .theme-toggle:active {
    transform: scale(0.95) !important;
}

.menu-theme-switch .theme-toggle:active::before {
    transform: translateY(-50%) scale(0.9) !important;
}

body.dark-theme .menu-theme-switch .theme-toggle:active::before {
    transform: translateY(-50%) translateX(30px) scale(0.9) !important;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .menu-theme-switch .theme-toggle {
        width: 50px !important;
        height: 26px !important;
        padding: 2px !important;
    }
    
    .menu-theme-switch .theme-toggle::before {
        width: 22px !important;
        height: 22px !important;
        font-size: 10px !important;
        left: 2px !important;
    }
    
    body.dark-theme .menu-theme-switch .theme-toggle::before {
        transform: translateY(-50%) translateX(24px) !important;
    }
    
    body.dark-theme .menu-theme-switch .theme-toggle:active::before {
        transform: translateY(-50%) translateX(24px) scale(0.9) !important;
    }
    
    .menu-theme-switch .theme-toggle::after {
        right: 6px !important;
        width: 12px !important;
        height: 12px !important;
    }
}

/* 无障碍支持 */
.menu-theme-switch .theme-toggle:focus {
    outline: 2px solid #667eea !important;
    outline-offset: 2px !important;
}

body.dark-theme .menu-theme-switch .theme-toggle:focus {
    outline: 2px solid #74b9ff !important;
}

.menu-theme-switch .theme-toggle:focus-visible {
    outline: 2px solid #667eea !important;
    outline-offset: 2px !important;
}

/* PixelShare 主题切换按钮增强样式 */

/* 基础切换按钮样式 */
.theme-toggle {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    transition: all 0.3s ease;
}

/* 侧边栏中的主题切换按钮 */
.more-menu-wrap .menu-theme-switch {
    position: relative;
}

.more-menu-wrap .menu-theme-switch .theme-toggle {
    position: relative;
    overflow: hidden;
}

/* 波纹效果容器 */
.ripple-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: inherit;
    overflow: hidden;
}

/* 波纹动画 */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

/* 波纹动画容器 */
.menu-theme-switch .theme-toggle .ripple {
    position: absolute !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.6) !important;
    transform: scale(0) !important;
    animation: ripple-animation 0.6s linear !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* 深色主题下的波纹效果 */
.dark-theme .ripple {
    background: rgba(255, 255, 255, 0.2);
}

/* 浅色主题下的波纹效果 */
.white-theme .ripple,
body:not(.dark-theme) .ripple {
    background: rgba(0, 0, 0, 0.1);
}

/* 切换按钮悬停效果 */
.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dark-theme .theme-toggle:hover {
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

/* 切换按钮焦点样式 */
.theme-toggle:focus-within {
    outline: 2px solid var(--primary-color, #007cba);
    outline-offset: 2px;
}

/* 切换按钮激活状态 */
.theme-toggle:active {
    transform: scale(0.95);
}

/* 侧边栏特定样式 */
.more-menu-wrap .qk-flex {
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.more-menu-wrap .qk-flex span {
    font-size: 14px;
    color: var(--text-color);
}

.more-menu-wrap .menu-theme-switch {
    margin-left: auto;
}

/* 确保侧边栏切换按钮可见性 */
.more-menu-wrap .menu-theme-switch .theme-toggle {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.more-menu-wrap .menu-theme-switch .theme-toggle input {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 加载动画 */
.menu-theme-switch .theme-toggle.loading {
    pointer-events: none !important;
}

.menu-theme-switch .theme-toggle.loading::before {
    animation: loading-pulse 1s ease-in-out infinite !important;
}

/* 星星装饰动画 */
body.dark-theme .menu-theme-switch .theme-toggle::after {
    content: '✨' !important;
    font-size: 10px !important;
    background: none !important;
    width: auto !important;
    height: auto !important;
    animation: star-twinkle 2s ease-in-out infinite !important;
}

/* 动画定义 */
@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes loading-pulse {
    0%, 100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translateY(-50%) scale(1.1);
    }
}

@keyframes star-twinkle {
    0%, 100% {
        opacity: 0.7;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.2);
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .menu-theme-switch .theme-toggle {
        border: 3px solid #000 !important;
        background: #fff !important;
    }
    
    body.dark-theme .menu-theme-switch .theme-toggle {
        border: 3px solid #fff !important;
        background: #000 !important;
    }
    
    .menu-theme-switch .theme-toggle::before {
        background: #000 !important;
        color: #fff !important;
    }
    
    body.dark-theme .menu-theme-switch .theme-toggle::before {
        background: #fff !important;
        color: #000 !important;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .theme-toggle {
        transform: none;
    }
    
    .theme-toggle:hover {
        transform: none;
        box-shadow: none;
    }
    
    .theme-toggle:active {
        transform: scale(0.95);
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    .theme-toggle,
    .ripple {
        transition: none;
        animation: none;
    }
    
    .menu-theme-switch .theme-toggle,
    .menu-theme-switch .theme-toggle::before,
    .menu-theme-switch .theme-toggle::after {
        transition: none !important;
        animation: none !important;
    }
    
    .menu-theme-switch .theme-toggle .ripple {
        animation: none !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .theme-toggle:focus-within {
        outline: 3px solid;
        outline-offset: 3px;
    }
}