/* ═════════════════════════════════════════════════════════════════════
   HOLOGRAPHIC NEURAL VIRTUAL KEYBOARD (VISION PRO / JARVIS STYLE)
   ═════════════════════════════════════════════════════════════════════ */

#ai-virtual-keyboard {
    position: fixed;
    z-index: 999995;
    background: rgba(8, 12, 28, 0.88);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(0, 245, 255, 0.45);
    border-radius: 20px;
    padding: 12px 16px 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7),
                0 0 35px rgba(0, 245, 255, 0.25),
                inset 0 0 25px rgba(0, 245, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s cubic-bezier(0.2, 0.9, 0.3, 1),
                transform 0.4s cubic-bezier(0.18, 0.9, 0.32, 1.25);
    max-width: 860px;
    width: 94%;
}

/* Docked Bottom Position (Default Rock-Solid Mode) */
#ai-virtual-keyboard.docked-bottom {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(140%);
}

#ai-virtual-keyboard.docked-bottom.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Floating Mode */
#ai-virtual-keyboard:not(.docked-bottom).active {
    opacity: 1;
    pointer-events: auto;
}

/* Lock Status Badge & Border glow */
#ai-virtual-keyboard.is-locked {
    border-color: rgba(0, 245, 255, 0.55);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8),
                0 0 40px rgba(0, 245, 255, 0.3),
                inset 0 0 30px rgba(0, 245, 255, 0.12);
}

/* ── Top Header / Control Bar ── */
.vk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 245, 255, 0.18);
    gap: 12px;
}

.vk-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    flex: 1;
}

.vk-badge {
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #00f5ff, #7b2fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    text-transform: uppercase;
}

.vk-input-preview {
    font-family: 'Space Grotesk', monospace, sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 245, 255, 0.08);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 8px;
    padding: 3px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
    display: flex;
    align-items: center;
}

.vk-cursor-caret {
    color: #00f5ff;
    animation: vk-caret-blink 0.8s infinite;
    margin-left: 2px;
    font-weight: bold;
}

@keyframes vk-caret-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.vk-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vk-ctrl-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Syne', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.vk-ctrl-btn:hover {
    background: rgba(0, 245, 255, 0.18);
    border-color: #00f5ff;
    color: #00f5ff;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.3);
}

.vk-ctrl-btn.active {
    background: rgba(0, 245, 255, 0.22);
    border-color: #00f5ff;
    color: #00f5ff;
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.4);
}

.vk-drag-handle {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
}

#ai-virtual-keyboard.is-locked .vk-drag-handle {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.vk-drag-handle:hover {
    color: #00f5ff;
    background: rgba(0, 245, 255, 0.1);
}

.vk-close-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 45, 120, 0.15);
    border: 1px solid rgba(255, 45, 120, 0.4);
    color: #ff2d78;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.vk-close-btn:hover {
    background: #ff2d78;
    color: #fff;
    box-shadow: 0 0 14px rgba(255, 45, 120, 0.6);
}

/* ── Keys Layout Grid ── */
.vk-keys-body {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.vk-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.vk-key {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-family: 'Syne', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    border-radius: 10px;
    height: 48px;
    min-width: 44px;
    flex: 1;
    max-width: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    user-select: none;
    outline: none;
}

.vk-key-char {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

/* Hover & AI Snap States */
.vk-key:hover,
.vk-key.ai-snapped {
    background: rgba(0, 245, 255, 0.22);
    border-color: #00f5ff;
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.55),
                inset 0 0 10px rgba(0, 245, 255, 0.2);
    transform: translateY(-2px) scale(1.04);
    color: #ffffff;
}

/* Active Click / Pinch Hit */
.vk-key:active,
.vk-key.active-hit {
    background: linear-gradient(135deg, #00f5ff, #7b2fff) !important;
    border-color: #ffffff !important;
    color: #000000 !important;
    font-weight: 800 !important;
    transform: scale(0.92) !important;
    box-shadow: 0 0 25px #00f5ff, 0 0 45px #7b2fff !important;
}

/* Action & Wide Keys */
.vk-key-action {
    flex: 1.35;
    max-width: 90px;
    font-size: 0.9rem;
    background: rgba(123, 47, 255, 0.12);
    border-color: rgba(123, 47, 255, 0.35);
    color: #d1b8ff;
}

.vk-key-action:hover,
.vk-key-action.ai-snapped {
    border-color: #c49eff;
    box-shadow: 0 0 18px rgba(123, 47, 255, 0.6);
}

.vk-key-active-toggle {
    background: rgba(0, 245, 255, 0.3) !important;
    border-color: #00f5ff !important;
    color: #00f5ff !important;
}

.vk-key-space {
    flex: 4.5;
    max-width: 320px;
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.vk-key-danger {
    background: rgba(255, 45, 120, 0.12);
    border-color: rgba(255, 45, 120, 0.3);
    color: #ff5592;
}

.vk-key-danger:hover {
    background: rgba(255, 45, 120, 0.3);
    border-color: #ff2d78;
    box-shadow: 0 0 18px rgba(255, 45, 120, 0.6);
}

/* ── Dwell Air-Hover Circular Countdown ── */
.vk-dwell-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    width: 38px;
    height: 38px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 1;
}

.vk-dwell-path {
    fill: none;
    stroke: #00f5ff;
    stroke-width: 3;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    stroke-linecap: round;
}

.vk-key.is-dwelling .vk-dwell-circle {
    opacity: 1;
}

.vk-key.is-dwelling .vk-dwell-path {
    animation: vk-dwell-fill 0.55s linear forwards;
}

@keyframes vk-dwell-fill {
    0% { stroke-dashoffset: 100; stroke: #00f5ff; }
    80% { stroke: #00ffaa; }
    100% { stroke-dashoffset: 0; stroke: #ffea00; }
}

/* Focused Input Highlighting */
.ai-typing-glow {
    box-shadow: 0 0 0 2px #00f5ff, 0 0 22px rgba(0, 245, 255, 0.6) !important;
    border-color: #00f5ff !important;
    animation: input-pulse 1.8s infinite alternate ease-in-out;
}

@keyframes input-pulse {
    0% { box-shadow: 0 0 0 2px #00f5ff, 0 0 15px rgba(0, 245, 255, 0.4); }
    100% { box-shadow: 0 0 0 3px #00f5ff, 0 0 28px rgba(0, 245, 255, 0.8); }
}

/* Mobile & Small Screen Adaptations */
@media (max-width: 600px) {
    #ai-virtual-keyboard {
        padding: 8px 10px 12px;
        width: 98%;
        bottom: 10px;
    }
    .vk-key {
        height: 42px;
        font-size: 1rem;
        min-width: 28px;
    }
    .vk-header {
        flex-wrap: wrap;
    }
}
