/* On-Screen Keyboard Styles */

.osk-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.osk-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10001;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.osk-container.active {
    transform: translateY(0);
}

.osk-keyboard {
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    border-top: 1px solid rgba(167, 78, 158, 0.4);
    padding: 12px 8px 20px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
}

/* Input Preview Area */
.osk-input-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    margin: 0 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.osk-preview-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.osk-preview-input-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.osk-preview-value {
    font-size: 20px;
    color: #fff;
    font-family: 'Roboto Mono', monospace;
    letter-spacing: 1px;
    padding: 4px 8px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    cursor: text;
    border-radius: 4px;
    transition: background 0.2s;
}

.osk-preview-value:hover {
    background: rgba(255, 255, 255, 0.05);
}

.osk-preview-value.password {
    letter-spacing: 4px;
}

/* Cursor indicator */
.osk-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #a74e9e;
    margin: 0 1px;
    animation: osk-blink 1s infinite;
    vertical-align: middle;
}

@keyframes osk-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Selected text highlight */
.osk-selected {
    background: rgba(167, 78, 158, 0.4);
    border-radius: 2px;
    padding: 2px 4px;
}

.osk-done-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.osk-done-btn:hover {
    background: linear-gradient(135deg, #34d399, #10b981);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.osk-done-btn:active {
    transform: scale(0.98);
}

/* Keyboard Rows */
.osk-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 6px;
}

.osk-row:last-child {
    margin-bottom: 0;
}

/* Individual Keys */
.osk-key {
    min-width: 36px;
    height: 48px;
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.osk-key::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.osk-key:hover {
    background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
}

.osk-key:active,
.osk-key.pressed {
    background: linear-gradient(180deg, #a74e9e 0%, #7a3a74 100%);
    transform: scale(0.95);
    border-color: rgba(167, 78, 158, 0.6);
}

/* Special Keys */
.osk-key.backspace {
    min-width: 64px;
    background: linear-gradient(180deg, #4a3a3a 0%, #3a2a2a 100%);
}

.osk-key.backspace:hover {
    background: linear-gradient(180deg, #5a3a3a 0%, #4a2a2a 100%);
}

.osk-key.backspace:active {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
}

.osk-key.shift {
    min-width: 56px;
    background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
}

.osk-key.shift.active {
    background: linear-gradient(180deg, #a74e9e 0%, #7a3a74 100%);
    border-color: rgba(167, 78, 158, 0.6);
}

.osk-key.space {
    flex: 1;
    max-width: 200px;
    min-width: 120px;
}

.osk-key.arrow {
    min-width: 48px;
    background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
}

.osk-key.arrow:hover {
    background: linear-gradient(180deg, #4a4a5a 0%, #3a3a4a 100%);
}

.osk-key.toggle-keyboard {
    min-width: 56px;
    background: linear-gradient(180deg, #3a4a3a 0%, #2a3a2a 100%);
    font-size: 12px;
}

.osk-key.clear {
    min-width: 56px;
    background: linear-gradient(180deg, #4a3a3a 0%, #3a2a2a 100%);
}

.osk-key.clear:hover {
    background: linear-gradient(180deg, #5a3a3a 0%, #4a2a2a 100%);
}

.osk-key.enter {
    min-width: 56px;
    font-size: 11px;
    background: linear-gradient(180deg, #3a5a3a 0%, #2a4a2a 100%);
}

.osk-key.enter:hover {
    background: linear-gradient(180deg, #4a6a4a 0%, #3a5a3a 100%);
}

.osk-key svg {
    width: 20px;
    height: 20px;
}

/* Number Pad Layout */
.osk-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 280px;
    margin: 0 auto;
    padding: 0 20px;
}

.osk-numpad .osk-key {
    height: 60px;
    font-size: 24px;
    font-weight: 600;
}

.osk-numpad .osk-key.wide {
    grid-column: span 3;
}

.osk-numpad .osk-key.backspace,
.osk-numpad .osk-key.clear,
.osk-numpad .osk-key.toggle-keyboard {
    font-size: 14px;
}

.osk-numpad .osk-key.toggle-keyboard {
    background: linear-gradient(180deg, #3a4a5a 0%, #2a3a4a 100%);
}

.osk-numpad .osk-key.toggle-keyboard:hover {
    background: linear-gradient(180deg, #4a5a6a 0%, #3a4a5a 100%);
}

/* Numpad mode - compact preview */
.osk-container.numpad-mode .osk-input-preview {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.osk-container.numpad-mode .osk-preview-value {
    font-size: 28px;
    letter-spacing: 2px;
}

/* Responsive Adjustments */
@media (min-width: 768px) {
    .osk-keyboard {
        padding: 16px 20px 24px;
    }
    
    .osk-key {
        min-width: 44px;
        height: 54px;
        font-size: 18px;
        gap: 8px;
    }
    
    .osk-row {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .osk-key.backspace {
        min-width: 80px;
    }
    
    .osk-key.shift {
        min-width: 72px;
    }
    
    .osk-numpad .osk-key {
        height: 68px;
        font-size: 28px;
    }
    
    .osk-numpad {
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .osk-key {
        min-width: 28px;
        height: 42px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    .osk-row {
        gap: 4px;
        margin-bottom: 4px;
    }
    
    .osk-key.backspace {
        min-width: 48px;
    }
    
    .osk-key.shift,
    .osk-key.toggle-keyboard,
    .osk-key.clear,
    .osk-key.enter,
    .osk-key.arrow {
        min-width: 38px;
        font-size: 10px;
    }
    
    .osk-key.arrow svg {
        width: 16px;
        height: 16px;
    }
    
    .osk-preview-value {
        font-size: 16px;
    }
    
    .osk-numpad {
        max-width: 240px;
    }
    
    .osk-numpad .osk-key {
        height: 52px;
        font-size: 22px;
    }
    
    .osk-container.numpad-mode .osk-preview-value {
        font-size: 24px;
    }
    
    .osk-input-preview {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .osk-done-btn {
        padding: 6px 14px;
        font-size: 12px;
    }
}
