@import "../modules/mixins";
@import "../modules/variables";

button,
input[type="button"],
input[type="reset"],
input[type="submit"],
[role="button"] {
  cursor: pointer;
  -webkit-appearance: button;
}


.ut-button {
  @include background-clip(padding-box);
  @include background-origin(padding-box);
  display: inline-block;

  overflow: hidden;
  padding-right: 0.75em;
  padding-left: 0.75em;

  height: 2em;
  border-width: 0;
  background-repeat: no-repeat;

  color: rgb(96,96,96);
  vertical-align: baseline;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 2em;

  cursor: pointer;

  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-touch-callout: none;
  -webkit-user-select: none;

  &:hover,
  &:focus,
  &:active {
    color: $default-text-color;
    cursor: pointer;
    text-decoration: none;
  }

  &:focus {
    outline: none;
  }

  &.loading,
  &.disabled {
    opacity: 0.6;
  }

  & input {
    display: inline;
    margin-right: 0.5em;
    margin-left: 0.5em;
    height: auto;
    vertical-align: baseline;
  }
}

.btn {
  display: inline-block;
}

.ut-button-group {
  white-space: nowrap;

  .ut-button {
    border-radius: 0;

    ~ .ut-button {
      border-left-width: 0;
    }

    &:first-of-type,
    &:first-child {
      border-top-left-radius: 3px;
      border-bottom-left-radius: 3px;
    }

    &:last-of-type,
    &:last-child {
      border-top-right-radius: 3px;
      border-bottom-right-radius: 3px;
    }
  }
}

.ut-dropdown-button {
  padding-top: 15px;
  width: 15px;
  height: 0;
}

.ut-gold-button {
  color: $tip-text;

  background: $tip-border;
  border: 1px solid $tip-icon;
  outline: none;

  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, -1px -1px 0 rgba(255,255,255,.05) inset;

  &:hover,
  &:focus {
    color: $tip-text;
    @include linear-gradient(lighten($tip-border,10%), $tip-border);
    text-decoration: none;
  }

  &:active,
  &.active {
    color: $tip-text;
    background: darken($tip-border,10%);
    box-shadow: 0 0 1px rgba(0,0,0,.15) inset;
  }
}

.ut-dark-button {
  @include linear-gradient(rgb(77,77,77), rgb(51,51,51));

  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, -1px -1px 0 rgba(255,255,255,.05) inset;
  outline: none;
  border: 1px solid rgb(25,25,25);
  background-position: 0 0;
  color: rgb(230,230,230);
  text-shadow: 0 1px 0 black;

  &:hover,
  &:focus {
    @include linear-gradient(rgb(102,102,102), rgb(77,77,77));
    color: white;
    text-decoration: none;
  }

  &:active,
  &.active {
    @include linear-gradient(rgb(26,26,26), rgb(51,51,51));
    box-shadow: 0 0 1px rgba(0,0,0,.15) inset;
    color: white;
    text-shadow: none;
  }
}

.ut-default-button {

  @include linear-gradient(rgb(251,251,251), rgb(221,221,221));

  box-shadow: 0 1px 0 rgb(255,255,255) inset, 0 1px 3px rgba(0,0,0,.12);
  outline: none;
  border: 1px solid rgb(213,213,213);
  border-bottom-color: rgb(190,190,190);
  background-position: 0 0;
  color: rgb(128,128,128);
  text-shadow: 0 1px 0 rgba(255,255,255,.5);

  &:hover,
  &:focus {
    background-color: rgb(251,251,251);
    color: rgb(102,102,102);
    text-decoration: none;
  }

  &:active,
  &.active,
  input:checked + & {
    @include linear-gradient(rgb(220,220,220), rgb(220,220,220));
    box-shadow: 0 0 1px rgba(0,0,0,.25) inset, 0 1px 1px rgba(255,255,255,.25);
    border-color: rgb(204,204,204);
    color: rgb(102,102,102);
    text-shadow: 0 1px 0 rgba(255,255,255,.5);
  }

  .ut-button-group & {
    box-shadow: 0 1px 0 rgb(255,255,255) inset;
  }
}

.ut-success-button {

  @include linear-gradient(rgb(142,221,79), rgb(108,188,67));

  box-shadow: 1px 1px 0 rgba(255,255,255,.25) inset, -1px -1px 0 rgba(255,255,255,.1) inset;
  outline: none;
  border: 1px solid rgb(90,185,0);
  background-position: 0 0;
  color: white;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);

  &:hover,
  &:focus {
    @include linear-gradient(rgb(174,231,123), rgb(108,188,67));
    color: white;
    text-decoration: none;
  }

  &:active,
  &.active {
    @include linear-gradient(rgb(108,188,67), rgb(142,221,79));
    box-shadow: 0 0 1px rgba(0,0,0,.15) inset;
    color: white;
  }
}

.ut-primary-button {

  @include linear-gradient($primary-button-background-highlight, $primary-button-background, $primary-button-background-highlight);

  box-shadow: 0 1px 0 rgba(255,255,255,.3) inset;
  outline: none;
  border: 1px solid $primary-button-border;
  background-position: 0 0;
  color: $primary-button-color;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);

  &:hover,
  &:focus {
    @include linear-gradient(lighten($primary-button-background-highlight,15%), $primary-button-background, lighten($primary-button-background-highlight,15%));
    color: $primary-button-color;
    text-decoration: none;
  }

  &:active,
  &.active {
    box-shadow: 0 0 1px rgba(0,0,0,.25) inset;
    background: $primary-button-background;
    color: darken($primary-button-border, 20%);
    text-shadow: 0 1px 0 rgba(255,255,255,.25);
  }
}

.ut-red-button {
  color: $bloody-red;

  &:hover,
  &:focus {
    border-color: $bloody-red;
    background: rgba(193,39,45,.1);
    color: $bloody-red;
    text-decoration: none;
    text-shadow: none;
  }

  &:focus {
    box-shadow: 0 6px $electric-red;
  }
}


/* Sizes of the button */
.ut-giant-button {
  padding-right: 18px;
  padding-left: 18px;
  height: 2.9em;
  border-radius: 4px;
  font-weight: bold;
  font-size: 2.1em;
  line-height: 2.8em;
}

.ut-huge-button {
  padding-right: 14px;
  padding-left: 14px;
  height: 2.4em;
  border-radius: 3px;
  font-weight: bold;
  font-size: 1.8em;
  line-height: 2.2em;
}

.ut-large-button {
  position: relative;
  padding-right: 12px;
  padding-left: 12px;
  height: 2.3em;
  border-radius: 3px;
  font-weight: bold;
  font-size: 1.6em;
  line-height: 2.3em;
}

.ut-medium-button {
  height: 2.4em;
  border-radius: 3px;
  font-weight: bold;
  font-size: 1.2em;
  line-height: 2.2em;
}

.ut-small-button {
  padding-right: 6px;
  padding-left: 6px;
  height: 2.2em;
  border-radius: 2px;
  font-weight: bold;
  font-size: 1.1em;
  line-height: 2em;
}

.ut-full-width {
  display: block;
  width: 100%;
}

.ut-action-button {
  z-index: 20;
  margin: 0;
  background-color: rgba(0, 0, 0, 0.65);
  color: white;
  
  &:hover,
  &:active,
  &:focus,
  &.active {
    color: white;
    background-color: rgb(0, 0, 0);
  }
}

.ut-action-button-wrap {
  .ut-button {
    margin-right: 0.3em;
    
    &:last-child {
      margin-right: 0;
    }
  }
}
.ut-item-button {
  @include linear-gradient(rgb(50,50,50),rgb(30,30,30));
  position: absolute;
  z-index: 10000;
  display: block;
  padding: 0;
  
  width: 3.6em;
  height: 3.6em;
  border-radius: 50%;
  box-shadow: 0 .4em .8em rgba(0, 0, 0, 0.8);

  color: rgb(240,240,240);
  font-size: 1em;
  line-height: 2em;
  
  &:hover,
  &:active,
  &.active,
  &:focus {
    @include linear-gradient(rgb(30,30,30),rgb(50,50,50));
    color: white;
  }

  &::before {
    font-size: 2em;
    vertical-align:middle;
    position: absolute;
    top: 50%;
    width:100%;
    margin-top: -0.5em;
    left: 0;
  }
  // top / right
  &.tr {
    top: -2.1em;
    right: -2.1em;
  }

  // top / left
   &.tl {
    top: -2.1em;
    left: -2.1em;
    
    &:nth-child(2) {
      top: -2.1em;
      left: 2.1em;
    }
  }

  // bottom / right
   &.br {
    bottom: -2.1em;
    right: -2.1em;
  }

  // bottom / left
   &.bl {
    bottom: -2.1em;
    left: -2.1em;
  }
}

@media screen and (max-width: 320px) {
  .ut-item-button {
    border: 1px solid white;
    width: 4.6em;
    height: 4.6em;
    
    // top / right
    &.tr {
      top: -3.1em;
      right: -3.1em;
    }

    // top / left
     &.tl {
      top: -3.1em;
      left: -3.1em;
      
      &:nth-child(2) {
        top: -3.1em;
        left: 2.1em;
      }
    }

    // bottom / right
     &.br {
      bottom: -3.1em;
      right: -3.1em;
    }

    // bottom / left
     &.bl {
      bottom: -3.1em;
      left: -3.1em;
    }
  }
}

.ut-panel-button {
  position: absolute;
  box-shadow: 0 0 0 1px #b4b4b4 inset;
  border-radius: 50%;
  text-align: center;
  vertical-align: middle;
  @include linear-gradient(rgb(254,254,254),rgb(223,223,223));
  text-shadow: 0 1px 1px rgba(255,255,255,0.5);
  
  height: 2.3em;
  width: 2.3em;
  font-weight: bold;
  font-size: 1.7em;
  line-height: 2.5em;
  
  &:hover,
  &:active,
  &:focus {
      @include linear-gradient(rgb(223,223,223),rgb(254,254,254));
  }
  &.yep {
    color: #90c541;
  } 

  &.nope {
    color: #be1d25;
  } 
}

.ut-edit-button {
  @extend .ut-action-button;
  @extend .ut-large-button;
  @extend .ut-button;
}

.ut-media-placeholder {
  background-color: rgb(50, 50, 50);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3) inset;
}

.ut-media-button {
  width: 102px;
  height: 66px;

  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -33px;
  margin-left: -51px;

  padding: 10px;

  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 5px;
  font-size: 12px;
  font-weight: bold;
  color: rgb(240, 240, 240);

  &:hover {
    color: rgb(240, 240, 240);
    background-color: rgb(40, 40, 40);
    text-shadow:    0 1px 1px rgba(0, 0, 0, 0.5);
  }

  &:focus,
  &:active,
  &.active {
    background-color: rgb(40, 40, 40);
    color: rgb(20, 20, 20);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  &::before {
    display: block;
    font-size: 24px;
  }

  &.small {
    width: 70px;
    height: 44px;
  
    margin-top: -22px;
    margin-left: -35px;

    padding: 4px;
    font-size: 10px;

    &::before {
      font-size: 18px;
    }
  }
}

.ut-item {
  position: absolute;
  border: .2em solid transparent;
  box-shadow: none;
  @include box-sizing(content-box);
}