/*doc
---
title: Buttons
name: button
category: Layout - Button
---

Button styles can be applied to any element. Typically you'll want to
use either a `<button>` or an `<a>` element:

```html_example
<button>Button</button>
<button class="confirm">Confirm</button>
<button class="cancel">Cancel</button>
<button class="back-btn">Back</button>
<button  disabled="disabled">Disabled</button>
<button class="arrow-button">Accept</button>
```

*/



/*doc
---
title: Buttons With Icon
name: button_icon
category: Layout - Button
---


```html_example
 <button  type="button" class="icon-button exchange-btn">
     <i class="fa fa-exchange"></i>
 </button>

 <button type="button" class="small-btn row-remover">
     <span class="fa fa-remove"></span>
 </button>

 <span class="favourite-concept-set">
     <label class="add-fav">
       <input type="checkbox">
       <i class="fa fa-thumb-tack"></i></label>
 </span>

<button class="add-more-concept-set add-more-btn btn-small">
    <i class="fa fa-plus"></i>
    ADD MORE
</button>

 <button type="button" class="comment-toggle">
     <i class="fa fa-file-o">
       <i class="fa fa-plus-circle"></i>
       <i class="fa fa-minus-circle"></i>
    </i>
</button>

<button>
     <i class="fa fa-edit"></i>
 </button>
```

*/



/*doc
---
title: Button Groups
name: button_groups
category: Layout - Button
---


```html_example
<div class="multi-select-button-group">
  <button type="button" class="grid-row-element">
  <i class="fa fa-ok"></i>
      Multi
  </button>
  <button type="button" class="grid-row-element active">
      <i class="fa fa-ok"></i>
      Select
  </button>
  <button type="button" class="grid-row-element">
    <i class="fa fa-ok"></i>
     Button
  </button>
  <button type="button" class="grid-row-element">
    <i class="fa fa-ok"></i>
     Group
  </button>
</div>
```

*/



/*doc
---
title: Button Groups with same width
name: button_group_same_width
category: Layout - Button
---


```html_example
<div class="field-value-buttonSelectType">
  <div class="multi-select-button-group">
    <button type="button" class="grid-row-element">
    <i class="fa fa-ok"></i>
        Multi
    </button>
    <button type="button" class="grid-row-element active">
        <i class="fa fa-ok"></i>
        Select
    </button>
    <button type="button" class="grid-row-element">
      <i class="fa fa-ok"></i>
       Button
    </button>
    <button type="button" class="grid-row-element">
      <i class="fa fa-ok"></i>
       Group
    </button>
  </div>
</div>
```


*/




@mixin button($tcolor: #FFF, $bcolor: #DDD, $font: $text) {
  border-radius: 3px;
  background: linear-gradient(to bottom, $tcolor, $bcolor);
  background-color: $bcolor;
  border: $bcolor 1px solid;
  //padding: 8px 20px;
  padding: 6px 20px 7px;
  display: inline-block;
  line-height: 1.2em;
  color: $font;
  cursor: pointer;
  min-width: 0;
  max-width: 300px;
  text-decoration: none;

  &:hover {
    background: lighten($bcolor, 2%);
    border-color: darken($bcolor, 5%);
      @media screen and (max-width: 1024px) {
        background: linear-gradient(to bottom, $tcolor, $bcolor);
        border: $bcolor 1px solid;
      }
  }

  &.active {
    background: darken($bcolor, 2%);
    border-color: darken($bcolor, 5%);
  }

  i {
    font-size: 1.2em;
    margin: 0;
    padding: 0;
    line-height: .5em;
  }

  &.big, &.medium {
    i {
      display: block;
      font-size: 50px;
      margin: 0 auto;
      padding: 10px;
    }
  }

  &.medium {
    i {
      font-size: 34px;
    }
  }

  &.disabled, &:disabled {
    background: $lightestGray;
    border: $lightGray 1px solid;
    color: $darkGray;
    cursor: default;
  }

  &.print {
    padding: 10px;

    i {
      font-size: 1.5em;
    }
  }

  &.app {
    padding: 20px 10px;
    width: 150px;
    min-height: 90px;
    vertical-align: top;
    line-height: 1.3em;
    margin: 10px;
    text-align: center;
  }

  &.arrow {
    box-sizing: border-box;
    position: relative;
    padding: 9px 5px;
    margin-left: -10px;
    background: darken($success, 10%);
    color: white;
    border-color: $primarySectionGridBorder;
    height: 68px;

    span {
      display: block;
      line-height: 1em;
    }

    i {
      line-height: 1em;
      font-size: 2em;
    }

    .arrow-button {
      width: 0;
      height: 0;
      top: 0;
      right: -17px;
      border-bottom: 34px solid transparent;
      border-top: 33px solid transparent;
      border-left: 18px solid darken($success, 10%);
      position: absolute;
    }

    .arrow-border-button {
      width: 0;
      height: 0;
      top: 0;
      right: -18px;
      border-bottom: 34px solid transparent;
      border-top: 33px solid transparent;
      border-left: 18px solid $primarySectionGridBorder;
      position: absolute;
    }

    &.disabled {
      background: $lightestGray;
      border: $lightGray 1px solid;
      color: $lightGray;
      cursor: default;

      .arrow-button {
        border-left: 18px solid $lightestGray;
      }

      .arrow-border-button {
        border-left: 18px solid $lightGray;
      }
    }
  }
}

.button, button, input[type="submit"], input[type="button"],input[type="reset"], input[type="submit"], a.button {
  @include button;

  &.task {
    @include button(lighten($text,20%), lighten($text, 20%), white);

    padding: 5px 6px;
    min-width: 221px;
    font-size: 0.9em;

    &:visited {
      color: white;
    }

    i {
      font-size: 1em;
      margin: 0px 2px;
    }
  }

  &.confirm {
    @include button($success, darken($success, 8%), white);
    max-width: 250px;
    min-width: 0;
    margin-right: 10px;
  }

  &.cancel {
    @include button($error, darken($error, 8%), white);
    max-width: 250px;
    min-width: 0;
    margin-right: 10px;
  }

  &.no-color {
    @include button();
  }
}


/* button states - lvha */
button:hover { opacity: 0.8; }
button:focus, a:focus, .btn:focus {
  outline: 2px solid $clinicalFormFocus;
}
button[disabled] { opacity: 0.4; cursor: not-allowed; }


/*backButton:*/
a.back-btn, button.back-btn {
    position: relative;
    display: inline-block;
    text-decoration: none;
    z-index: 1;
    margin: 6px 6px 0 0px;
    color: $white;
    border-left: 0;
    float: left;
    font-size: 16px;
    border-radius: 3px;
    &:hover {
        text-decoration: none;
        color: $white;
        cursor: pointer;
        opacity: 0.8;
    }

    &.dashboard-link img {
        height: 26px;
        width: 26px;
        border-radius: 100%;
        float: left;
        margin-right: 5px;
    }
    .patient-info {
          float: left;
          font-size: 12px;
          color: $white;
            line-height: 1.1;
          .patient-id {
            display: block;
            color: $lightGray;
            font-size: 11px;
          }
          .patient-name {
            width: 100px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: block;
            @media screen and (max-width: 1024px) {
              width: 75px;
            }
          }
      }
}

ul li a.back-btn, ul li a.back-btn:hover, button.back-btn, a.back-btn {
    padding: 4px 10px 5px 10px;
    border: 1px solid darken($bahmniSecondaryColor, 15%);
    background: linear-gradient(to bottom, $bahmniSecondaryColor, darken($bahmniSecondaryColor, 10%));

    i {
      font-size: 30px;
      line-height: 1;
      margin: 0;
      padding: 0;
      @media screen and(max-width:470px){
        font-size: 22px;
      }
    }
    &.dashboard-link {
      padding:6px 8px 5px;
    }
    &.back-icon {
      padding-left: 30px;
        &:before {
          font-family: FontAwesome;
          content: "\F0A8";
          position: absolute;
          left: 5px;
          top: 11px;
          font-size: 20px;
          font-weight: normal;
          &:hover {
              cursor: pointer;
          }
      }
    }
  @media screen and(max-width:470px){
    padding: 4px 5px 5px;
  }
}
button.back-btn {
    box-shadow: none;
    line-height: 1.1em;
}
.back-btn-link {
    @include clearfix();
    padding: 5px 8px 5px;
    border: 1px solid darken($bahmniSecondaryColor, 15%);
    background: linear-gradient(to bottom, $bahmniSecondaryColor, darken($bahmniSecondaryColor, 10%));
    margin-top: 6px;
    float: left;
    display: inline-block;
    border-radius: 2px;
    &:hover {
        text-decoration: none;
        color: $white;
        cursor: pointer;
        opacity: 0.8;
    }
    img {
        height: 26px;
        width: 26px;
        border-radius: 100%;
        float: left;
        margin-right: 5px;

    }
     .patient-info {
          float: left;
          font-size: 12px;
          color: $white;
            line-height: 1.1;
          .patient-id {
            display: block;
            color: $lightGray;
            font-size: 11px;
          }
          .patient-name {
            width: 100px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: inline-block;
            height:15px;
            @media screen and (max-width: 1024px) {
              width: 75px;
            }
          }
      }
}
/* multi select */
.multi-select-button-group {
  div.btn-tooltip-wrapper{
    position: relative;
  }
  button {
    float: left;
    margin: 0 2px 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    height: 32px !important;
    &.grid-row-element{
      font-size: 12px;
      padding-left: 15px;
      padding-right: 15px;
      .fa-ok{
        display: none;
        padding-top: 0;
        padding-bottom: 0;
        font-size: 14px;
        line-height: inherit;
      }
      &.active{
        color: $bahmniTertiaryColor;
        padding-left: 3px;
        .fa-ok {
          display: inline-block;
        }
      }
    }
  }
  button:focus, a:focus, .btn:focus {
    border: 2px solid $clinicalFormFocus;
    outline:0;
  }
}
.illegalValue .multi-select-button-group { width: auto; }

.secondary-button,
.secondary-button:hover,
input[type="submit"].secondary-button,
input[type="submit"].secondary-button:hover  {
    background: linear-gradient(to bottom, $bahmniSecondaryColor, darken($bahmniSecondaryColor, 10%));
    color: $white;
    border:1px solid darken($bahmniSecondaryColor, 15%);
}

.icon-button{
  padding: 6px 8px 7px;
}

/* icon button */
.comment-toggle {
  padding: 5px;
  @media (max-width: 1024px) {
    margin: 5px 0 0 10px;
  }
  .fa-file-text-o {
    display: none;
  }
  &.has-notes {
    .fa-file-text-o {
      display: block;
    }
    .fa-file-o {
      display: none;
    }
  }
  &.active {
    .fa-file-o {
      .fa-plus-circle {
        display: none;
      }
      .fa-minus-circle {
        display: block;
      }
    }
  }
  .fa-file-o {
    position: relative;
    font-size: 16px;
    color: $mediumGray;
    .fa-minus-circle {
      display: none;
    }
    .fa-plus-circle, .fa-ok-sign, .fa-plus, .fa-minus-circle {
      position: absolute;
      right: 2px;
      bottom: 2px;
      font-size: 10px;

      color: green;
      background: $white;
      border-radius: 8px;
      padding: 0;
    }

  }
  .fa-file-alt {
    font-size: 21px;
    color: orange;
  }
}

/* Add Favourite button */

.add-fav {
  cursor: pointer;
  color:#fff;
  margin-left: 12px;
  float: left;
  @media screen and (max-width: 1024px){
    margin-left: 21px;
  }
  .fa-thumb-tack{
    font-size: 18px;
    padding: 0;
    width:auto;
  }

  .fa-star-empty {
    font-size: 20px;
    color: $mediumGray;
    position: relative;
    transition: all .5s ease-in-out;
    padding: 0;
  }

  input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    & + .fa-thumb-tack {
      //color: $mediumGray;
      cursor: pointer;
      &:hover{
        opacity:0.5;
      }
    }
    &:checked + .fa-thumb-tack {
      color: orange;
      display: block;
      -webkit-transform: rotate(45deg);
      -moz-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
      -o-transform: rotate(45deg);
      transform: rotate(45deg);
    }
  }
}

/* split button - seperate scss file */


.refill-btn, .stop-drug-btn { padding: 10px!important; font-family: $primaryBoldFont; color: $mediumGray; }
.refill-btn .fa-play { font-size: 1em!important; }

.btn-small {
    font-size: 14px; padding: 5px;
}

.grouped-buttons {
   overflow: hidden;
   display: inline-block;
  .btn--left, .btn--right {
    float: left;
  }
}

button.toggle{
  .fa-angle-up{
    display: none;
  }
  &.active{
    background: none !important;
    .fa-angle-up{
      display: block;
    }
    .fa-angle-down{
      display: none;
    }
  }
}

.toggle-btn{
  button.toggle{
    .fa-angle-up{
      display: none;
    }
  }
  &.active{
    button.toggle{
      background: none !important;
      .fa-angle-up{
        display: block;
      }
      .fa-angle-down{
        display: none;
      }
    }
  }
}


.toggle-buttons{
  .show-after-active{
    display: none;
  }
  &.active {
    .show-before-active {
      display: none;
    }
    .show-after-active {
      display: inline-block;
    }
  }
}
button.btn--add{
  background: linear-gradient(to bottom, $bahmniSecondaryColor, darken($bahmniSecondaryColor, 10%));
  background-color: $bahmniSecondaryColor;
  border: darken($bahmniSecondaryColor, 15%) 1px solid;
  color: $white;
  font-size: 13px !important;
  padding: 7px !important;
  margin-left:20px;
  .fa-plus{
    color: $white;
    padding: 0;
    font-size: 16px;
    display: inline-block;
    padding-right: 5px;
  }
}
