/*!
 * coding=utf-8
 * Copyright 2021-present, the Recognai S.L. team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Visually hide an element
%visuallyhidden {
    margin: -1px;
    padding: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip: rect(0, 0, 0, 0);
    position: absolute;
}

// Linear gradient using $primary-color
%primary-color-gradient {
    background: $primary-color;
    background: -moz-linear-gradient( top, $primary-color 0%, $primary-lighten-color 100%);
    background: -webkit-linear-gradient( top, $primary-color 0%, $primary-lighten-color 100%);
    background: linear-gradient( to bottom, $primary-color 0%, $primary-lighten-color 100%);
}

// Linear gradient using $secondary-color
%secondary-color-gradient {
    background: $secondary-color;
    background: -moz-linear-gradient( top, $secondary-color 0%, $secondary-darken-color 55%, $secondary-color 100%);
    background: -webkit-linear-gradient( top, $secondary-color 0%, $secondary-darken-color 55%, $secondary-color 100%);
    background: linear-gradient( to bottom, $secondary-color 0%, $secondary-darken-color 55%, $secondary-color 100%);
}

// Align center block element
%center {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

%vertical-center {
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

// Clearfix
%clearfix {
    &:before,
    &:after {
        content: ' ';
        display: table;
    }
    &:after {
        clear: both;
    }
}

// Input
%clear-input {
    width: 100%;
    background: none;
    outline: none;
    box-shadow: none;
    border: 0;
}

%container {
    margin: 0 auto;
    padding: 4em;
}

// buttons
%button {
  position: relative;
  min-width: $button-width;
  min-height: $button-height;
  padding: 0 1.2em 0 1.2em;
  display: inline-block;
  position: relative;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
  outline: 0;
  background: none;
  border: 0;
  border-radius: $button-radius;
  font-family: $ff;
  @include font-size(13px);
  font-style: inherit;
  font-variant: inherit;
  letter-spacing: inherit;
  font-weight: 600;
  line-height: $button-height;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
  margin-bottom: 10px;
  font-family: $ff;
  transition: all 0.4s $cb-fast;
  &:focus {
    outline: 0;
  }
  &::-moz-focus-inner {
      border: 0;
  }
  &[disabled] {
      opacity: 0.5;
      cursor: default;
      pointer-events: none;
  }
}

%clear {
  @include font-size(13px);
  background: none;
  min-width: auto;
  min-height: auto;
  width: auto;
  padding: 0;
  line-height: 1.3em;
  text-decoration: none;
  border: 0;
  &:hover,
  &:focus {
      text-decoration: underline;
      background: none;
  }
}

// tooltip
%tooltip {
  box-shadow: $shadow-100;
  padding: 0.2em;
  color: $font-dark-color;
  background: $lighter-color;
  font-family: $ff;
  @include font-size(13px);
  border: 1px solid $line-light-color;
  position: absolute;
  margin: auto;
  transform: translateX(50%);
  max-width: 266px;
  overflow-wrap: break-word;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
}
%tooltip--top {
  &:after {
    top: -35px;
    right: 50%;
    left: auto;
  }
}
%tooltip--left {
  &:after {
    right: calc(100% + 5px);
    top: auto;
    transform: none !important;
  }
}
%activetooltip {
  &:after {
    content: attr(data-title);
    @extend %tooltip;
  }  
}
%hastooltip {
  &:after {
    content: attr(data-title);
    @extend %tooltip;
    opacity: 0;
    z-index: -1;
    width: 0;
    height: 0;
    overflow: hidden;
  }
  &:before {
    content: "";
    position: absolute;
    display: block;
    width: 0; 
    height: 0; 
    opacity: 0;
  }
  &:hover{
    &:after {
      width: auto;
      height: auto;
      opacity: 1;
      transition: opacity 0.2s ease;
      z-index: 2;
    }
    &:before {
      opacity: 1;
      transition: opacity 0.2s ease;
    }
  }
}