// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE in the project root for license information.

//
// Office UI Fabric
// --------------------------------------------------
// Callout styles


.ms-Callout {
  z-index: $ms-zIndex-Callout;
  margin: 16px auto;
  position: relative;
  width: 288px;
}

// Mixin for arrow size and color
@mixin arrowBorders($ms-color-top, $ms-color-right, $ms-color-bottom, $ms-color-left) {
  border-top: 10px solid $ms-color-top;
  border-right: 10px solid $ms-color-right;
  border-bottom: 10px solid $ms-color-bottom;
  border-left: 10px solid $ms-color-left;
}


//= Modifier: Base styling for all callout arrows
//
.ms-Callout.ms-Callout--arrowRight,
.ms-Callout.ms-Callout--arrowLeft,
.ms-Callout.ms-Callout--arrowBottom,
.ms-Callout.ms-Callout--arrowTop {
  &:before,
  &:after {
    content: '';
    position: absolute;
    transform: rotate(-45deg);
    height: 0;
    width: 0;
  }

  &:before {
    z-index: $ms-zIndex-back;
    outline: 1px solid transparent;
    @include drop-shadow;
  }

  &:after {
    z-index: $ms-zIndex-front;
  }
}


//= Modifier: Callout with left and right arrows
// 
.ms-Callout.ms-Callout--arrowLeft,
.ms-Callout.ms-Callout--arrowRight {
  &:before,
  &:after {
    top: 40px;
    display: none; // Hide left and right arrows on sm screens
  }
}

.ms-Callout.ms-Callout--arrowLeft {
  &:before,
  &:after {
    @include arrowBorders($ms-color-white, transparent, transparent, $ms-color-white);
    left: -10px;
  }
}

.ms-Callout.ms-Callout--arrowRight {
  &:before,
  &:after {
    @include arrowBorders(transparent, $ms-color-white, $ms-color-white, transparent);
    right: -10px;
  }
}


//= Modifier: Callout with top and bottom arrows
// 
.ms-Callout.ms-Callout--arrowTop,
.ms-Callout.ms-Callout--arrowBottom {
  &:before,
  &:after {
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 0;
  }
}

.ms-Callout.ms-Callout--arrowTop {
  &:before,
  &:after {
    @include arrowBorders($ms-color-white, $ms-color-white, transparent, transparent);
    top: -10px;
  }
}

.ms-Callout.ms-Callout--arrowBottom {
  &:before,
  &:after {
    @include arrowBorders(transparent, transparent, $ms-color-white, $ms-color-white);
    bottom: -10px;
  }
}

// High contrast mode styling for callout arrows
.ms-Callout.ms-Callout--arrowRight,
.ms-Callout.ms-Callout--arrowLeft,
.ms-Callout.ms-Callout--arrowBottom,
.ms-Callout.ms-Callout--arrowTop {
  &:before,
  &:after {
    @media screen and (-ms-high-contrast: active) {
      border: 0;
      width: 20px;
      height: 20px;
      background-color: $ms-color-black;
    }
    @media screen and (-ms-high-contrast: black-on-white) {
      background-color: $ms-color-white;
    }
  }
}

// The actual callout element
.ms-Callout-main {
  position: relative;
  background-color: $ms-color-white;
  box-sizing: border-box;
  outline: 1px solid transparent;
  z-index: $ms-zIndex-middle;
  @include drop-shadow;
}

.ms-Callout-close {
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 8px;
  width: 32px;
  height: 32px;
  font-size: $ms-font-size-m;
  color: $ms-color-neutralSecondary;
  z-index: ($ms-zIndex-Callout + $ms-zIndex-front);
}

.ms-Callout-inner {
  height: 100%;
  padding: 0 24px 20px;
}

.ms-Callout-header {
  z-index: ($ms-zIndex-Callout + $ms-zIndex-middle);
  padding: 18px 24px 12px;
}

.ms-Callout-title {
  margin: 0;
  font-family: $ms-font-family-semilight;
  font-size: $ms-font-size-xl;
}

.ms-Callout-subText {
  margin: 0;
  font-family: $ms-font-family-semilight;
  color: $ms-color-neutralPrimary;
  font-size: $ms-font-size-s;
}

.ms-Callout-link {
  font-size: $ms-font-size-m;
  font-family: $ms-font-family-semilight;
}

.ms-Callout-actions {
  position: relative;
  margin-top: 20px;
  width: 100%;
  white-space: nowrap;

  .ms-Link.ms-Link--hero {
    position: relative;
    left: -8px; // Move link inline with body text
  }
}

.ms-Callout-action {
  position: relative;
  top: 4px;
  left: -8px;
  margin-left: 0 !important;

  &:hover .ms-Callout-actionIcon,
  &:focus .ms-Callout-actionIcon {
    color: $ms-color-themePrimary;
  }
}

.ms-Callout-button {
  margin-right: 12px;
}


//= Modifier: Close button callout
//
.ms-Callout.ms-Callout--close {
  .ms-Callout-title {
    margin-right: 20px; // Avoid overlap with close button
  }
}


//= Modifier: OOBE (Out of box experience) callout
//
.ms-Callout.ms-Callout--OOBE {
  &.ms-Callout--arrowRight,
  &.ms-Callout--arrowLeft,
  &.ms-Callout--arrowTop {
    &:before,
    &:after {
      border-color: $ms-color-themePrimary;
      background-color: transparent;
    }
  }

  .ms-Callout-header {
    padding: 28px 24px;
    background-color: $ms-color-themePrimary;
  }

  .ms-Callout-title {
    font-family: $ms-font-family-light;
    font-size: $ms-font-size-xxl;
    color: $ms-color-white;
  }

  .ms-Callout-inner {
    padding-top: 20px;
  }

  .ms-Callout-subText {
    font-size: $ms-font-size-m;
  }
}


//= Modifier: ActionText callout
//
.ms-Callout.ms-Callout--actionText {
  .ms-Callout-actions {
    border-top: 1px solid $ms-color-neutralLight;
    margin-bottom: -8px;
  }
}


//= Modifier: Peek callout
//
.ms-Callout.ms-Callout--peek {
  &.ms-Callout--arrowTop,
  &.ms-Callout--arrowBottom {
    &:before,
    &:after {
      left: 40px;
      right: auto;
    }
  }

  &.ms-Callout--arrowRight,
  &.ms-Callout--arrowLeft {
    &:before,
    &:after {
      top: calc('50% - 10px');
    }
  }

  .ms-Callout-header {
    padding-bottom: 0;
  }

  .ms-Callout-title {
    font-size: $ms-font-size-m;
  }

  .ms-Callout-actions {
    margin-top: 12px;
    margin-bottom: -4px;
  }
}



@media (min-width: $ms-screen-md-min) {
  // Make width larger and remove centering on md+ screens
  .ms-Callout {
    width: 300px;
    margin: 16px;
  }

  // Show arrows right and left
  .ms-Callout.ms-Callout--arrowRight,
  .ms-Callout.ms-Callout--arrowLeft {
    &:before,
    &:after {
      display: block;
    }
  }
}
