/*! Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */

.box-shadow(@x: 0.2em; @y: 0.2em; @blur: 0.2em; @spread: 0; @color: rgba(83, 83, 83, 0.25)) {
  -webkit-box-shadow: @arguments;
     -moz-box-shadow: @arguments;
          box-shadow: @arguments;
}

.button(@background-color: @body-bg-color, @color: @icinga-blue) {
  .rounded-corners(3px);

  background-color: @background-color;
  border: 2px solid @color;
  color: @color;
  cursor: pointer;
  outline: none;
  padding: @vertical-padding @horizontal-padding;

  // Transition mixin does not work w/ comma-separated transistions
  -webkit-transition: background 0.3s ease, color 0.3s ease;
     -moz-transition: background 0.3s ease, color 0.3s ease;
       -o-transition: background 0.3s ease, color 0.3s ease;
          transition: background 0.3s ease, color 0.3s ease;

  &:focus,
  &:hover {
    background-color: @color;
    color: @background-color;
  }

  &:hover {
    text-decoration: none;
  }
}

.clearfix {
  &:after {
    content: "";
    clear: both;
    display: table;
  }
}

.opacity(@opacity: 0.6) {
  -webkit-opacity: @opacity;
     -moz-opacity: @opacity;
          opacity: @opacity;
}

.transform(@transform) {
  -webkit-transform: @transform;
     -moz-transform: @transform;
      -ms-transform: @transform;
       -o-transform: @transform;
          transform: @transform;
}

.rounded-corners(@border-radius: 0.4em) {
  border-radius: @border-radius;

  -webkit-background-clip: padding-box;
     -moz-background-clip: padding;
          background-clip: padding-box;
}

.transition (@transition) {
  -webkit-transition: @transition;
     -moz-transition: @transition;
       -o-transition: @transition;
          transition: @transition;
}

// Fadein animation

/* Chrome, WebKit */
@-webkit-keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* FF < 16 */
@-moz-keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* IE */
@-ms-keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Opera < 12.1 */
@-o-keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fadein() {
  opacity: 0;

  -webkit-animation: fadein 2s ease-in; /* Chrome, WebKit */
     -moz-animation: fadein 2s ease-in; /* FF < 16 */
       -o-animation: fadein 2s ease-in; /* Opera < 12.1 */
          animation: fadein 2s ease-in;

  // Make sure that after animation is done we remain at the last keyframe value (opacity: 1)
  -webkit-animation-fill-mode: forwards;
     -moz-animation-fill-mode: forwards;
       -o-animation-fill-mode: forwards;
          animation-fill-mode: forwards;
}

// Color mixins

.bg-color-ok,
.bg-color-up {
  background-color: @color-ok;
}

.bg-color-warning {
  background-color: @color-warning;

  &.handled {
    background-color: @color-warning-handled;
  }
}

.bg-color-critical,
.bg-color-down {
  background-color: @color-critical;

  &.handled {
    background-color: @color-critical-handled;
  }
}

.bg-color-unreachable {
  background-color: @color-unreachable;

  &.handled {
    background-color: @color-unreachable-handled;
  }
}

.bg-color-unknown {
  background-color: @color-unknown;

  &.handled {
    background-color: @color-unknown-handled;
  }
}

.bg-color-pending {
  background-color: @color-pending;
}

.fg-color-ok,
.fg-color-up {
  color: @color-ok;
}

.fg-color-warning {
  color: @color-warning;

  &.handled {
    color: @color-warning-handled;
  }
}

.fg-color-critical,
.fg-color-down {
  color: @color-critical;

  &.handled {
    color: @color-critical-handled;
  }
}

.fg-color-unreachable {
  color: @color-unreachable;

  &.handled {
    color: @color-unreachable-handled;
  }
}

.fg-color-unknown {
  color: @color-unknown;

  &.handled {
    color: @color-unknown-handled;
  }
}

.fg-color-pending {
  color: @color-pending;
}
