/**
 * OneNav 内容保护前端样式
 */

/* 默认不应用全局样式，由 JavaScript 动态添加 */
body.onenav-protect-active {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 允许选择的元素 */
input,
textarea,
select,
.allow-select,
.wp-block-search__input,
.wp-block-calendar table td a {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 代码块允许选择 */
pre,
code,
kbd,
tt,
var {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 图片禁止拖拽 - 仅在保护激活时 */
body.onenav-protect-active img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none;
}

/* Canvas渲染的图片样式 */
body.onenav-image-protect-active img.onenav-canvas-rendered {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: none;
    max-width: 100%;
    height: auto;
}

/* 图片保护激活时的额外样式 */
body.onenav-image-protect-active img {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 阻止图片拖拽但保留链接点击 */
body.onenav-image-protect-active img {
    -webkit-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

/* 隐藏Canvas渲染图片的右键菜单 */
body.onenav-image-protect-active img.onenav-canvas-rendered {
    -webkit-touch-callout: none !important;
    -moz-touch-callout: none !important;
    touch-callout: none !important;
}

/* 图片包装容器 */
.onenav-image-wrapper {
    display: inline-block;
    position: relative;
    max-width: 100%;
    pointer-events: none;
}

/* 图片透明覆盖层 */
.onenav-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 9999;
    pointer-events: auto;
    cursor: default;
}

/* 阻止图片链接的点击 */
body.onenav-image-protect-active a:has(img),
body.onenav-image-protect-active a img {
    pointer-events: none !important;
    cursor: default !important;
}

/* 排除保护区域的图片 */
.onenav-exempt img,
.onenav-exempt .onenav-image-overlay {
    -webkit-user-drag: auto !important;
    -moz-user-drag: auto !important;
    -o-user-drag: auto !important;
    user-drag: auto !important;
    pointer-events: auto !important;
}

/* 图片容器恢复点击功能（如果需要）
body.onenav-image-protect-active a img,
body.onenav-image-protect-active .gallery img,
body.onenav-image-protect-active .wp-block-image img {
    pointer-events: auto;
} */

/* 链接禁止拖拽 - 仅在保护激活时 */
body.onenav-protect-active a {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    user-drag: none;
}

/* 复制提示样式 */
.copy-notice-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    z-index: 999999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 80%;
    word-wrap: break-word;
    animation: copyNoticeFadeIn 0.3s ease-out;
}

@keyframes copyNoticeFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* OneNav 主题特定样式 - 仅在保护激活时 */
body.onenav-protect-active.is-onenav-theme .article-content,
body.onenav-protect-active.is-onenav-theme .article-body,
body.onenav-protect-active.is-onenav-theme .post-content,
body.onenav-protect-active.is-onenav-theme .entry-content,
body.onenav-protect-active.is-onenav-theme .single-content {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* OneNav 主题代码块允许选择 */
body.is-onenav-theme .article-content pre,
body.is-onenav-theme .article-content code,
body.is-onenav-theme .article-body pre,
body.is-onenav-theme .article-body code,
body.is-onenav-theme .post-content pre,
body.is-onenav-theme .post-content code,
body.is-onenav-theme .entry-content pre,
body.is-onenav-theme .entry-content code,
body.is-onenav-theme .single-content pre,
body.is-onenav-theme .single-content code {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* WordPress 区块编辑器允许选择 */
.wp-block-code code,
.wp-block-preformatted pre,
.wp-block-verse pre {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* WordPress 媒体选择器 */
.wp-media-wrapper {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 表单元素允许选择 */
.form-control,
.form-field,
.text-input,
 textarea,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="range"],
select,
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 打印样式 - 打印时允许选择 */
@media print {
    body {
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        user-select: text !important;
    }
    
    .copy-notice-toast {
        display: none !important;
    }
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .copy-notice-toast {
        width: 90%;
        max-width: 90%;
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* 禁用状态样式 */
body.onenav-protect-disabled {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

body.onenav-protect-disabled * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* 管理员模式样式 */
body.onenav-protect-active.is-admin-user {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

body.onenav-protect-active.is-admin-user * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* 防止开发者工具移除样式 */
body::before {
    content: '';
    display: none;
}
