/* CSS代码保护样式 */

/* 基础保护 - 禁用文本选择和右键（调整为不影响正常显示） */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* 允许正常的UI元素交互 */
*, *:before, *:after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* 允许表单元素的文本选择 */
input, textarea, [contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* 隐藏开发者工具检测元素 */
.dev-tools-detector {
    position: absolute;
    top: -9999px;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* 保护提示样式 */
.protection-toast {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    background: #ff6b6b !important;
    color: white !important;
    padding: 15px 20px !important;
    border-radius: 5px !important;
    z-index: 999999 !important;
    font-size: 14px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    animation: slideInRight 0.3s ease !important;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 开发者工具检测覆盖层 */
.dev-tools-warning {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.95) !important;
    color: #ff6b6b !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    font-family: 'Courier New', monospace !important;
    font-size: 24px !important;
    text-align: center !important;
    cursor: not-allowed !important;
}

/* 假内容和干扰元素 */
.fake-content {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
}

/* 反调试样式 */
.anti-debug {
    content: "debugger";
    display: none;
}

/* 隐藏源码提示 */
.source-hidden::before {
    content: "/* 源码已被保护和混淆 */";
    display: none;
}

/* 混淆类名映射（示例） */
._obf1 { /* 原 .header */ }
._obf2 { /* 原 .navbar */ }
._obf3 { /* 原 .content */ }
._obf4 { /* 原 .footer */ }

/* 媒体查询保护 */
@media print {
    * {
        display: none !important;
    }
    
    body::before {
        content: "此页面不允许打印";
        display: block !important;
        font-size: 24px;
        text-align: center;
        color: red;
        margin-top: 50px;
    }
}

/* 防止框选和拖拽（保持正常显示） */
img, video, audio, iframe {
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    user-drag: none !important;
    /* 移除 pointer-events: none; 以保持正常交互 */
}

/* 允许必要的交互元素 */
button, a, input, textarea, select {
    pointer-events: auto !important;
}

/* 滚动条自定义以隐藏原生样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* 隐藏调试相关元素 */
[data-debug], 
[class*="debug"], 
[id*="debug"],
.console-log,
.debug-info {
    display: none !important;
    visibility: hidden !important;
}

/* 保护重要内容不被复制 */
.protected-content {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    position: relative;
}

.protected-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1;
    pointer-events: none;
}

/* 响应式保护 */
@media (max-width: 768px) {
    .protection-toast {
        right: 10px !important;
        left: 10px !important;
        top: 10px !important;
    }
}

/* 暗色主题下的保护样式 */
@media (prefers-color-scheme: dark) {
    .protection-toast {
        background: #dc3545 !important;
    }
    
    .dev-tools-warning {
        background: rgba(0, 0, 0, 0.98) !important;
        color: #ff4757 !important;
    }
}

/* 高对比度模式保护 */
@media (prefers-contrast: high) {
    .protection-toast {
        border: 2px solid white !important;
    }
}

/* 打印媒体查询保护 */
@page {
    margin: 0;
    size: A4;
}

@media print {
    .no-print, 
    .protection-toast,
    .dev-tools-warning {
        display: none !important;
    }
}