/* Theme specific
----------------------------------------------- */

@mixin flat($type:"child") {
  @if $type == "child" {
    .theme--flat & {
      @content;
    }
  } @else {
    .theme--flat {
      @content;
    }
  }
}

@mixin material($type:"child") {
  @if $type == "child" {
    .theme--material & {
      @content;
    }
  } @else {
    .theme--material {
      @content;
    }
  }
}

@mixin header-overlay($type:"child") {
  @if $type == "child" {
    .layout--overlay & {
      @content;
    }
  } @else {
    .layout--overlay {
      @content;
    }
  }
}

@mixin header-left($type:"child") {
  @if $type == "child" {
    .layout--left & {
      @content;
    }
  } @else {
    .layout--left {
      @content;
    }
  }
}

/* Forms
----------------------------------------------- */

@mixin form-inputs($class: '') {
  input:not([type='radio']):not([type='checkbox']):not([type='submit']):not([type='button']):not([type='image']):not([type='file']),
  textarea,
  #{$class} {
    @content;
  }
}

@mixin placeholder {
  &::-webkit-input-placeholder {
    @content;
  }

  &:-moz-placeholder { /* Firefox 18- */
    @content;
  }

  &::-moz-placeholder { /* Firefox 19+ */
    @content;
  }

  &:-ms-input-placeholder {
    @content;
  }
}

/* Helpers
----------------------------------------------- */

@mixin clearfix() {
  &:before,
  &:after {
    content: " "; /* 1 */
    display: table; /* 2 */
  }
  &:after {
    clear: both;
  }
}

@mixin border-top-radius($radius) {
  border-top-left-radius: $radius;
  border-top-right-radius: $radius;
}

@mixin border-bottom-radius($radius) {
  border-bottom-left-radius: $radius;
  border-bottom-right-radius: $radius;
}

/* Grid System
----------------------------------------------- */

// Centered container element
@mixin container-fixed() {
  margin-right: auto;
  margin-left: auto;
  padding-left: ($grid-gutter-width / 2);
  padding-right: ($grid-gutter-width / 2);
  @include clearfix();
}

// Creates a wrapper for a series of columns
@mixin make-row($gutter: $grid-gutter-width) {
  margin-left: ($gutter / -2);
  margin-right: ($gutter / -2);
  @include clearfix();
}

/* Responsive utilities
----------------------------------------------- */

@mixin mobile {
  @media (min-width: #{$screen-xs}) {
    @content;
  }
}

@mixin tablet {
  @media (min-width: #{$screen-sm}) {
    @content;
  }
}

@mixin desktop {
  @media (min-width: #{$screen-md}) {
    @content;
  }
}

@mixin desktop-lg {
  @media (min-width: #{$screen-lg}) {
    @content;
  }
}

@mixin desktop-xl {
  @media (min-width: #{$screen-xl}) {
    @content;
  }
}

@mixin mobile-max {
  @media (max-width: #{$screen-xs-max}) {
    @content;
  }
}

@mixin tablet-max {
  @media (max-width: #{$screen-sm-max}) {
    @content;
  }
}

@mixin desktop-max {
  @media (max-width: #{$screen-md-max}) {
    @content;
  }
}

@mixin desktop-lg-max {
  @media (max-width: #{$screen-lg-max}) {
    @content;
  }
}

@mixin responsive-visibility() {
  display: block !important;
  tr & {
    display: table-row !important;
  }
  th &,
  td & {
    display: table-cell !important;
  }
}

@mixin responsive-invisibility() {
  display: none !important;
  tr & {
    display: none !important;
  }
  th &,
  td & {
    display: none !important;
  }
}

@mixin responsive-text($map) {
  font-size: map-get($map, min);

  @media (min-width: #{$screen-sm}) {
    font-size: map-get($map, mid);
  }

  @media (min-width: #{$screen-lg}) {
    font-size: map-get($map, max);
  }
}
