@use './variables-global' as *;

/*~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. text ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.*/

input {
  background-color: transparent;
  border: none;
  border-radius: 2px;
  color: $primary_color_text;
  height: 100%;
  margin: 0;
  padding: 1px 0 2px;
  width: 100%;
}

input:focus-visible {
  outline: none;
}

.bg_lightgray .sh-input-text {
  background-color: #fff;
}

/*~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. radio ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.*/

.sh-radio,
.sh-switch,
.sh-checkbox {
  align-items: center;
  display: flex;
  gap: 6px;
  position: relative;

  input {
    cursor: pointer;
    height: 100%;
    left: 0;
    opacity: 0;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 9;
  }

  .remark::before {
    content: "";
    transition: 0.3s;
  }

  input:disabled~.remark {
    background-color: #d4d4d4;
  }

  .text {
    font-weight: 400;
  }

  input:checked~.text {
    font-weight: 500;
  }
}

.sh-switch {
  margin: 0;

  .remark {
    background-color: #e0e0e0;
    border: 1px solid #ccc;
    border-radius: 99px;
    flex: 44px 0 0;
    height: 24px;
    transition: .3s;
    width: 44px;
  }

  .remark::before {
    background-color: #fff;
    border-radius: 99px;
    height: 18px;
    left: 3px;
    position: absolute;
    top: 2px;
    transition: .3s;
    width: 18px;
  }

  input:checked~.remark {
    background-color: #005fff;
    border-color: #005fff;
  }

  input:checked~.remark::before {
    left: 22px;
  }
}

.sh-checkbox {
  .remark {
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    flex: 24px 0 0;
    height: 24px;
    width: 24px;
  }

  .remark::before {
    background-color: transparent;
    border: solid #fff;
    border-radius: 0;
    border-width: 0 0 2px 2px;
    height: 8px;
    left: 5px;
    position: absolute;
    top: 5px;
    transform: rotate(-45deg);
    width: 14px;
  }

  input:checked~.remark {
    background-color: #005fff;
    border-color: #005fff;
  }
}

.sh-radio {
  margin: 0;

  .remark {
    align-items: center;
    border: 1.5px solid #d0d0d0;
    border-radius: 99px;
    display: flex;
    flex: 24px 0 0;
    height: 24px;
    justify-content: center;
    transition: .3s;
    width: 24px;
  }

  .remark::before {
    background-color: #005fff;
    border-radius: 99px;
    height: 0;
    width: 0;
  }

  input:checked~.remark {
    border-color: #005fff;
  }

  input:checked~.remark::before {
    height: 15px;
    width: 15px;
  }
}

.sh-file {
  background-color: #f2f2f2;
  background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='2' ry='2' stroke='%23CEA709' stroke-width='2' stroke-dasharray='4%2c 5' stroke-dashoffset='5' stroke-linecap='round'/%3e%3c/svg%3e");
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  height: 70px;
  max-width: 100%;
  position: relative;
  transition: .3s;
  width: 106px;

  input {
    background-color: transparent;
    cursor: pointer;
    height: 100%;
    left: 0;
    opacity: 0;
    padding: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 9;
  }

  .remark {
    align-items: center;
    background-color: transparent;
    color: #b0b0b0;
    display: flex;
    flex-direction: column;
    font-size: 30px;
    gap: 7px;
    height: 100%;
    justify-content: center;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
  }

  img {
    border-radius: 2px;
    height: 100%;
    left: 50%;
    object-fit: cover;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: .3s;
    width: 100%;
  }

  button {
    color: #404040;
    font-size: 16px;
    position: absolute;
    right: -5px;
    top: -7px;
    transform: scale(0);
    transition: .3s;
    z-index: 10;
  }

  &.active img {
    transform: translate(-50%, -50%) scale(1);
  }

  &.active button {
    transform: scale(1);
  }
}

.sh-file_unview {
  align-items: center;
  background-color: #f2f2f2;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  display: flex;
  height: 40px;
  justify-content: stretch;
  padding: 0 2px 0 12px;
  width: 100%;

  .file_content {
    flex: 1 0 0;
    height: 100%;
    max-width: calc(100% - 154px);
    position: relative;
  }

  .file_content input {
    cursor: pointer;
    height: 100%;
    opacity: 0;
    position: absolute;
    width: 100%;
    z-index: 9;
  }

  .remark {
    align-items: center;
    background-color: transparent;
    display: flex;
    font-weight: 400;
    height: 100%;

    p {
      font-size: 14px;
      margin: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  .file_action {
    flex: 1 0 0;
    justify-content: flex-end;
    padding-left: 12px;
  }

  .btn-primary {
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    height: 34px;
    padding: 1px 16px 2px;
    white-space: nowrap;
  }

  &.loading .btn-primary {
    font-size: 0;
    padding: 1px 12px 2px;
  }

  &.loading .btn-primary::before {
    animation: spin 2s infinite linear;
    border: 2px solid;
    border-color: #999 #fff #999 #999;
    border-radius: 999px;
    content: "";
    height: 20px;
    width: 20px;
  }
}
