/* Coffee Virtual Keyboard — bottom-sheet on-screen keyboard for kiosk panels.
   Designed to sit above MudBlazor's MudOverlay/MudDialog (z-index 1300 / 1400).
   Body gets .cvk-padding when open so the focused input is reachable. */

.cvk-root {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: #f5f5f5;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.18);
    padding: 6px 6px max(8px, env(safe-area-inset-bottom)) 6px;
    transform: translateY(100%);
    transition: transform 220ms ease-out;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    font-family: Roboto, "Segoe UI", sans-serif;
}

.cvk-root--open {
    transform: translateY(0);
}

.cvk-keys {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 1100px;
    margin: 0 auto;
}

.cvk-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.cvk-key {
    flex: 1 1 0;
    min-width: 0;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    background: #fff;
    color: #212121;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: background 80ms, transform 80ms;
    -webkit-tap-highlight-color: transparent;
}

.cvk-key:hover {
    background: #eeeeee;
}

.cvk-key:active,
.cvk-key.cvk-key--pressed {
    background: #d0d0d0;
    transform: scale(0.96);
}

.cvk-key--wide {
    flex: 1.6 1 0;
    font-size: 16px;
    color: #555;
}

.cvk-key--space {
    flex: 6 1 0;
}

.cvk-key--accent {
    background: #4E342E;
    color: #fff;
    border-color: #4E342E;
}

.cvk-key--accent:hover {
    background: #3e2723;
}

.cvk-key--telex {
    flex: 1.2 1 0;
    color: #757575;
    font-size: 16px;
}

.cvk-key--active {
    background: #1565C0;
    color: #fff;
    border-color: #1565C0;
}

.cvk-key--active:hover {
    background: #0d47a1;
}

/* ── Numeric layout: 4×4 grid, all keys equal width, 0 spans 2 columns ── */
.cvk-keys--numeric {
    max-width: 520px;
}
.cvk-keys--numeric .cvk-key {
    flex: 1 1 0;
    height: 56px;
    font-size: 22px;
    font-weight: 600;
}
/* Override the QWERTY-style wide modifiers in numeric mode */
.cvk-keys--numeric .cvk-key--wide,
.cvk-keys--numeric .cvk-key--space,
.cvk-keys--numeric .cvk-key--telex {
    flex: 1 1 0;
    font-size: 22px;
}
/* "0" key spans 2 cells so the bottom row totals 4 cells like the others */
.cvk-keys--numeric .cvk-row:last-child .cvk-key[data-key="0"] {
    flex: 2 1 0;
}

/* Push body content up so the focused input isn't covered. ~280px = keyboard height
   for QWERTY layout (5 rows × 48px + gaps + padding). */
body.cvk-padding {
    padding-bottom: 290px !important;
    transition: padding-bottom 220ms ease-out;
}

/* ── Tablet / smaller screens ── */
@media (max-width: 600px) {
    .cvk-key { height: 42px; font-size: 16px; }
    .cvk-key--wide, .cvk-key--telex { font-size: 14px; }
    body.cvk-padding { padding-bottom: 250px !important; }
}

/* ── Dark mode ── */
html[data-coffee-dark="true"] .cvk-root {
    background: #2a2a2a;
    border-top-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.45);
}

html[data-coffee-dark="true"] .cvk-key {
    background: #3a3a3a;
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-coffee-dark="true"] .cvk-key:hover {
    background: #4a4a4a;
}

html[data-coffee-dark="true"] .cvk-key:active,
html[data-coffee-dark="true"] .cvk-key.cvk-key--pressed {
    background: #555;
}

html[data-coffee-dark="true"] .cvk-key--wide {
    color: #bbb;
}

html[data-coffee-dark="true"] .cvk-key--accent {
    background: #6d4c41;
    border-color: #6d4c41;
}

html[data-coffee-dark="true"] .cvk-key--accent:hover {
    background: #8d6e63;
}

html[data-coffee-dark="true"] .cvk-key--telex {
    color: #aaa;
}
