/**
 * Content Protector Pro – Frontend Protection Styles  v1.1.2
 *
 * v1.1.2: Added -webkit-user-drag: none to <a> elements so CSS-level drag
 * prevention covers anchor tags as well as images. JS Layers B & C
 * (draggable="false" + ondragstart attribute) are the primary defence;
 * this is a belt-and-suspenders addition.
 *
 * @package Content_Protector_Pro
 */

/* =============================================================================
   1.  Disable Text Selection
   ============================================================================= */

body,
body *:not(input):not(textarea):not(select):not([contenteditable="true"]) {
    -webkit-touch-callout: none;
    -webkit-user-select:   none;
    -moz-user-select:      none;
    -ms-user-select:       none;
    user-select:           none;
}

/* Re-enable inside form controls */
input, input[type], textarea, select,
[contenteditable="true"], [contenteditable] {
    -webkit-touch-callout: default;
    -webkit-user-select:   text;
    -moz-user-select:      text;
    -ms-user-select:       text;
    user-select:           text;
}

/* =============================================================================
   2.  Image Drag Prevention
   ============================================================================= */

img {
    -webkit-user-drag:     none;
    -khtml-user-drag:      none;
    -moz-user-drag:        none;
    -o-user-drag:          none;
    user-drag:             none;
    -webkit-touch-callout: none;
    -webkit-user-select:   none;
    -moz-user-select:      none;
    -ms-user-select:       none;
    user-select:           none;
}

/*
 * v1.1.2: Extend user-drag: none to <a> elements.
 * JS sets draggable="false" + ondragstart="return false" on image-wrapping
 * anchors at runtime; this CSS rule adds a CSS-level fallback for the same.
 */
a {
    -webkit-user-drag: none;
    user-drag:         none;
}

/* =============================================================================
   3.  WooCommerce Gallery & Lightbox Exclusions
   ============================================================================= */

/*
 * Restore touch-callout and pointer-events inside the WooCommerce product
 * gallery and Photoswipe lightbox so that swipe, zoom, and tap-to-open-
 * lightbox all continue to work on mobile.
 */
.woocommerce-product-gallery,
.woocommerce-product-gallery *,
.flex-viewport,
.flex-viewport *,
.pswp,
.pswp * {
    -webkit-touch-callout: default;
    pointer-events:        auto;
}

/* Restore user-select inside Photoswipe so its controls are fully interactive */
.pswp,
.pswp * {
    -webkit-user-select: auto;
    -moz-user-select:    auto;
    -ms-user-select:     auto;
    user-select:         auto;
}

/* =============================================================================
   4.  Print / Save-as-PDF Protection
   ============================================================================= */

@media print {
    body > *, body {
        display:    none !important;
        visibility: hidden !important;
    }
    body::before {
        display:     block !important;
        visibility:  visible !important;
        content:     "⚠️  This content is protected and cannot be printed.";
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        font-size:   22px;
        font-weight: 600;
        color:       #111;
        text-align:  center;
        padding-top: 120px;
    }
}

/* =============================================================================
   5.  Alert Toast Overlay
   ============================================================================= */

#cpp-alert-overlay {
    position:   fixed;
    top:        24px;
    left:       50%;
    z-index:    2147483647;
    transform:  translateX(-50%) translateY(calc(-100% - 30px));
    opacity:    0;
    transition: transform 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                opacity   0.28s ease;
    pointer-events: none;
    -webkit-user-select: none !important;
    user-select:         none !important;
}

#cpp-alert-overlay.cpp-alert-visible {
    transform: translateX(-50%) translateY(0);
    opacity:   1;
}

.cpp-alert-box {
    display:         flex;
    align-items:     center;
    gap:             10px;
    padding:         13px 22px;
    border-radius:   14px;
    white-space:     nowrap;
    background:      rgba(15, 15, 30, 0.92);
    border:          1px solid rgba(255, 255, 255, 0.12);
    box-shadow:      0 8px 32px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.25);
    backdrop-filter:         blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size:   14px;
    font-weight: 500;
    line-height: 1.4;
    color:       #e8ecf0;
    letter-spacing: 0.015em;
}

.cpp-alert-icon { font-size: 20px; flex-shrink: 0; line-height: 1; }
.cpp-alert-text { color: #dce6ef; }

/* =============================================================================
   6.  Mobile Responsive Alert
   ============================================================================= */

@media (max-width: 520px) {
    #cpp-alert-overlay {
        top:       auto;
        bottom:    20px;
        left:      12px;
        right:     12px;
        width:     auto;
        transform: translateX(0) translateY(calc(100% + 30px));
    }
    #cpp-alert-overlay.cpp-alert-visible {
        transform: translateX(0) translateY(0);
    }
    .cpp-alert-box {
        white-space:     normal;
        justify-content: center;
        text-align:      center;
        flex-wrap:       wrap;
        padding:         14px 18px;
        border-radius:   16px;
    }
}
