/* Overlay do teclado numérico */
.numeric-keyboard-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

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

/* Container do teclado */
.numeric-keyboard-container {
  width: 100%;
  max-width: 500px;
  background-color: var(--white, #fff);
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.numeric-keyboard-overlay.active .numeric-keyboard-container {
  transform: translateY(0);
}

/* Header do teclado */
.numeric-keyboard-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-light, #f5f5f5);
  background-color: var(--gray-light, #f5f5f5);
}

.numeric-keyboard-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #3e3e3e);
  margin: 0;
}

.numeric-keyboard-close {
  background: none;
  border: none;
  color: var(--light-text, #717171);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.numeric-keyboard-close:hover {
  background-color: var(--gray, #e8e8e8);
  color: var(--text, #3e3e3e);
}

/* Display de valor */
.numeric-keyboard-display {
  padding: 20px;
  background-color: var(--white, #fff);
  border-bottom: 1px solid var(--gray-light, #f5f5f5);
}

.numeric-keyboard-input {
  width: 100%;
  border: 2px solid var(--gray-light, #f5f5f5);
  border-radius: var(--item-border-radius, 10px);
  padding: 16px 20px;
  font-size: 28px;
  font-weight: 600;
  color: var(--text, #3e3e3e);
  text-align: center;
  background-color: var(--gray-light, #f5f5f5);
  font-family: var(--fonte, sans-serif);
  transition: all 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.numeric-keyboard-input::-webkit-inner-spin-button,
.numeric-keyboard-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.numeric-keyboard-input:focus {
  outline: none;
  border-color: var(--padrao, #ff3131);
  background-color: var(--white, #fff);
}

.numeric-keyboard-input.desktop-mode {
  cursor: text;
}

.numeric-keyboard-input.mobile-mode {
  cursor: default;
  caret-color: transparent;
}

/* Grid de teclas */
.numeric-keyboard-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background-color: var(--gray-light, #f5f5f5);
  padding: 1px;
}

.numeric-keyboard-key {
  background-color: var(--white, #fff);
  border: none;
  padding: 20px;
  font-size: 24px;
  font-weight: 500;
  color: var(--text, #3e3e3e);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  font-family: var(--fonte, sans-serif);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.numeric-keyboard-key:active {
  background-color: var(--gray-light, #f5f5f5);
  transform: scale(0.95);
}

.numeric-keyboard-key:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.numeric-keyboard-key:disabled:active {
  transform: none;
}

.numeric-keyboard-key.backspace {
  background-color: var(--gray-light, #f5f5f5);
  font-size: 20px;
}

.numeric-keyboard-key.backspace:active {
  background-color: var(--gray, #e8e8e8);
}

.numeric-keyboard-key.confirm {
  grid-column: span 3;
  background-color: var(--padrao, #ff3131);
  color: var(--white, #fff);
  font-size: 18px;
  font-weight: 600;
  padding: 18px;
  box-shadow: 0 -2px 8px rgba(234, 29, 44, 0.15);
}

.numeric-keyboard-key.confirm:active {
  background-color: var(--padrao, #ff3131);
  opacity: 0.9;
}

/* Feedback visual para botão pressionado */
.numeric-keyboard-key.pressed {
  background-color: var(--bg-hoover, #efefef);
}

/* Estilo responsivo para desktop */
@media (min-width: 769px) {
  .numeric-keyboard-overlay {
    align-items: center;
  }

  .numeric-keyboard-container {
    border-radius: var(--border-radius, 12px);
    max-width: 400px;
  }

  .numeric-keyboard-key {
    min-height: 56px;
    padding: 16px;
  }

  .numeric-keyboard-key:hover {
    background-color: var(--gray-light, #f5f5f5);
  }

  .numeric-keyboard-key.backspace:hover {
    background-color: var(--gray, #e8e8e8);
  }

  .numeric-keyboard-key.confirm:hover {
    opacity: 0.95;
  }
}

/* Animação de erro */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

.numeric-keyboard-input.error {
  animation: shake 0.3s ease;
  border-color: #ff3131;
}

/* Indicador de casas decimais */
.numeric-keyboard-decimal-info {
  text-align: center;
  font-size: 12px;
  color: var(--light-text, #717171);
  margin-top: 8px;
  font-weight: 500;
}
