/* ══════════════════════════════════════════════════════════════════════
   TECLADO ALFANUMÉRICO VIRTUAL - PANEL LATERAL (ESTILO TABLET)
   ══════════════════════════════════════════════════════════════════════ */

/* Toggle button (cuando está cerrado) */
.keyboard-toggle {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 60px;
    height: 60px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all .3s;
    z-index: 1000;
}

.keyboard-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.keyboard-toggle.hidden {
    display: none;
}

/* Panel principal */
.keyboard-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform .3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.keyboard-panel.active {
    transform: translateY(0);
}

/* Header */
.keyboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.keyboard-header span {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.keyboard-close {
    background: transparent;
    border: none;
    font-size: 32px;
    color: #6b7280;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all .2s;
}

.keyboard-close:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* Display */
.keyboard-display {
    padding: 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.keyboard-display input {
    width: 100%;
    background: white;
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 16px;
    font-size: 20px;
    font-weight: 500;
    color: #1f2937;
}

.keyboard-display input:focus {
    outline: none;
    border-color: #2563eb;
}

/* Context info */
.keyboard-context {
    padding: 12px 20px;
    background: #dbeafe;
    border-bottom: 1px solid #93c5fd;
    text-align: center;
}

.keyboard-context small {
    color: #1e40af;
    font-weight: 500;
    font-size: 13px;
}

/* Keyboard container */
.keyboard-keys-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* MODE: NUMBERS */
.keyboard-mode-numbers {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

/* MODE: LETTERS */
.keyboard-mode-letters {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.keyboard-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.keyboard-row-1 {
    /* Q W E R T Y U I O P */
}

.keyboard-row-2 {
    /* A S D F G H J K L Ñ */
}

.keyboard-row-3 {
    /* Z X C V B N M , . @ */
}

/* Teclas */
.keyboard-keys-container button {
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    transition: all .15s;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.keyboard-mode-numbers button {
    min-height: 60px;
    font-size: 24px;
}

.keyboard-keys-container button:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.keyboard-keys-container button:active {
    transform: scale(0.95);
    box-shadow: none;
}

/* Teclas especiales */
.key-backspace {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
    font-size: 20px;
}

.key-backspace:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.key-space {
    flex: 3;
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.key-space:hover {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

.key-shift,
.key-mode {
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #3730a3;
    font-size: 16px;
}

.key-shift:hover,
.key-mode:hover {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

.key-shift.active {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}

/* Actions */
.keyboard-actions {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
}

.keyboard-actions button {
    padding: 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: 2px solid transparent;
}

.btn-keyboard-cancel {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #e5e7eb;
}

.btn-keyboard-cancel:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.btn-keyboard-confirm {
    background: #3b82f6;
    color: white;
}

.btn-keyboard-confirm:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-keyboard-confirm:active {
    transform: scale(0.98);
}

/* Responsive */
@media (max-width: 768px) {
    .keyboard-panel {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
    }
    
    .keyboard-mode-numbers button {
        min-height: 55px;
    }
    
    .keyboard-row button {
        min-height: 45px;
        font-size: 16px;
    }
}

@media (min-width: 769px) {
    .keyboard-panel {
        max-width: 600px;
    }
}

/* Overlay cuando está abierto */
.keyboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all .3s;
    z-index: 999;
}

.keyboard-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Hide mode containers by default */
.keyboard-mode-numbers,
.keyboard-mode-letters {
    display: none;
}

.keyboard-mode-numbers.active,
.keyboard-mode-letters.active {
    display: grid;
}

.keyboard-mode-letters.active {
    display: flex;
}