/**
 * Shield Protect — CSS anti-tampering layer
 * Infinity Nova Division · 2026
 *
 * Protecciones:
 *  - Bloqueo selección de texto (user-select)
 *  - Bloqueo impresión (@media print)
 *  - Overlay aviso DevTools / acceso denegado
 *  - Watermark canvas-tiled
 *  - Blur de contenido ante foco perdido / captura
 */

/* ═══ 1. Bloqueo selección ═══ */
body.sp-active,
body.sp-active * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Excepción: campos de formulario deben permitir selección/edición */
body.sp-active input,
body.sp-active textarea,
body.sp-active select,
body.sp-active [contenteditable="true"] {
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    user-select: auto !important;
    -webkit-touch-callout: default !important;
}

/* ═══ 2. Bloqueo impresión ═══ */
@media print {
    html, body { display: none !important; visibility: hidden !important; }
    * { display: none !important; visibility: hidden !important; }
}

/* ═══ 3. Overlay aviso denegado ═══ */
#sp-warn-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    background: rgba(0, 0, 0, .92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
#sp-warn-overlay.sp-show { display: flex; }

#sp-warn-overlay .sp-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: sp-pulse 1.5s ease-in-out infinite;
}
#sp-warn-overlay h2 {
    color: #f87171;
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 12px;
    letter-spacing: .02em;
}
#sp-warn-overlay .sp-msg {
    color: #e2e8f0;
    font-size: 15px;
    text-align: center;
    line-height: 1.6;
    max-width: 480px;
    margin: 0 0 20px;
}
#sp-warn-overlay .sp-sub {
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    line-height: 1.5;
    max-width: 400px;
    margin: 0;
}
@keyframes sp-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.1); opacity: .85; }
}

/* ═══ 4. Watermark overlay ═══ */
#sp-watermark {
    position: fixed;
    inset: 0;
    z-index: 2147483640;
    pointer-events: none;
    background-repeat: repeat;
    background-size: auto;
    opacity: 0.045;
    mix-blend-mode: difference;
}

/* ═══ 5. Blur contenido (screenshot / focus loss) ═══ */
body.sp-blur > *:not(#sp-warn-overlay):not(#sp-watermark):not(#sp-blur-overlay) {
    filter: blur(18px) !important;
    transition: filter .15s ease;
}
#sp-blur-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483644;
    background: rgba(0, 0, 0, .75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
#sp-blur-overlay.sp-show { display: flex; }
#sp-blur-overlay .sp-blur-msg {
    color: #f1f5f9;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    padding: 30px 40px;
    background: rgba(15, 23, 42, .8);
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 16px;
}

/* ═══ 6. Toasts de aviso ═══ */
#sp-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2147483645;
    background: linear-gradient(135deg, rgba(239, 68, 68, .95), rgba(185, 28, 28, .95));
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 32px rgba(239, 68, 68, .35);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
    max-width: 340px;
}
#sp-toast.sp-show {
    opacity: 1;
    transform: translateY(0);
}

/* ═══ 7. Anti-drag images ═══ */
body.sp-active img {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    pointer-events: none !important;
}
