@import "../../styles/index.scss";

.slider-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: calc(100% + 20px); // Reserve space for info message
}

.impact_slider_layout {
  display: flex;
  gap: 16px;
  // flex-wrap: wrap;
  .input_layout_style {
    .MuiFormControl-root {
      .MuiInputBase-root {
        height: 32px;
        border: 1px solid #c3c8d4;
        border-radius: 8px;
        width: 75px;
        background-color: $whiteColor;

        &:focus {
          border: 1px solid $primaryColor;
        }

        &:hover {
          border: 1px solid $primaryColor;
        }

        fieldset {
          border: none !important;
        }
      }
    }
  }
  .impact_slider_layout_heading {
    font-size: 22px;
    font-weight: 400;
    line-height: 30.05px;
  }

  .header-top {
    flex-direction: column;
  }

  .header-left {
    flex-direction: row;
    gap: 32px;
    align-items: center;
  }

  .impact_slider_container {
    width: 390px;
    .impact_slider_labelname {
      display: block;
      font-size: 12px;
      font-weight: $normalFontWeight;
      color: $textButtonFontColor;
      margin-bottom: 8px;
      margin-top: 8px;
    }
    .impact_slider_main_container {
      display: flex;
      align-items: center;
      gap: 16px;
      position: relative;

      .impact_slider_threshold_marker {
        position: absolute;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 2px;
        height: 8px;
        border-radius: 1px;
        pointer-events: none;
        z-index: 1;
        background-color: #e74b1c;
      }

      .MuiSlider-root {
        color: $primaryColor;
        height: 4px;
      }
      .MuiSlider-rail {
        background: $disabledSecondaryBorder;
        opacity: 1;
      }
      .MuiSlider-thumb:hover {
        box-shadow: none;
      }
      .MuiSlider-valueLabel {
        background-color: #0d152c;
        color: $whiteColor;
      }
    }

    .impact_slider_main_container_disabled {
      pointer-events: none;
      .MuiSlider-root {
        color: $deactivateColor;
        height: 4px;
      }
      .MuiSlider-rail {
        background: $deactivateColor;
        opacity: 1;
      }
    }
  }

  .impact_slider_disabled {
    .MuiSlider-root {
      color: $disabledSecondaryBorder !important;
    }
    .MuiInputBase-root {
      color: $disabledSecondaryBorder;
      border: 1px solid $disabledSecondaryBorder;
      background: $inactiveInputBackground;

      &:focus {
        border: 1px solid $disabledSecondaryBorder !important;
      }

      &:hover {
        border: 1px solid $disabledSecondaryBorder !important;
      }

      fieldset {
        border: none !important;
      }
    }
  }

  // Input layout styles
  .input_layout_style {
    &.ranged {
      form {
        display: flex;
        align-items: center;
        .MuiFormControl-root {
          display: flex;
          flex-direction: row;
          align-items: center;
          justify-content: space-between;
          flex-grow: 1;
        }
      }
    }

    &.single {
      form {
        display: flex;
        align-items: center;
        justify-content: center;
        .MuiFormControl-root {
          width: 120px;
        }
      }
    }
  }
}

// Input position styles
.input-position-inline {
  align-items: flex-end !important;
  .impact_slider_layout {
    display: flex;
    gap: 24px;

    .impact_slider_main_container {
      flex: 1;
    }

    .input_layout_style {
      flex-shrink: 0;
    }
  }
}

.input-position-bottom {
  flex-direction: column;
  .impact_slider_layout {
    display: flex;
    gap: 16px;

    .impact_slider_main_container {
      width: 100%;
    }

    .input_layout_style {
      align-self: flex-end;
    }
  }
}
.MuiSlider-thumb {
  box-shadow: none !important;
}

.MuiSlider-thumb::before {
  box-shadow: none !important;
}

.MuiSlider-thumb:hover,
.MuiSlider-thumb:active {
  box-shadow: none !important;
  z-index: 2;
}

.MuiSlider-thumb.Mui-focusVisible {
  z-index: 2;
  outline: none;
  box-shadow:
    0 0 0 var(--ia-focus-ring-offset, 2px) var(--ia-focus-bg, #ffffff),
    0 0 0 calc(var(--ia-focus-ring-offset, 2px) + var(--ia-focus-ring-width, 2px)) var(--ia-focus-color, #4259ee) !important;
  transition: box-shadow 0.15s ease-in-out;
}

// Fix for disabled OutlinedInput hover/focus border issue
.Mui-disabled {
  pointer-events: none;

  // For input specifically
  &.MuiOutlinedInput-root {
    fieldset {
      border-color: #e0e0e0 !important; // or your disabled border color
    }
    &:hover fieldset,
    &:focus-within fieldset {
      border-color: #e0e0e0 !important; // override blue border on hover/focus
    }
  }
}

// Info message styles
.slider-info-message {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding-left: 91px; // input width and gap
  color: $destructiveBg;
  height: 20px; // Fixed height to prevent jerking
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;

  &.hidden {
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
  }

  .slider-info-icon {
    font-size: 14px;
    flex-shrink: 0;
  }

  .slider-info-text {
    font-weight: 500;
    line-height: 16px;
  }
}

// Info message placeholder - always present to maintain consistent height
.slider-info-placeholder {
  height: 20px;
  width: 100%;
}
