/**
 * 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;
    }
}