/**
 * Number Input Component Styles
 * Household Management App
 */

.number-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.number-input {
  width: 100%;
  padding-right: 4rem; /* Space for increment/decrement buttons */
}

/* Increment/Decrement buttons container */
.number-input__increment,
.number-input__decrement {
  position: absolute;
  right: var(--spacing-3);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color var(--transition-fast);
  z-index: 1;
  pointer-events: auto;
}

.number-input__increment {
  top: calc(50% - 6px); /* Position above center, slightly overlapping */
}

.number-input__decrement {
  top: calc(50% + 6px); /* Position below center, slightly overlapping */
}

.number-input__increment:hover,
.number-input__decrement:hover {
  color: var(--text-primary);
}

.number-input__button--disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Icon styling - similar to custom-select-input__icon */
.number-input__icon {
  width: 12px;
  height: 12px;
  display: block;
  background-repeat: no-repeat;
  background-size: contain;
}

.number-input__icon--up {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 3L1 8h10z'/%3E%3C/svg%3E");
}

.number-input__icon--down {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Dark mode support */
[data-theme="dark"] .number-input__icon--up {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e5e7eb' d='M6 3L1 8h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .number-input__icon--down {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e5e7eb' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* Floating label support - adjust position when label is floating */
.form-group--floating .number-input-wrapper .number-input__increment {
  top: calc(56% - 6px);
  transform: translateY(-50%);
}

.form-group--floating .number-input-wrapper .number-input__decrement {
  top: calc(56% + 6px);
  transform: translateY(-50%);
}

/* Clear icon for number inputs - position left of increment/decrement buttons */
.number-input-wrapper ~ .form-input__clear,
.form-group--floating:has(.number-input-wrapper) .form-input__clear {
  right: calc(var(--spacing-3) + 24px) !important; /* Position left of buttons */
}

/* Floating label support for clear icon */
.form-group--floating .number-input-wrapper ~ .form-input__clear,
.form-group--floating:has(.number-input-wrapper) .form-input__clear {
  top: 56% !important;
}

/* Ensure input doesn't overlap buttons */
.number-input-wrapper .form-input {
  padding-right: 4rem; /* Space for both buttons */
}

/* Hide native browser spinner buttons */
.number-input::-webkit-inner-spin-button,
.number-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.number-input {
  -moz-appearance: textfield; /* Firefox */
}

