/* Container do input customizado */
.balance-input-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Box do input */
.input-balance-box {
  position: relative;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px dashed var(--cor-primaria);
  transition: all 0.3s ease;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
  cursor: text;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

/* Símbolo R$ */
.input-balance-box .balance {
  font-size: 18px;
  font-weight: 600;
  color: var(--cor-primaria);
  flex-shrink: 0;
}

/* Campo de input */
.balance-input-field {
  background: transparent;
  border: none;
  outline: none;
  flex: 1;
  min-width: 60px;
  max-width: 120px;
  font-size: 18px;
  font-weight: 700;
  color: var(--cor-primaria);
  transition: all 0.3s ease;
  text-align: left;
}

.balance-input-field::placeholder {
  color: var(--cor-primaria);
  opacity: 0.4;
  font-size: 14px;
  font-weight: 500;
  font-style: italic;
}

.balance-input-field:disabled, .disabled-input {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Ícone de cartão */
.input-icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  transition: all 0.3s ease;
  flex-shrink: 0;
  color: var(--cor-primaria);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Emoji de lápis (estado normal) */
.input-balance-box::before {
  content: "✏️";
  position: absolute;
  right: -8px;
  top: -12px;
  font-size: 18px;
  animation: bounce 2s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
  z-index: 10;
}

/* Animação de bounce */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0) rotate(-10deg);
  }
  50% {
    transform: translateY(-6px) rotate(-10deg);
  }
}

/* Estado com foco - usuário digitando */
.input-balance-box.has-focus {
  border: 2px solid var(--cor-primaria);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.18) 0%, rgba(255, 215, 0, 0.08) 100%);
  box-shadow: 
    0 0 0 3px rgba(255, 215, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 3px rgba(255, 255, 255, 0.2);
  transform: scale(1.02);
}

.input-balance-box.has-focus::before {
  display: none;
}

.input-balance-box.has-focus::after {
  content: "💡";
  position: absolute;
  right: -10px;
  top: -12px;
  font-size: 20px;
  animation: glow 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
  z-index: 10;
}

@keyframes glow {
  0%, 100% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.input-balance-box.has-focus .input-icon {
  opacity: 1;
  transform: scale(1.1);
}

.input-balance-box.has-focus .balance-input-field::placeholder {
  opacity: 0.6;
}

/* Estado selecionado */
.input-balance-box.selected {
  background: var(--cor-primaria);
  color: var(--cor-texto-principal);
  border: 2px solid var(--cor-primaria);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.input-balance-box.selected::before {
  display: none;
}

.input-balance-box.selected::after {
  content: "✓";
  position: absolute;
  right: -8px;
  top: -10px;
  background: #4caf50;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.4);
}

.input-balance-box.selected .balance-input-field,
.input-balance-box.selected .balance {
  color: var(--cor-texto-principal);
}

.input-balance-box.selected .balance-input-field::placeholder {
  color: var(--cor-texto-principal);
  opacity: 0.5;
}

.input-balance-box.selected .input-icon {
  color: var(--cor-texto-principal);
  opacity: 0.9;
}

/* Hover - feedback visual (apenas desktop) */
@media (hover: hover) {
  .input-balance-box:not(.disabled-input):not(.selected):hover {
    border-color: var(--cor-primaria);
    border-style: solid;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 215, 0, 0.05) 100%);
    transform: translateY(-2px);
    box-shadow: 
      0 6px 16px rgba(0, 0, 0, 0.12),
      inset 0 1px 2px rgba(255, 255, 255, 0.15);
  }

  .input-balance-box:not(.disabled-input):hover .input-icon {
    opacity: 0.9;
    transform: scale(1.1);
  }

  .input-balance-box:not(.disabled-input):hover::before {
    animation: bounce 1s ease-in-out infinite;
  }
}

/* ========================================
   RESPONSIVIDADE MOBILE
   ======================================== */

/* Tablets (até 768px) */
@media (max-width: 768px) {
  .input-balance-box {
    padding: 8px 14px;
    gap: 6px;
  }

  .input-balance-box .balance {
    font-size: 16px;
  }

  .balance-input-field {
    font-size: 16px;
    min-width: 50px;
    max-width: 100px;
  }

  .balance-input-field::placeholder {
    font-size: 13px;
  }

  .input-icon {
    width: 16px;
    height: 16px;
  }

  .input-balance-box::before {
    font-size: 16px;
    right: -6px;
    top: -10px;
  }

  .input-balance-box.has-focus::after {
    font-size: 18px;
    right: -8px;
    top: -10px;
  }

  .input-balance-box.has-focus {
    transform: scale(1.01);
  }
}

/* Smartphones (até 480px) */
@media (max-width: 480px) {
  .input-balance-box {
    padding: 8px 12px;
    gap: 6px;
  }

  .input-balance-box .balance {
    font-size: 15px;
  }

  .balance-input-field {
    font-size: 15px;
    min-width: 45px;
    max-width: 80px;
  }

  .balance-input-field::placeholder {
    font-size: 12px;
  }

  .input-icon {
    width: 15px;
    height: 15px;
  }

  .input-balance-box::before {
    font-size: 14px;
    right: -5px;
    top: -8px;
  }

  .input-balance-box.has-focus::after {
    font-size: 16px;
    right: -6px;
    top: -8px;
  }

  .input-balance-box.selected::after {
    width: 18px;
    height: 18px;
    font-size: 12px;
    right: -6px;
    top: -8px;
  }

  /* Reduz bounce em mobile */
  @keyframes bounce {
    0%, 100% {
      transform: translateY(0) rotate(-10deg);
    }
    50% {
      transform: translateY(-4px) rotate(-10deg);
    }
  }
}

/* Smartphones pequenos (até 360px) */
@media (max-width: 360px) {
  .input-balance-box {
    padding: 6px 10px;
    gap: 5px;
  }

  .input-balance-box .balance {
    font-size: 14px;
  }

  .balance-input-field {
    font-size: 14px;
    min-width: 40px;
    max-width: 70px;
  }

  .balance-input-field::placeholder {
    font-size: 11px;
  }

  .input-icon {
    width: 14px;
    height: 14px;
  }

  .input-balance-box::before {
    font-size: 13px;
    right: -4px;
    top: -7px;
  }

  .input-balance-box.has-focus::after {
    font-size: 15px;
    right: -5px;
    top: -7px;
  }

  .input-balance-box.selected::after {
    width: 16px;
    height: 16px;
    font-size: 11px;
    right: -5px;
    top: -7px;
  }
}
