@use "../util" as *;
@use "../globals" as *;

$trans-time: 300ms;
$width: 100%;

form{
    display: block;
    //padding-top: 1rem;
}

.form-group{
    position: relative;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    //flex: 1 0 300px;//TEMP
  }
  
  textarea {
    resize: none;
  }
  

 .form-group input:not([type="radio"], [type="radio"]),
  textarea,
  select {
    background: none;
    color: var(--text-core);
    font-weight: $font-weight-600;
    font-size: $base-font-size;
    padding: 10px 24px 10px 5px;
    display: block;
    width: 100%;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border-core);
        &:focus { 
            outline: none;
        }
        &:focus ~ label.label-animated,
        &:valid ~ label.label-animated,
        &:disabled ~ label.label-animated {
            top: -12px;
            font-size: $font-size-sm;
            color: var(--bg-core-primary-darken);
        }
        &:focus ~ .bar:before {
            width: $width;
        }
  }
  
/*FOR CUSTOM SELECT*/
  .form-group>button {
    background: none;
    color: var(--text-core);
    font-weight: $font-weight-600;
    font-size: $base-font-size;
    padding: 10px 24px 10px 5px;
    display: block;
    width: 100%;
    min-height: 2.8rem;
    text-align: left;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--border-core);
        &:focus { 
            outline: none;
        }
        &:focus ~ label.label-animated,
        &:has(>div) ~ label.label-animated  {
            top: -12px;
            font-size: $font-size-sm;
            color: var(--bg-core-primary-darken);
        }
        &:focus ~ .bar:before {
            width: $width;
        }
  }
  
  input[type="password"] {
    letter-spacing: 0.15rem;
  }
  
  label.label-animated {
    color: $text-core-lc;
    font-size: $base-font-size;
    font-weight: $font-weight-400;
    position: absolute;
    pointer-events: none;
    left: 5px;
    top: 10px;
    transition: $trans-time ease all;
  }
  
  .bar {
    position: relative;
    display: block;
    width: $width;
        &:before {
        content: '';
        height: 2px;
        width: 0;
        bottom: 0px;
        position: absolute;
        background: var(--bg-core-primary-darken);
        transition: $trans-time ease all;
        left: 0%;
        }
  }

.input-helper-text{
    position: absolute;
    bottom: -40px;
    line-height: 30px;
    font-size: 12px;
    color: $text-core-lc;
    padding: 5px 10px 10px 5px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
}

/*ERROR*/
.error input:focus ~ label.label-animated,
.error input:valid ~ label.label-animated,
.error textarea:focus ~ label.label-animated,
.error textarea:valid ~ label.label-animated,
.error select:focus ~ label.label-animated,
.error select:valid ~ label.label-animated{
    color: $danger;
}
  
.error .bar:before {
    content: '';
    background:$danger;
}

.input-error-text{
    display: none;
}
.error .input-error-text{
    position: absolute;
    bottom: -40px;
    line-height: 30px;
    display: inline-block;
    font-size: 12px;
    color: $danger;
    padding: 5px 10px 10px 5px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
}

.error .input-helper-text{
    display: none;
}

.error input{
    padding-right:3rem;
}

.error .input-glyph.error {
    display: flex;
    color: $danger;
    //font-size: 1.25rem;
}

.input-glyph.error {
   display:none;
}

/*GLYPH*/
.input-glyph-wraper {
    position: absolute;
    display: flex;
    height: auto;
    right: 0;
    top: .8rem;
}

.input-glyph {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: $base-margin;

}


.input-glyph i,
.input-glyph svg {
    font-size: 1.25rem;
    z-index: 1;
}

/*GLYPH BUTTON*/
.input-glyph.button {
    cursor: pointer;
}

.input-glyph.button:before {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: transparent;
    cursor: pointer;
    scale: .75;
    transition: scale 0.35s cubic-bezier(0.6,-1.25,0.6,2.25);
}

.input-glyph.button:hover:before {
    background: var(--bg-core-primary-lighten);
    scale: 1;
    opacity: .5;
}

/*GLYPH RESET*/
.input-glyph.button.reset {
    display:none
}



/*FORM-ALT*/

.form-group-alt {
    position: relative; 
    label{
        font-size: .85rem;
        padding-left: 0.85rem;
        margin-bottom: 0.75rem;
        display: inline-block;
        color: var(--bg-core-primary-darken);
    }
     .input-group-content {   
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.15rem;
        color: var(--text-core);
        border-radius: $border-radius-pill;
        background-color: var(--bg-core-primary-light);
        border: 1px solid var(--bg-core-primary-lighten);
        position: relative;
        transition: $transition;

        .input-area{
            flex: 1;
        }
            /*focus within*/
            &:focus-within{
            background-color: var(--bg-core-primary-lighten);
            background-color: #fff;
        }
      }
    .input-helper-text{
        position: absolute;
        bottom: -10px;
        line-height: 30px;
        font-size: 12px;
        color: $text-core-lc;
        padding: 5px 10px 10px 5px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        overflow: hidden;
    }
}

.form-group-alt.error {
     
    label{
        color: $danger
    }
     .input-group-content {   
        color: var(--text-core);
        background-color: var(--bg-core-primary-light);
        border: 1px solid $danger;
      }
      input{
        padding-right:.15rem;
    }
}  
  

  