/**
 * Content Protection Styles
 * 
 * @package Custom_LMS
 * @since 1.0.0
 */

/* Disable text selection */
body.custom-lms-protected {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body.custom-lms-protected * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow selection for form inputs */
body.custom-lms-protected input,
body.custom-lms-protected textarea,
body.custom-lms-protected select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Disable image dragging */
body.custom-lms-protected img {
    -webkit-user-drag: none;
    pointer-events: none;
}

/* Watermark overlay */
.custom-lms-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 48px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.05);
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
    user-select: none;
    text-align: center;
    width: 100%;
    max-width: 90vw;
    overflow: visible;
}

.custom-lms-watermark span {
    display: inline-block;
    padding: 20px 40px;
    border: 3px solid rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    max-width: 100%;
    word-break: break-word;
    white-space: normal;
    line-height: 1.2;
}

/* Protection message notification */
.custom-lms-protection-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #9f7aea;
    color: #fff;
    padding: 15px 25px;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(159, 122, 234, 0.3);
    z-index: 999999;
    font-size: 14px;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
}

.custom-lms-protection-message.fade-out {
    animation: slideOutRight 0.3s ease-out;
    opacity: 0;
}

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

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

/* Print protection - hide content when printing */
@media print {
    body.custom-lms-protected .entry-content,
    body.custom-lms-protected .post-content,
    body.custom-lms-protected article .content,
    body.custom-lms-protected main {
        display: none !important;
        visibility: hidden !important;
    }
    
    body.custom-lms-protected::after {
        content: "This content is protected and cannot be printed. Please contact support for assistance.";
        display: block;
        padding: 40px;
        font-size: 18px;
        text-align: center;
        color: #9f7aea;
        font-weight: bold;
    }
    
    /* Hide watermark when printing */
    .custom-lms-watermark {
        display: none !important;
    }
}

/* Screen capture blur effect */
body.custom-lms-protected.blur-content .entry-content,
body.custom-lms-protected.blur-content .post-content,
body.custom-lms-protected.blur-content article {
    filter: blur(5px);
    transition: filter 0.3s ease;
}

/* Cursor style to indicate protection */
body.custom-lms-protected {
    cursor: default;
}

body.custom-lms-protected .entry-content,
body.custom-lms-protected .post-content {
    cursor: default;
}

/* Prevent outline on focus (some browsers allow copy via inspector) */
body.custom-lms-protected *:focus {
    outline: none;
}

/* Additional protection for code blocks */
body.custom-lms-protected pre,
body.custom-lms-protected code {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Mobile responsiveness for watermark */
@media (max-width: 768px) {
    .custom-lms-watermark {
        font-size: 24px;
    }
    
    .custom-lms-watermark span {
        padding: 10px 20px;
        border-width: 2px;
    }
    
    .custom-lms-protection-message {
        top: 10px;
        right: 10px;
        left: 10px;
        padding: 12px 20px;
        font-size: 13px;
    }
}

/* Landscape orientation on mobile - adjust watermark */
@media (max-width: 926px) and (orientation: landscape) {
    /* Make the watermark much more visible in landscape by using full viewport width
       and larger text/padding. This keeps the diagonal appearance but stretches
       the overlay so it reads like the portrait-style watermark. */
    .custom-lms-watermark {
        font-size: 28px !important;
        width: 100vw !important;
        max-width: 100vw !important;
        transform: translate(-50%, -50%) rotate(-25deg) !important;
        top: 50% !important;
        left: 50% !important;
    }

    .custom-lms-watermark span {
        display: block;
        padding: 12px 18px !important;
        border-width: 2px !important;
        font-size: 18px !important;
        white-space: normal !important;
        max-width: 95% !important;
        margin: 0 auto;
        overflow-wrap: break-word !important;
        line-height: 1.2 !important;
    }
}

/* Very small screens in landscape (like iPhone SE, iPhone 12/13/14 mini) */
@media (max-height: 450px) and (orientation: landscape) {
    .custom-lms-watermark {
        font-size: 22px !important;
        width: 100vw !important;
        max-width: 100vw !important;
        transform: translate(-50%, -50%) rotate(-20deg) !important;
        top: 50% !important;
        left: 50% !important;
    }

    .custom-lms-watermark span {
        padding: 10px 12px !important;
        font-size: 14px !important;
        line-height: 1.25 !important;
        border-width: 1px !important;
        max-width: 95% !important;
        margin: 0 auto;
    }
}

/* Extra small height in landscape */
@media (max-height: 380px) and (orientation: landscape) {
    .custom-lms-watermark {
        font-size: 18px !important;
        width: 100vw !important;
        max-width: 100vw !important;
        transform: translate(-50%, -50%) rotate(-15deg) !important;
        left: 50% !important;
    }

    .custom-lms-watermark span {
        padding: 8px 10px !important;
        font-size: 12px !important;
        max-width: 95% !important;
        margin: 0 auto;
    }
}

/* Accessibility - ensure important UI elements are still usable */
body.custom-lms-protected button,
body.custom-lms-protected a,
body.custom-lms-protected [role="button"] {
    pointer-events: auto;
    cursor: pointer;
}
