/**
 * BattlePals Image Protection CSS
 * Prevents image downloading and selection through CSS
 */

/* Base protection for all game assets */
.protected-asset,
.item-icon,
.character-portrait,
.ability-icon,
.equipment-slot img,
.battle-interface img,
.game-content img:not(.draggable):not(.bank-draggable) {
    /* Prevent text/image selection */
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    
    /* Prevent image dragging */
    -webkit-user-drag: none !important;
    -moz-user-drag: none !important;
    user-drag: none !important;
    
    /* Disable touch callouts on mobile */
    -webkit-touch-callout: none !important;
    
    /* Prevent highlighting */
    -webkit-tap-highlight-color: transparent !important;
    
    /* Ensure images can't be selected */
    -webkit-user-modify: read-only !important;
    
    /* Prevent outline on focus */
    outline: none !important;
}

/* Specific protection for canvas elements */
canvas.battle-canvas,
canvas.game-canvas,
.battle-interface canvas {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
    outline: none !important;
    pointer-events: auto; /* Allow game interactions */
}

/* Allow dragging for legitimate game functions */
.draggable,
.bank-draggable,
.inventory-items-grid .draggable,
.bank-items-grid .draggable,
[draggable="true"] {
    -webkit-user-drag: auto !important;
    -moz-user-drag: auto !important;
    user-drag: auto !important;
    cursor: grab !important;
}

.draggable:active,
.bank-draggable:active,
[draggable="true"]:active {
    cursor: grabbing !important;
}

/* Specific exemptions for bank system */
.bank-container .inventory-items-grid *,
.bank-container .bank-items-grid *,
.inventory-panel [draggable="true"],
.bank-content-panel [draggable="true"] {
    -webkit-user-drag: auto !important;
    -moz-user-drag: auto !important;
    user-drag: auto !important;
}

/* Ensure bank items have proper cursor states */
.bank-container [draggable="true"] {
    cursor: grab !important;
}

.bank-container [draggable="true"]:active {
    cursor: grabbing !important;
}

/* Protect background images used in CSS sprites */
.sprite-image,
.css-sprite,
[class*="icon-"],
[class*="item-"] {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
}

/* Protection for dynamically loaded content - excluding draggable items */
.game-content *:not(.draggable):not([draggable="true"]),
.battle-interface *:not(.draggable):not([draggable="true"]),
.inventory-container *:not(.draggable):not([draggable="true"]):not(.inventory-items-grid *):not(.bank-items-grid *),
.character-sheet *:not(.draggable):not([draggable="true"]),
.equipment-panel *:not(.draggable):not([draggable="true"]) {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
}

/* Allow text selection for important UI elements */
.chat-message,
.player-name,
.item-description,
.ability-description,
input[type="text"],
input[type="password"],
textarea,
.editable-text,
.selectable-text {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
}

/* Mobile-specific protection */
@media (max-width: 768px) {
    .protected-asset,
    .item-icon,
    .character-portrait,
    .ability-icon {
        /* Prevent long-press context menu on mobile */
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -webkit-tap-highlight-color: transparent !important;
        
        /* Prevent image saving on long press */
        pointer-events: none;
    }
    
    /* Re-enable pointer events for interactive elements */
    .clickable,
    .draggable,
    button,
    .btn,
    [onclick],
    [data-toggle] {
        pointer-events: auto !important;
    }
}

/* Hide print styles for protected content */
@media print {
    .protected-asset,
    .item-icon,
    .character-portrait,
    .ability-icon,
    canvas {
        display: none !important;
    }
}

/* Blur effect for screenshots (optional - can be enabled via JavaScript) */
.screenshot-protection {
    filter: blur(5px);
    transition: filter 0.3s ease;
}

/* Custom scrollbar to prevent right-click on scrollbar */
.game-content::-webkit-scrollbar-track {
    -webkit-user-select: none;
    user-select: none;
}

/* Prevent image copying through clipboard */
.no-clipboard {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
}

/* Protection notification styles */
.protection-notification {
    font-family: 'MedievalSharp', serif;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Disable image caching hints */
.protected-asset {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    -ms-interpolation-mode: nearest-neighbor;
}

/* Protect against print screen by making content unselectable during print */
@media print {
    body {
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        user-select: none !important;
    }
    
    .protected-asset,
    .game-content,
    .battle-interface {
        visibility: hidden !important;
    }
    
    .no-print::before {
        content: "🛡️ Protected Game Content";
        font-size: 24px;
        color: #666;
    }
}

/* Advanced: CSS-only right-click prevention (limited effectiveness) */
.protected-asset::selection {
    background: transparent;
}

.protected-asset::-moz-selection {
    background: transparent;
}

/* Prevent image ghosting during drag attempts */
.protected-asset:hover {
    cursor: default !important;
}

/* Optional: Add subtle visual indicator for protected content */
.protected-asset::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}

/* Ensure game functionality still works */
.game-interactive {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.game-interactive:hover {
    cursor: pointer !important;
}