/**
 * CONAREM Engine Portal - CSS de Proteção Anti-Pirataria
 * 
 * Desabilita seleção de texto e outras interações para usuários comuns.
 * Admins e usuários com permissão especial não são afetados.
 * 
 * @author Sincro Growth
 * @date 2025-12-07
 * @version 0.0.5.52
 */

/* ========================================
   PROTEÇÃO ATIVA (data-content-protection="true")
   ======================================== */

body[data-content-protection="true"] {
    /* Desabilitar seleção de texto */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Desabilitar eventos de toque (mobile) */
    -webkit-touch-callout: none;
}

/* Exceções: Permitir seleção em campos de entrada */
body[data-content-protection="true"] input,
body[data-content-protection="true"] textarea,
body[data-content-protection="true"] [contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    
    -webkit-touch-callout: default !important;
}

/* Desabilitar drag de imagens */
body[data-content-protection="true"] img {
    -webkit-user-drag: none;
    -moz-user-drag: none;
    -ms-user-drag: none;
    user-drag: none;
    
    pointer-events: none;
}

/* Exceções: Permitir interação com imagens em campos específicos */
body[data-content-protection="true"] input[type="file"] + label img,
body[data-content-protection="true"] .file-upload img {
    pointer-events: auto;
}

/* ========================================
   PROTEÇÃO DESABILITADA (admins)
   ======================================== */

body[data-content-protection="false"] {
    /* Permitir tudo normalmente */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ========================================
   WATERMARK PARA IMPRESSÃO
   ======================================== */

@media print {
    body[data-content-protection="true"]::after {
        content: attr(data-user-watermark);
        position: fixed;
        bottom: 10px;
        right: 10px;
        font-size: 10px;
        color: #999;
        opacity: 0.7;
        z-index: 9999;
    }
    
    /* Ocultar elementos de navegação na impressão */
    body[data-content-protection="true"] header,
    body[data-content-protection="true"] footer,
    body[data-content-protection="true"] nav,
    body[data-content-protection="true"] .no-print {
        display: none !important;
    }
}

/* ========================================
   INDICADOR VISUAL (OPCIONAL)
   ======================================== */

/* Adicionar pequeno ícone de cadeado no canto (apenas dev/local) */
body[data-content-protection="true"][data-environment="local"]::before,
body[data-content-protection="true"][data-environment="development"]::before {
    content: "🔒";
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 12px;
    opacity: 0.3;
    z-index: 9998;
    pointer-events: none;
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

/* Mobile: Desabilitar long-press para copiar */
@media (max-width: 768px) {
    body[data-content-protection="true"] * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
    }
    
    /* Exceções para campos de entrada */
    body[data-content-protection="true"] input,
    body[data-content-protection="true"] textarea,
    body[data-content-protection="true"] [contenteditable="true"] {
        -webkit-touch-callout: default !important;
        -webkit-user-select: text !important;
    }
}

/* ========================================
   DARK MODE
   ======================================== */

@media (prefers-color-scheme: dark) {
    @media print {
        body[data-content-protection="true"]::after {
            color: #666;
        }
    }
}
