@use "../mixins/function.scss" as *;
@use "../mixins/mixins.scss" as *;
@use "../common/var.scss" as *;

@include b(datetime-picker) {
  color: getCssVar("color", "text-1");
  line-height: 1.5715;
  @include e(wrapper) {
    display: inline-flex;
    align-items: center;
    height: 100%;
    width: 100%;
    gap: 8px;
    background-color: getCssVar("color", "bg-2");
    border: 1px solid getCssVar("color", "fill-3");
    &:hover {
      border: 1px solid getCssVar("color", "fill-4");
    }
    &:focus-within {
      border-color: getCssVar("color", "primary-6");
    }
    @include when(range) {
      &:focus-within {
        @include be(datetime-picker, input) {
          &:focus {
            background-color: getCssVar("color", "fill-2");
          }
        }
      }
    }
    @include when(disabled) {
      background-color: getCssVar("color", "fill-2");
      border-color: getCssVar("color", "fill-2");
      cursor: not-allowed;
    }
    @include when(error) {
      @include this-be(datetime-picker, wrapper) {
        border-color: getCssVar("color", "danger-6");
        &:hover {
          border-color: getCssVar("color", "danger-6");
        }
        &:focus-within {
          border-color: getCssVar("color", "danger-6");
        }
        @include when(filled) {
          background-color: getCssVar("color", "error-1");
          border-color: getCssVar("color", "error-1");
          &:hover {
            background-color: getCssVar("color", "error-2");
          }
          &:focus-within {
            background-color: getCssVar("color", "bg-2");
            border-color: getCssVar("color", "error-5");
          }
        }
      }
    }
    @include when(filled) {
      background-color: getCssVar("color", "fill-2");
      border: 1px solid getCssVar("color", "fill-2");
      &:hover {
        background-color: getCssVar("color", "fill-2");
      }
      &:focus-within {
        background-color: getCssVar("color", "bg-2");
        border-color: getCssVar("color", "primary-6");
      }
    }
  }

  @each $size in $size-list {
    @include m($size) {
      height: getCssVar("size", $size);
      line-height: getCssVar("size", $size);
      @include be(datetime-picker, wrapper) {
        border-radius: getCssVar("radius", $size);

        @if $size == "mini" {
          padding: 0px 8px 0 0;
        }
        @if $size == "small" {
          padding: 0px 8px 0 0;
        }
        @if $size == "medium" {
          padding: 4px 8px 4px 4px;
        }
        @if $size == "large" {
          padding: 4px 8px 4px 4px;
        }
      }
      @include be(datetime-picker, input) {
        font-size: getCssVar("font-size", $size);
      }
    }
  }

  @include e(input) {
    height: 100%;
    width: 100%;
    padding: 0 8px 0 8px;
    color: inherit;
    background: none;
    border: none;
    border-radius: 0;
    outline: none;
    color: getCssVar("color", "text-1");
    cursor: inherit;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    vertical-align: middle;
    &::placeholder {
      color: getCssVar("color", "text-3");
    }
  }

  @include e(close) {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    user-select: none;
    height: 18px;
    width: 18px;
    font-size: 14px;
    border-radius: getCssVar("radius", "circle");
    &:hover {
      background-color: getCssVar("color", "fill-2");
    }
  }
  @include e(icon) {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    user-select: none;
    height: 18px;
    width: 18px;
    font-size: 14px;
    color: getCssVar("color", "text-2");
  }
  @include e(content) {
    background-color: getCssVar("color", "bg-3");
    border-radius: getCssVar("radius", "medium");
    border: 1px solid getCssVar("color", "fill-3");
    box-shadow: getCssVar("shadow", "1");
  }
  @include e(panel-wrapper) {
    width: 264px;
    display: flex;
    flex-direction: column;
  }
  @include e(panel-time-main) {
    display: flex;
    flex: 1;
  }
  @include e(panel-header) {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid getCssVar("color", "fill-3");
    user-select: none;
  }
  @include e(panel-header-center) {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  @include e(panel-footer) {
    height: 40px;
    width: 100%;
    display: flex;
    border-top: 1px solid getCssVar("color", "fill-3");
    border-right: 1px solid getCssVar("color", "fill-3");
    &:last-child {
      border-right: none;
    }
  }
  @include e(panel-footer-tab) {
    height: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    cursor: pointer;
    color: getCssVar("color", "text-3");
    border-right: 1px solid getCssVar("color", "fill-3");
    @include when(active) {
      color: getCssVar("color", "text-1");
    }
    &:last-child {
      border-right: none;
    }
  }
  @include e(panel-action) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    border-top: 1px solid getCssVar("color", "fill-3");
  }
  @include e(panel-range) {
    width: 100%;
    display: flex;
    flex-direction: column;
  }
  @include e(panel-range-time) {
    display: flex;
    flex: 1;
  }
  @include e(panel-range-footer) {
    display: flex;
  }
}
