/**
 * 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;
}
/**
 * BattlePals Universal Keybindings Modal
 * Medieval-themed modal for viewing and managing keybindings
 */

/* Modal Overlay */
.keybindings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    backdrop-filter: blur(3px);
    animation: modalFadeIn 0.3s ease-out;
}

.keybindings-modal-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Modal Container */
.keybindings-modal {
    background: linear-gradient(135deg, #2c1810, #3d2419);
    border: 3px solid #8B4513;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    font-family: 'MedievalSharp', serif;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

/* Modal Header */
.keybindings-modal-header {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    padding: 20px;
    border-bottom: 2px solid #654321;
    position: relative;
}

.keybindings-modal-title {
    color: #F5E6D3;
    font-size: 24px;
    margin: 0;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    letter-spacing: 1px;
}

.keybindings-modal-subtitle {
    color: #D2B48C;
    font-size: 14px;
    text-align: center;
    margin: 5px 0 0 0;
    opacity: 0.9;
}

.keybindings-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 28px;
    color: #F5E6D3;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s ease;
}

.keybindings-modal-close:hover {
    color: #FF6B6B;
    transform: scale(1.1);
}

/* Modal Body */
.keybindings-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
    background: #2c1810;
}

/* Search and Filter Bar */
.keybindings-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.keybindings-search-input {
    flex: 1;
    padding: 10px 15px;
    background: #1a0f08;
    border: 2px solid #654321;
    border-radius: 6px;
    color: #F5E6D3;
    font-family: inherit;
    font-size: 14px;
}

.keybindings-search-input:focus {
    outline: none;
    border-color: #8B4513;
    box-shadow: 0 0 10px rgba(139, 69, 19, 0.3);
}

.keybindings-category-filter {
    padding: 10px 15px;
    background: #1a0f08;
    border: 2px solid #654321;
    border-radius: 6px;
    color: #F5E6D3;
    font-family: inherit;
    font-size: 14px;
    min-width: 150px;
}

.keybindings-category-filter:focus {
    outline: none;
    border-color: #8B4513;
}

/* Keybindings Grid */
.keybindings-grid {
    display: grid;
    gap: 15px;
}

.keybindings-category {
    background: linear-gradient(135deg, #1a0f08, #2c1810);
    border: 2px solid #654321;
    border-radius: 8px;
    overflow: hidden;
}

.keybindings-category-header {
    background: linear-gradient(135deg, #654321, #8B4513);
    padding: 12px 20px;
    color: #F5E6D3;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.5px;
}

.keybindings-category-content {
    padding: 15px 20px;
}

.keybinding-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(139, 69, 19, 0.3);
    transition: background-color 0.2s ease;
}

.keybinding-item:last-child {
    border-bottom: none;
}

.keybinding-item:hover {
    background: rgba(139, 69, 19, 0.1);
    border-radius: 4px;
    margin: 0 -10px;
    padding: 12px 10px;
}

.keybinding-info {
    flex: 1;
}

.keybinding-action {
    color: #F5E6D3;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
}

.keybinding-description {
    color: #D2B48C;
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.3;
}

.keybinding-key {
    background: linear-gradient(135deg, #3d2419, #4a2a1c);
    border: 2px solid #654321;
    border-radius: 6px;
    padding: 8px 12px;
    color: #F5E6D3;
    font-weight: bold;
    font-size: 13px;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
}

.keybinding-key:hover {
    background: linear-gradient(135deg, #4a2a1c, #5c3422);
    border-color: #8B4513;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.keybinding-key.editing {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-color: #CD853F;
    animation: pulse 1s infinite;
}

/* Special Keys Styling */
.keybinding-key.modifier {
    background: linear-gradient(135deg, #2E4C3B, #3F5F4C);
    border-color: #4F7F6C;
}

.keybinding-key.function {
    background: linear-gradient(135deg, #4C2E42, #5F3F52);
    border-color: #7F4F72;
}

/* Action Buttons */
.keybindings-actions {
    display: flex;
    gap: 10px;
    padding: 20px;
    background: #1a0f08;
    border-top: 2px solid #654321;
}

.keybindings-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border: 2px solid #654321;
    border-radius: 6px;
    color: #F5E6D3;
    font-family: inherit;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.keybindings-btn:hover {
    background: linear-gradient(135deg, #A0522D, #CD853F);
    border-color: #8B4513;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.keybindings-btn.secondary {
    background: linear-gradient(135deg, #4a4a4a, #666666);
    border-color: #333333;
}

.keybindings-btn.secondary:hover {
    background: linear-gradient(135deg, #666666, #808080);
    border-color: #555555;
}

.keybindings-btn.danger {
    background: linear-gradient(135deg, #8B0000, #CD5C5C);
    border-color: #654321;
}

.keybindings-btn.danger:hover {
    background: linear-gradient(135deg, #CD5C5C, #DC143C);
    border-color: #8B0000;
}

/* Status Messages */
.keybindings-status {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    display: none;
}

.keybindings-status.success {
    background: rgba(46, 125, 50, 0.2);
    color: #4CAF50;
    border: 1px solid #4CAF50;
}

.keybindings-status.error {
    background: rgba(183, 28, 28, 0.2);
    color: #f44336;
    border: 1px solid #f44336;
}

.keybindings-status.info {
    background: rgba(25, 118, 210, 0.2);
    color: #2196F3;
    border: 1px solid #2196F3;
}

/* Loading State */
.keybindings-loading {
    text-align: center;
    padding: 40px;
    color: #D2B48C;
    font-size: 16px;
}

.keybindings-loading::before {
    content: "⚔️";
    display: block;
    font-size: 32px;
    margin-bottom: 10px;
    animation: spin 2s linear infinite;
}

/* Empty State */
.keybindings-empty {
    text-align: center;
    padding: 40px;
    color: #D2B48C;
    font-size: 16px;
}

.keybindings-empty::before {
    content: "🗝️";
    display: block;
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Scrollbar Styling */
.keybindings-modal-body::-webkit-scrollbar {
    width: 8px;
}

.keybindings-modal-body::-webkit-scrollbar-track {
    background: #1a0f08;
    border-radius: 4px;
}

.keybindings-modal-body::-webkit-scrollbar-thumb {
    background: #654321;
    border-radius: 4px;
}

.keybindings-modal-body::-webkit-scrollbar-thumb:hover {
    background: #8B4513;
}

/* Animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .keybindings-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .keybindings-search-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .keybindings-category-filter {
        min-width: auto;
    }
    
    .keybinding-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .keybindings-actions {
        flex-direction: column;
    }
    
    .keybindings-btn {
        text-align: center;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .keybindings-modal-overlay,
    .keybindings-modal,
    .keybinding-key,
    .keybindings-btn {
        animation: none;
        transition: none;
    }
}