/**
 * TouchSpin styles for Bootstrap 5
 * 
 * Default Bootstrap 5 values - override these variables before importing for customization
 */
/* This SCSS file is unnecessary if you are not using vertical buttons functionality */
/* Ensure input-group takes full width */
.input-group.bootstrap-touchspin {
  width: 100%;
}

.bootstrap-touchspin .bootstrap-touchspin-vertical-button-wrapper {
  position: relative;
  width: 25px;
  border: none;
}
.bootstrap-touchspin .input-group-btn-vertical {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
}
.bootstrap-touchspin .input-group-btn-vertical > .btn {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  padding: 0;
  text-align: center;
  line-height: 1;
}
.bootstrap-touchspin .input-group-btn-vertical .btn {
  font-size: calc(0.875rem * 0.85);
  line-height: 1;
}
.bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-up {
  border-radius: 0 0.25rem 0 0;
  border-bottom: 0;
  top: 0;
}
.bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-down {
  border-radius: 0 0 0.25rem 0;
  bottom: 0;
}
.bootstrap-touchspin .input-group-btn-vertical i {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: calc(0.875rem * 0.65);
}
.bootstrap-touchspin .input-group-addon .input-group-btn-vertical .bootstrap-touchspin-up {
  border-radius: 0 0.25rem 0 0;
  top: 0;
}
.bootstrap-touchspin .input-group-addon:not(:last-child) .input-group-btn-vertical .bootstrap-touchspin-up,
.bootstrap-touchspin .input-group-addon:not(:last-child) .input-group-btn-vertical .bootstrap-touchspin-down,
.bootstrap-touchspin .input-group-text:not(:last-child) .input-group-btn-vertical .bootstrap-touchspin-up,
.bootstrap-touchspin .input-group-text:not(:last-child) .input-group-btn-vertical .bootstrap-touchspin-down,
.bootstrap-touchspin .input-group-btn:not(:last-child):not(:first-child) .btn {
  border-radius: 0;
}

/* RTL support for vertical buttons */
[dir=rtl] .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-up,
.rtl .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-up {
  border-radius: 0.25rem 0 0 0;
}
[dir=rtl] .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-down,
.rtl .bootstrap-touchspin .input-group-btn-vertical .bootstrap-touchspin-down {
  border-radius: 0 0 0 0.25rem;
}
[dir=rtl] .bootstrap-touchspin .input-group-btn-vertical i,
.rtl .bootstrap-touchspin .input-group-btn-vertical i {
  left: auto;
  right: 5px;
}
[dir=rtl] .bootstrap-touchspin .input-group-addon .input-group-btn-vertical .bootstrap-touchspin-up,
.rtl .bootstrap-touchspin .input-group-addon .input-group-btn-vertical .bootstrap-touchspin-up {
  border-radius: 0.25rem 0 0 0;
}
[dir=rtl] .bootstrap-touchspin,
.rtl .bootstrap-touchspin {
  /* Vertical button wrapper is last child: apply border-radius */
}
[dir=rtl] .bootstrap-touchspin .bootstrap-touchspin-vertical-button-wrapper:last-child .input-group-btn-vertical .bootstrap-touchspin-up,
.rtl .bootstrap-touchspin .bootstrap-touchspin-vertical-button-wrapper:last-child .input-group-btn-vertical .bootstrap-touchspin-up {
  border-radius: 0.25rem 0 0 0;
}
[dir=rtl] .bootstrap-touchspin .bootstrap-touchspin-vertical-button-wrapper:last-child .input-group-btn-vertical .bootstrap-touchspin-down,
.rtl .bootstrap-touchspin .bootstrap-touchspin-vertical-button-wrapper:last-child .input-group-btn-vertical .bootstrap-touchspin-down {
  border-radius: 0 0 0 0.25rem;
}

/* LTR: Reset border-radius for HORIZONTAL buttons when not in first/last position */
.bootstrap-touchspin:not(.bootstrap-touchspin-vertical) {
  /* Down button: only round left side if it's first child (exclude vertical buttons) */
}
.bootstrap-touchspin:not(.bootstrap-touchspin-vertical) > .bootstrap-touchspin-down:not(:first-child) {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}
.bootstrap-touchspin:not(.bootstrap-touchspin-vertical) {
  /* Up button: only round right side if it's last child (exclude vertical buttons) */
}
.bootstrap-touchspin:not(.bootstrap-touchspin-vertical) > .bootstrap-touchspin-up:not(:last-child) {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

/* RTL: Swap the logic for right-to-left layouts (horizontal buttons only) */
[dir=rtl] .bootstrap-touchspin:not(.bootstrap-touchspin-vertical),
.rtl .bootstrap-touchspin:not(.bootstrap-touchspin-vertical) {
  /* Down button in RTL: only round right side if it's first child (exclude vertical) */
}
[dir=rtl] .bootstrap-touchspin:not(.bootstrap-touchspin-vertical) > .bootstrap-touchspin-down:not(:first-child),
.rtl .bootstrap-touchspin:not(.bootstrap-touchspin-vertical) > .bootstrap-touchspin-down:not(:first-child) {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
[dir=rtl] .bootstrap-touchspin:not(.bootstrap-touchspin-vertical),
.rtl .bootstrap-touchspin:not(.bootstrap-touchspin-vertical) {
  /* Up button in RTL: only round left side if it's last child (exclude vertical) */
}
[dir=rtl] .bootstrap-touchspin:not(.bootstrap-touchspin-vertical) > .bootstrap-touchspin-up:not(:last-child),
.rtl .bootstrap-touchspin:not(.bootstrap-touchspin-vertical) > .bootstrap-touchspin-up:not(:last-child) {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}
