/* Container do input customizado */
.balance-input-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Container com botões + e - */
.balance-input-container {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Botões de incremento/decremento - MELHORADOS */
.balance-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cor-primaria) 0%, var(--cor-primaria) 100%);
  border: none;
  color: var(--cor-texto-principal);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 0;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Efeito de brilho nos botões */
.balance-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.balance-btn:hover::before {
  left: 100%;
}

.balance-btn svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
  position: relative;
  z-index: 1;
}

.balance-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.balance-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.balance-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(128, 128, 128, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Botão decrementar com animação de pulse quando habilitado */
.balance-btn-decrement:not(:disabled) {
  animation: pulse-red 2s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% {
    box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.15),
      0 0 0 3px rgba(255, 100, 100, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
}

/* Botão incrementar com animação de pulse */
.balance-btn-increment {
  animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% {
    box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.15),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.15),
      0 0 0 3px rgba(100, 255, 100, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
}

/* Wrapper com R$ fixo */
.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  border: 2px solid var(--cor-primaria);
  border-radius: 10px;
  background: var(--cor-fundo-card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* R$ fixo */
.currency-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: 700;
  color: var(--cor-primaria);
  pointer-events: none;
  z-index: 1;
  user-select: none;
  -webkit-user-select: none;
}

/* Campo de input */
.balance-input-field {
  flex: 1;
  width: 100%;
  padding: 10px 14px 10px 48px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-size: 16px;
  font-weight: 700;
  color: var(--cor-primaria);
  text-align: right;
  transition: all 0.3s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

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

.balance-input-field:focus,
.balance-input-field.has-focus {
  outline: none;
}

.input-with-prefix:has(.balance-input-field:focus),
.input-with-prefix:has(.balance-input-field.has-focus) {
  border: 2px solid var(--cor-primaria);
  box-shadow: 
    0 0 0 3px rgba(255, 215, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.02);
}

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

.balance-input-field.selected ~ .currency-prefix,
.input-with-prefix:has(.balance-input-field.selected) {
  background: var(--cor-primaria);
}

.input-with-prefix:has(.balance-input-field.selected) .currency-prefix {
  color: var(--cor-texto-principal);
}

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

/* Hover */
@media (hover: hover) {
  .input-with-prefix:hover:not(:has(.balance-input-field:disabled)):not(:has(.balance-input-field.selected)) {
    border-color: var(--cor-primaria);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  }
}

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

/* Tablets (até 768px) */
@media (max-width: 768px) {
  .balance-input-container {
    gap: 6px;
  }
  
  .currency-prefix {
    left: 12px;
    font-size: 15px;
  }
  
  .balance-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  
  .balance-btn svg {
    width: 18px;
    height: 18px;
  }

  .balance-input-field {
    padding: 9px 12px 9px 44px;
    font-size: 15px;
  }

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

/* Smartphones (até 480px) */
@media (max-width: 480px) {
  .balance-input-container {
    gap: 5px;
  }
  
  .currency-prefix {
    left: 10px;
    font-size: 14px;
  }
  
  .balance-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    border-radius: 9px;
  }
  
  .balance-btn svg {
    width: 16px;
    height: 16px;
  }

  .balance-input-field {
    padding: 8px 10px 8px 40px;
    font-size: 14px;
  }

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

/* Smartphones pequenos (até 360px) */
@media (max-width: 360px) {
  .balance-input-container {
    gap: 4px;
  }
  
  .currency-prefix {
    left: 9px;
    font-size: 13px;
  }
  
  .balance-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  
  .balance-btn svg {
    width: 14px;
    height: 14px;
  }

  .balance-input-field {
    padding: 7px 9px 7px 38px;
    font-size: 13px;
  }

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

/* ========================================
   TEMA MODERNO - INPUT DE SALDO MENOR
   ======================================== */

.theme-modern .balance-input-container {
  gap: 6px !important;
}

.theme-modern .balance-btn {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  border-radius: 10px !important;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  border: none !important;
  background: var(--cor-primaria) !important;
  color: var(--cor-texto-principal) !important;
}

.theme-modern .balance-btn svg {
  width: 18px !important;
  height: 18px !important;
}

.theme-modern .balance-btn:hover:not(:disabled) {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18) !important;
  opacity: 0.9;
}

.theme-modern .balance-btn:disabled {
  background: var(--cor-fundo-card) !important;
  border: 2px solid var(--cor-borda-secundaria) !important;
  color: var(--cor-texto-secundario) !important;
}

.theme-modern .balance-input-field {
  padding: 9px 12px !important;
  border-radius: 9px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}

.theme-modern .balance-input-field:focus,
.theme-modern .balance-input-field.has-focus {
  box-shadow: 
    0 0 0 2px rgba(255, 215, 0, 0.3),
    0 3px 10px rgba(0, 0, 0, 0.15) !important;
}

.theme-modern .balance-input-field.selected {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15) !important;
}

@media (max-width: 768px) {
  .theme-modern .balance-input-container {
    gap: 5px !important;
  }
  
  .theme-modern .balance-btn {
    width: 32px !important;
    min-width: 32px !important;
    border-radius: 8px !important;
  }
  
  .theme-modern .balance-btn svg {
    width: 14px !important;
    height: 14px !important;
  }
  
  .theme-modern .balance-input-field {
    padding: 8px 10px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
  }
}

@media (max-width: 480px) {
  .theme-modern .balance-input-container {
    gap: 4px !important;
  }
  
  .theme-modern .balance-btn {
    width: 28px !important;
    min-width: 28px !important;
    border-radius: 7px !important;
  }
  
  .theme-modern .balance-btn svg {
    width: 12px !important;
    height: 12px !important;
  }
  
  .theme-modern .balance-input-field {
    padding: 7px 9px !important;
    border-radius: 7px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 360px) {
  .theme-modern .balance-input-container {
    gap: 3px !important;
  }
  
  .theme-modern .balance-btn {
    width: 26px !important;
    min-width: 26px !important;
    border-radius: 6px !important;
  }
  
  .theme-modern .balance-btn svg {
    width: 11px !important;
    height: 11px !important;
  }
  
  .theme-modern .balance-input-field {
    padding: 6px 8px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
  }
}
