/* ============================================
   VIRTUAL KEYBOARD — Modern Reskin
   Overrides angular-virtual-keyboard defaults
   ============================================ */

/* ── Container ── */
table.keyboardInputMaster {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  background-color: var(--rw-card-bg, #ffffff);
  border: 1px solid var(--rw-border, #e2e5ea);
  border-radius: 12px;
  box-shadow: 0 8px 30px var(--rw-shadow-md, rgba(0,70,255,0.15));
  opacity: 1;
  filter: none;
  padding: 6px;
  z-index: 1000000;
}

table.keyboardInputMaster,
table.keyboardInputMaster.relativeKeyboard {
  border-radius: 12px;
}

/* ── Reset all children ── */
table.keyboardInputMaster * {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--rw-text, #1f2937);
}

/* ── Size overrides ── */
table.keyboardInputMaster.keyboardInputSize1,
table.keyboardInputMaster.keyboardInputSize1 * {
  font-size: 14px;
}

table.keyboardInputMaster.keyboardInputSize3,
table.keyboardInputMaster.keyboardInputSize3 * {
  font-size: 18px;
}

table.keyboardInputMaster.keyboardInputSize4,
table.keyboardInputMaster.keyboardInputSize4 * {
  font-size: 22px;
}

table.keyboardInputMaster.keyboardInputSize5,
table.keyboardInputMaster.keyboardInputSize5 * {
  font-size: 26px;
}

/* ── Header bar (language selector, controls) ── */
table.keyboardInputMaster thead tr th {
  background-color: var(--rw-surface, #f8fafc);
  border-radius: 8px 8px 0 0;
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--rw-border, #e2e5ea);
}

/* ── Header buttons (close, size, etc.) ── */
table.keyboardInputMaster thead tr th span,
table.keyboardInputMaster thead tr th strong,
table.keyboardInputMaster thead tr th small,
table.keyboardInputMaster thead tr th big {
  background-color: var(--rw-white, #ffffff);
  border: 1px solid var(--rw-border, #e2e5ea);
  border-radius: 6px;
  padding: 2px 8px;
  height: auto;
  line-height: 1.6;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

table.keyboardInputMaster thead tr th span:hover,
table.keyboardInputMaster thead tr th span.hover,
table.keyboardInputMaster thead tr th strong:hover,
table.keyboardInputMaster thead tr th strong.hover,
table.keyboardInputMaster thead tr th small:hover,
table.keyboardInputMaster thead tr th small.hover,
table.keyboardInputMaster thead tr th big:hover,
table.keyboardInputMaster thead tr th big.hover {
  background-color: var(--rw-primary-light, #eef3ff);
  border-color: var(--rw-primary, #4f6ae8);
}

table.keyboardInputMaster thead tr th small {
  border-radius: 6px 0 0 6px;
  border-right: 1px solid var(--rw-border, #e2e5ea);
}

table.keyboardInputMaster thead tr th big {
  border-radius: 0 6px 6px 0;
  border-left: none;
}

/* ── Language dropdown ── */
table.keyboardInputMaster thead tr th div {
  font-size: 13px;
  font-weight: 600;
  color: var(--rw-text, #1f2937);
}

table.keyboardInputMaster thead tr th div ol {
  background-color: var(--rw-card-bg, #ffffff);
  border: 1px solid var(--rw-border, #e2e5ea);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--rw-shadow-sm, rgba(0,70,255,0.08));
  overflow-y: auto;
}

table.keyboardInputMaster thead tr th div ol li {
  padding: 6px 10px;
  font-size: 13px;
  transition: background-color 0.1s ease;
}

table.keyboardInputMaster thead tr th div ol li.selected {
  background-color: var(--rw-primary-light, #eef3ff);
}

table.keyboardInputMaster thead tr th div ol li:hover,
table.keyboardInputMaster thead tr th div ol li.hover {
  background-color: var(--rw-nav-hover-bg, rgba(0,0,0,0.04));
}

/* ── Key cells ── */
table.keyboardInputMaster tbody tr td {
  padding: 3px;
}

table.keyboardInputMaster tbody tr td table tbody tr td {
  background-color: var(--rw-white, #ffffff);
  border: 1px solid var(--rw-border, #e2e5ea);
  border-radius: 8px;
  padding: 0 8px;
  height: 40px;
  min-width: 32px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--rw-text, #1f2937);
  cursor: pointer;
  text-align: center;
  vertical-align: middle;
  transition: background-color 0.1s ease, border-color 0.1s ease, transform 0.08s ease;
  box-shadow: 0 1px 2px var(--rw-shadow-xs, rgba(0,70,255,0.03));
}

/* ── Space bar ── */
table.keyboardInputMaster tbody tr td table tbody tr td.space {
  padding: 0 6em;
  border-radius: 8px;
}

/* ── Dead key ── */
table.keyboardInputMaster tbody tr td table tbody tr td.deadkey {
  background-color: var(--rw-primary-light, #eef3ff);
  border-color: var(--rw-primary, #4f6ae8);
}

/* ── Target key ── */
table.keyboardInputMaster tbody tr td table tbody tr td.target {
  background-color: var(--rw-active-bg-soft, #eef2ff);
}

/* ── Key hover ── */
table.keyboardInputMaster tbody tr td table tbody tr td:hover,
table.keyboardInputMaster tbody tr td table tbody tr td.hover {
  background-color: var(--rw-primary-light, #eef3ff);
  border-color: var(--rw-primary, #4f6ae8);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px var(--rw-shadow-sm, rgba(0,70,255,0.08));
}

/* ── Key pressed ── */
table.keyboardInputMaster thead tr th span:active,
table.keyboardInputMaster thead tr th span.pressed,
table.keyboardInputMaster tbody tr td table tbody tr td:active,
table.keyboardInputMaster tbody tr td table tbody tr td.pressed {
  background-color: var(--rw-primary, #4f6ae8);
  border-color: var(--rw-primary-dark, #3a56d4);
  color: var(--rw-white, #ffffff);
  transform: translateY(0);
  box-shadow: none;
}

/* ── Secondary label on keys ── */
table.keyboardInputMaster tbody tr td table tbody tr td small {
  font-size: 9px;
  color: var(--rw-text-light, #6b7280);
  line-height: 1;
}

/* ── Numpad separator ── */
table.keyboardInputMaster tbody tr td.keyboardInputNumpad table {
  margin-left: 6px;
}

/* ── Keyboard icon/initiator ── */
.keyboardInputInitiator {
  margin: 0 6px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.keyboardInputInitiator:hover {
  opacity: 1;
}

/* ── Bottom labels ── */
table.keyboardInputMaster tbody tr td div var {
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  color: var(--rw-text-light, #6b7280);
}
