/**
 * VIRTUAL KEYBOARD — Styles for on-screen char bar
 *
 * Desktop: absolutely positioned below the input.
 * Mobile:  position: fixed, JS updates top via VisualViewport API so the
 *          bar sits directly above the native keyboard.
 */

.vkb-bar {
    position: absolute;
    z-index: 1000;
    background: rgba(27, 23, 48, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    animation: vkb-in 0.18s ease-out;
}

@keyframes vkb-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Mobile: fixed positioning, full width so it sits above native keyboard */
.vkb-bar--mobile {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;  /* JS sets this via visualViewport */
    width: 100%;
    max-width: 100%;
    border-radius: 14px 14px 0 0;
    border-bottom: none;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    padding: 6px 8px max(8px, env(safe-area-inset-bottom));
}

.vkb-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.vkb-key {
    min-width: 44px;
    height: 44px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: #FEF7EC;
    font-family: inherit;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, transform 0.12s;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vkb-key:hover {
    background: rgba(255, 255, 255, 0.14);
}

.vkb-key:active,
.vkb-key:focus-visible {
    background: rgba(205, 245, 70, 0.2);
    transform: scale(0.95);
    outline: none;
}

.vkb-key--shift {
    font-size: 20px;
    min-width: 48px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

.vkb-key--shift-on {
    background: rgba(205, 245, 70, 0.25);
    color: #CDF546;
    border-color: rgba(205, 245, 70, 0.4);
}

/* ── Setup link banner (non-Latin targets) ── */

.vkb-bar--link {
    padding: 10px 14px;
}

.vkb-setup-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #FEF7EC;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.vkb-setup-link:hover {
    color: #CDF546;
}

.vkb-setup-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.vkb-setup-text {
    flex: 1;
    min-width: 0;
}

.vkb-setup-arrow {
    font-size: 16px;
    color: #CDF546;
    transition: transform 0.15s;
}

.vkb-setup-link:hover .vkb-setup-arrow {
    transform: translateX(3px);
}

/* ── Responsive tweaks for small screens ── */

@media (max-width: 480px) {
    .vkb-key {
        min-width: 40px;
        height: 42px;
        font-size: 17px;
        padding: 0 8px;
    }
    .vkb-key--shift {
        min-width: 44px;
    }
    .vkb-row {
        gap: 5px;
    }
    .vkb-rows {
        gap: 5px;
    }
}

/* ── Light mode (rarely used on Polimio but just in case) ── */

@media (prefers-color-scheme: light) {
    .vkb-bar {
        background: rgba(255, 255, 255, 0.98);
        border-color: rgba(50, 46, 78, 0.1);
    }
    .vkb-key {
        background: rgba(50, 46, 78, 0.06);
        border-color: rgba(50, 46, 78, 0.1);
        color: #322E4E;
    }
    .vkb-key:hover {
        background: rgba(50, 46, 78, 0.12);
    }
    .vkb-key--shift {
        color: rgba(50, 46, 78, 0.5);
    }
    .vkb-setup-link {
        color: #322E4E;
    }
    .vkb-setup-link:hover {
        color: #4147D5;
    }
}
