.keyboard-editor-component {
    padding: 1%;
    background: var(--container-bg, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--container-border, #dee2e6);
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: clamp(0.6rem, 1.5vw, 0.9rem);
}
.editor-header {
    flex-shrink: 0;
    margin-bottom: 15px;
}
.editor-header h3 {
    margin: 0 0 5px 0;
    padding: 10px;
    font-size: 1.3em;
    background: #34495e;
    color: white;
    border-radius: 4px 4px 0 0;
}
.editor-ribbon {
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: 0 0 4px 4px;
    padding: 8px;
    display: flex;
    gap: 15px;
    align-items: center;
}
.ribbon-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 10px;
    border-right: 1px solid #bdc3c7;
}
.ribbon-group:last-child {
    border-right: none;
}
.ribbon-group-label {
    font-size: 10px;
    color: #7f8c8d;
    text-align: center;
    font-weight: 600;
}
.ribbon-buttons {
    display: flex;
    gap: 5px;
}
.ribbon-btn {
    padding: 8px 15px;
    border: 1px solid #95a5a6;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    background: white;
    color: #2c3e50;
}
.ribbon-btn:hover {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}
.ribbon-btn:disabled {
    background: #ecf0f1;
    color: #bdc3c7;
    cursor: not-allowed;
}
.ribbon-btn.listening {
    background: #f39c12;
    color: white;
    animation: pulse 1s infinite;
    border-color: #e67e22;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 10000;
    min-width: 150px;
    display: none;
}
.context-menu.show {
    display: block;
}
.context-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}
.context-menu-item:hover {
    background: #3498db;
    color: white;
}
.context-menu-item:first-child {
    border-radius: 4px 4px 0 0;
}
.context-menu-item:last-child {
    border-radius: 0 0 4px 4px;
}
.context-menu-separator {
    height: 1px;
    background: #ecf0f1;
    margin: 5px 0;
}
.editor-canvas-container {
    flex: 1;
    background: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    position: relative;
    overflow: auto;
    min-height: 600px;
}
.editor-keyboard {
    position: relative;
    background: #2c3e50;
    border-radius: 8px;
    margin: 20px;
    padding: 0;
}
.editor-key {
    position: absolute;
    background: linear-gradient(180deg, #ecf0f1 0%, #bdc3c7 100%);
    border: 2px solid #95a5a6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    cursor: move;
    transition: border-color 0.2s;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    user-select: none;
}
.editor-key:hover {
    border-color: #3498db;
}
.editor-key.dragging {
    opacity: 0.7;
    border-color: #e74c3c;
    z-index: 1000;
}
.editor-key.selected {
    border-color: #f39c12;
    border-width: 3px;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}
.editor-key.pressed {
    background: linear-gradient(180deg, #3498db 0%, #2980b9 100%);
    color: white;
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.editor-key.tested {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}
.editor-keyboard.test-mode .editor-key {
    cursor: default;
}
.resize-handle {
    position: absolute;
    background: #3498db;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}
.editor-key:hover .resize-handle,
.resize-handle.dragging {
    opacity: 0.8;
}
.resize-handle-right {
    right: -3px;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: ew-resize;
}
.resize-handle-bottom {
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 6px;
    cursor: ns-resize;
}
.resize-handle-corner {
    right: -3px;
    bottom: -3px;
    width: 10px;
    height: 10px;
    cursor: nwse-resize;
    border-radius: 2px;
}
.grid-info {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: #7f8c8d;
}
#file-upload {
    display: none;
}
.add-key-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}
.add-key-modal.show {
    display: flex;
}
.add-key-modal-content {
    background: white;
    padding: 40px 60px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.add-key-modal-content h2 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 24px;
}
.add-key-modal-content p {
    margin: 0;
    color: #7f8c8d;
    font-size: 16px;
}
.keyboard-name-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.keyboard-name-container label {
    font-weight: bold;
    color: #2c3e50;
}
.keyboard-name-container input {
    padding: 5px 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
    max-width: 300px;
}