@import '../../style/variable';
@import './token';

.#{$namespace} {
  &-year-picker {
    display: inline-flex;
    flex-direction: column;
    box-sizing: border-box;

    &__input {
      position: relative;
      display: inline-flex;
      align-items: center;
      width: 100%;
      margin: 0;
      padding: 4px 11px;
      color: rgb(0 0 0 / 88%);
      font-size: $year-picker-fontsize;
      line-height: 1;
      background-color: $white;
      border: 1px solid #d9d9d9;
      border-radius: 4px;
      transition:
        border 0.2s,
        box-shadow 0.2s;

      &--active,
      &:hover {
        border-color: $year-picker-hover-color;
        box-shadow: 0 0 0 2px rgb(5 145 255 / 10%);
      }

      $input: #{$namespace}-year-picker__input;

      &--has-value:hover {
        .#{$input}-clear {
          display: inline-block;
        }
      }

      &-entry {
        width: 100%;
        color: rgb(0 0 0 / 88%);
        font-size: $year-picker-fontsize;
        line-height: 1.5714;
        border: none;
        outline: none;

        &::placeholder {
          color: #a3b1bf;
        }
      }

      &-icon {
        display: inline-block;
        color: rgb(0 0 0 / 25%);
        margin-inline-start: 4px;
      }

      &-clear {
        position: absolute;
        top: 50%;
        display: none;
        color: rgb(0 0 0 / 25%);
        background: $white;
        transform: translateY(-50%);
        cursor: pointer;
        inset-inline-end: 11px;
      }
    }

    &__drop {
      position: relative;

      &-picker {
        min-width: 280px;
        min-height: 305px;
        overflow: hidden;
        background: #fff;
        border-radius: 8px;
        box-shadow:
          0 6px 16px 0 rgb(0 0 0 / 8%),
          0 3px 6px -4px rgb(0 0 0 / 12%),
          0 9px 28px 8px rgb(0 0 0 / 5%);

        &-header {
          display: flex;
          flex-direction: row;
          align-items: center;
          height: 40px;
          padding-right: 8px;
          padding-left: 8px;
          border-bottom: 1px solid rgb(5 5 5 / 6%);

          &-pre {
            min-width: 1.6em;
            color: rgb(0 0 0 / 45%);
            font-size: $year-picker-fontsize;
            background-color: transparent;
            border: none;
            outline: none;
            cursor: pointer;

            &:hover {
              color: rgb(0 0 0 / 88%);
            }

            & > span {
              position: relative;
              display: inline-block;
              width: 7px;
              height: 7px;
              line-height: 40px;
              transform: rotate(-45deg);

              &::before {
                position: absolute;
                top: 0;
                display: inline-block;
                width: 7px;
                height: 7px;
                border: 0 solid currentcolor;
                content: '';
                inset-inline-start: 0;
                border-block-start-width: 1.5px;
                border-block-end-width: 0;
                border-inline-start-width: 1.5px;
                border-inline-end-width: 0;
              }

              &::after {
                position: absolute;
                top: 4px;
                display: inline-block;
                width: 7px;
                height: 7px;
                border: 0 solid currentcolor;
                content: '';
                inset-inline-start: 4px;
                border-block-start-width: 1.5px;
                border-block-end-width: 0;
                border-inline-start-width: 1.5px;
                border-inline-end-width: 0;
              }
            }
          }

          &-info {
            flex: 1;
            font-weight: bold;
            font-size: $year-picker-fontsize;
            text-align: center;
          }

          &-next {
            min-width: 1.6em;
            color: rgb(0 0 0 / 45%);
            font-size: $year-picker-fontsize;
            background-color: transparent;
            border: none;
            outline: none;
            cursor: pointer;

            &:hover {
              color: rgb(0 0 0 / 88%);
            }

            & > span {
              position: relative;
              display: inline-block;
              width: 7px;
              height: 7px;
              line-height: 40px;
              transform: rotate(135deg);

              &::before {
                position: absolute;
                top: 0;
                display: inline-block;
                width: 7px;
                height: 7px;
                border: 0 solid currentcolor;
                content: '';
                inset-inline-start: 0;
                border-block-start-width: 1.5px;
                border-block-end-width: 0;
                border-inline-start-width: 1.5px;
                border-inline-end-width: 0;
              }

              &::after {
                position: absolute;
                top: 4px;
                display: inline-block;
                width: 7px;
                height: 7px;
                border: 0 solid currentcolor;
                content: '';
                inset-inline-start: 4px;
                border-block-start-width: 1.5px;
                border-block-end-width: 0;
                border-inline-start-width: 1.5px;
                border-inline-end-width: 0;
              }
            }
          }
        }

        &-body {
          display: grid;
          grid-template-rows: 24px 24px 24px 24px;
          grid-template-columns: 60px 60px 60px;
          gap: 60px 30px;
          height: calc(100% - 40px);
          padding: 20px;

          &-button {
            width: 100%;
            height: 100%;
            color: rgb(0 0 0 / 88%);
            background-color: $white;
            border: none;
            border-radius: 4px;
            outline: none;
            cursor: pointer;
            transition: all 0.2s;

            &:not(&--active):hover {
              background-color: rgb(0 0 0 / 4%);
            }

            &--active {
              color: $white;
              background-color: $year-picker-hover-color;
            }

            &--disabled {
              color: rgb(0 0 0 / 25%);
              cursor: not-allowed;
            }
          }
        }
      }
    }
  }
}
