/**
 * NPA Publishing Company - Digital Rights Management (DRM) & Content Security Stylesheet
 * 
 * Provides style-level enforcement for:
 * 1. Global text selection lock (except form inputs & textareas)
 * 2. Drag & drop image/media extraction prevention
 * 3. Total print & PDF export lockdown (@media print)
 * 4. Screen capture & Snipping Tool blur shield
 * 5. Subtle forensic repeating watermark matrix
 * 6. Responsive DRM security alert toasts
 */

/* ==========================================================================
   1. GLOBAL TEXT SELECTION LOCKDOWN (EXCLUDING INTERACTIVE FORM INPUTS)
   ========================================================================== */
body, 
body *:not(input):not(textarea):not(select):not([contenteditable="true"]):not(.allow-select) {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Explicit form input exemption: authors, scholars, and customers must be able to type, edit, and paste */
input, 
textarea, 
select, 
[contenteditable="true"], 
.allow-select,
.allow-select * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* ==========================================================================
   2. MEDIA DRAG & DROP AND TOUCH CALLOUT PREVENTION
   ========================================================================== */
img, 
picture, 
svg, 
canvas, 
video, 
a, 
.book-cover, 
.card-img-top, 
.catalog-book-cover {
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    user-drag: none !important;
    -webkit-touch-callout: none !important;
}

/* Ensure mobile long-press does not trigger "Save Image" or "Share" modals */
* {
    -webkit-touch-callout: none !important;
}

input, 
textarea {
    -webkit-touch-callout: default !important;
}

/* ==========================================================================
   3. ANTI-PRINT TOTAL LOCKDOWN (@MEDIA PRINT)
   ========================================================================== */
@media print {
    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        height: 100vh !important;
        max-height: 100vh !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    body * {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    body::before {
        content: "RESTRICTED ACCESS \2014  PRINTING PROHIBITED\A\A This digital publication and website content are protected by copyright laws and Digital Rights Management (DRM).\A\A Physical reproduction, printing, and exporting to PDF from NPA Publishing Company are strictly prohibited under national and international copyright legislation." !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        white-space: pre-wrap !important;
        font-family: 'Crimson Pro', Georgia, serif !important;
        font-size: 20pt !important;
        line-height: 1.6 !important;
        text-align: center !important;
        color: #991b1b !important;
        border: 3px solid #991b1b !important;
        background: #fef2f2 !important;
        padding: 60px 40px !important;
        margin: 120px auto !important;
        max-width: 680px !important;
        border-radius: 12px !important;
        box-shadow: 0 0 20px rgba(0,0,0,0.1) !important;
    }
}

/* ==========================================================================
   4. SCREEN CAPTURE & SNIPPING TOOL FOCUS-LOSS PRIVACY SHIELD
   ========================================================================== */
body.drm-blur-active > *:not(#drmPrivacyShield):not(#drmSecurityToast) {
    filter: blur(35px) brightness(0.65) grayscale(0.4) !important;
    pointer-events: none !important;
    user-select: none !important;
    transition: filter 0.12s ease !important;
}

/* Screen Capture Flash Blocker (Triggered on PrintScreen key) */
body.drm-flash-active {
    background: #000000 !important;
}
body.drm-flash-active > * {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Privacy Shield Fullscreen Modal */
#drmPrivacyShield {
    position: fixed;
    inset: 0;
    z-index: 2147483640;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(7, 25, 51, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

#drmPrivacyShield.drm-shield-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.drm-shield-dialog {
    background: #ffffff;
    border-radius: 16px;
    padding: 36px 32px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(201, 169, 110, 0.3);
    animation: drmShieldPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drmShieldPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.drm-shield-badge {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(201, 169, 110, 0.15);
    color: #9f7d3b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.drm-shield-heading {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #071933;
    margin-bottom: 4px;
}

.drm-shield-sub {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9f7d3b;
    margin-bottom: 16px;
}

.drm-shield-box {
    background: #f8fafc;
    border-left: 4px solid #071933;
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    text-align: left;
}

.drm-shield-box p {
    font-size: 0.92rem;
    line-height: 1.5;
    color: #334155;
    margin: 0;
}

.drm-shield-action {
    font-size: 0.82rem;
    color: #64748b;
    font-style: italic;
    margin: 0;
}

/* ==========================================================================
   5. SUBTLE FORENSIC WATERMARK MATRIX
   ========================================================================== */
#drmWatermarkOverlay {
    position: fixed;
    inset: 0;
    z-index: 2147483630;
    pointer-events: none !important;
    user-select: none !important;
    background-repeat: repeat;
    opacity: 0.8;
}

/* ==========================================================================
   6. BRANDED SECURITY TOAST NOTIFICATION
   ========================================================================== */
#drmSecurityToast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 2147483647;
    max-width: 420px;
    background: #071933;
    color: #ffffff;
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 12px 32px rgba(7, 25, 51, 0.4), 0 0 0 1px rgba(201, 169, 110, 0.35);
    transform: translateY(120px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#drmSecurityToast.drm-toast-visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.drm-toast-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.drm-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(201, 169, 110, 0.2);
    color: #e5c98d;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drm-toast-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.drm-toast-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #e5c98d;
    letter-spacing: 0.3px;
}

.drm-toast-msg {
    font-size: 0.82rem;
    line-height: 1.4;
    color: #cbd5e1;
}

@media (max-width: 640px) {
    #drmSecurityToast {
        bottom: 16px;
        left: 16px;
        right: 16px;
        max-width: none;
    }
}
