/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Generic rules */

/**
 * "Fixes" the Box Model.
 * @see http://www.paulirish.com/2012/box-sizing-border-box-ftw/
 */
*, *:before, *:after {
  box-sizing: border-box;
}

body {
  font: message-box;
  font-size: 12px;
  background: #fbfbfb;
  overflow: hidden;
}

img {
  border: none;
}

h1, h2, h3 {
  color: #666;
}

/* choose a sane default for paragraphs, since reset.css' 0px is not what we want */
p {
  margin: 1em 0;
}

/* Helpers */

/**
 * Clearfix impl. for modern browsers
 * 1. The space content is one way to avoid an Opera bug when the
 *    contenteditable attribute is included anywhere else in the document.
 *    Otherwise it causes space to appear at the top and bottom of elements
 *    that are clearfixed.
 * 2. The use of `table` rather than `block` is only necessary if using
 *    `:before` to contain the top-margins of child elements.
 */
.cf:before,
.cf:after {
  display: table; /* 1 */
  content: " ";   /* 2 */
}

.cf:after {
  clear: both;
}

.hide {
  /**
   * Force the display: none as it can conflict with other display.
   * You usually want to avoid !important statements as much as
   * possible. In this case, it makes sense as it's unlikely we want a
   * class to undo the hide feature.
   */
  display: none !important;
}

.visually-hidden {
  visibility: hidden;
}

.tc {
  text-align: center;
}

.full-width {
  width: 100%;
}

/* A reset for all button-appearing elements, with the lowest-common
 * denominator of the needed rules.  Intended to be used as a base class
 * together with .btn-*
 */

.btn {
  display: inline-block;
  margin: 0;
  padding: 0;
  border: none;
  background: #a5a;
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: .9em;
  cursor: pointer;
}

.btn.btn-constrained {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-info {
  background-color: #0096dd;
  border: 1px solid #0095dd;
  color: #fff;
}

  .btn-info:hover {
    background-color: #008acb;
    border: 1px solid #008acb;
  }

  .btn-info:active {
    background-color: #006b9d;
    border: 1px solid #006b9d;
  }

.btn-accept,
.btn-success,
.btn-accept + .btn-chevron {
  background-color: #5bc0a4;
  border: 1px solid #5bc0a4;
}

  .btn-accept:hover,
  .btn-success:hover,
  .btn-accept + .btn-chevron:hover {
    background-color: #47b396;
    border: 1px solid #47b396;
  }

  .btn-accept:active,
  .btn-success:active,
  .btn-accept + .btn-chevron:active {
    background-color: #3aa689;
    border: 1px solid #3aa689;
  }

.btn-warning {
  background-color: #f0ad4e;
}

.btn-cancel,
.btn-error,
.btn-decline,
.btn-hangup,
.btn-decline + .btn-chevron,
.btn-error + .btn-chevron {
  background-color: #d74345;
  border: 1px solid #d74345;
}

  .btn-cancel:hover,
  .btn-error:hover,
  .btn-decline:hover,
  .btn-hangup:hover,
  .btn-decline + .btn-chevron:hover,
  .btn-error + .btn-chevron:hover {
    background-color: #c53436;
    border-color: #c53436;
  }

  .btn-cancel:active,
  .btn-error:active,
  .btn-decline:active,
  .btn-hangup:active,
  .btn-decline + .btn-chevron:active,
  .btn-error + .btn-chevron:active {
    background-color: #ae2325;
    border-color: #ae2325;
  }

.btn-chevron {
  width: 26px;
  height: 26px;
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
}

/* Groups together a button and a chevron */
.btn-group-chevron {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Groups together a button-group-chevron
 * and the dropdown menu */
.btn-chevron-menu-group {
  display: flex;
  justify-content: space-between;
  flex: 8;
}

.btn-group-chevron .btn {
  border-radius: 2px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  flex: 2;
}

  .btn + .btn-chevron,
  .btn + .btn-chevron:hover,
  .btn + .btn-chevron:active {
    border-left: 1px solid rgba(255,255,255,.4);
    background-image: url("../img/dropdown-inverse.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
  }

@media (min-resolution: 2dppx) {
  .btn-chevron {
    background-image: url(../img/dropdown-inverse@2x.png);
  }
}

.disabled, button[disabled] {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.65;
}

.btn-group {
  display: flex;
  align-content: space-between;
  justify-content: center;
}

.btn-chevron-menu-group .btn {
  flex: 1;
  border-radius: 2px;
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
}

/* Alerts/Notifications */
.notificationContainer {
  border-bottom: 2px solid #E9E9E9;
}

.messages > .notificationContainer > .alert {
  text-align: center;
}

.notificationContainer > .detailsBar,
.alert {
  background: #eee;
  padding: .4em 1em;
}

.alert p.message {
  padding: 0;
  margin: 0;
}

.alert-error {
  background: repeating-linear-gradient(-45deg, #D74345, #D74345 10px, #D94B4D 10px, #D94B4D 20px) repeat scroll 0% 0% transparent;
  color: #fff;
}

.alert-warning {
  background: #fcf8e3;
  border: 1px solid #fbeed5;
}

.alert-success {
  background: #5BC0A4;
  border: 1px solid #5BC0A4;
  color: #fff;
}

.notificationContainer > .details-error {
  background: #fbebeb;
  color: #d74345
}

.notificationContainer > .details-error > .detailsButton {
  float: right;
  -moz-margin-start: 1em; /* Match .detailsBar padding */
}

.alert .close {
  position: relative;
  top: -.1rem;
  right: -1rem;
}

/* Misc */

.call-url,
.overflow-text-ellipsis,
.standalone-call-btn-text,
.fx-embedded-answer-btn-text {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.close {
  float: right;
  font-size: 1rem;
  font-weight: bold;
  line-height: 1rem;
  color: #000;
  opacity: .4;
  background: none;
  border: none;
  cursor: pointer;
}

  .close:hover {
    opacity: .6;
  }

.close:before {
  /* \2716 is unicode representation of the close button icon */
  content: '\2716';
}

/* Transitions */
.fade-out {
  transition: opacity 0.5s ease-in;
  opacity: 0;
}

.icon,
.icon-small,
.icon-audio,
.icon-video {
  background-size: 20px;
  background-repeat: no-repeat;
  vertical-align: top;
  background-position: 80% center;
}

.icon-small {
  background-size: 10px;
}

.icon-video {
  background-image: url("../img/video-inverse-14x14.png");
}

.icon-audio {
  background-image: url("../img/audio-default-16x16@1.5x.png");
}

@media (min-resolution: 2dppx) {
  .icon-video {
    background-image: url("../img/video-inverse-14x14@2x.png");
  }

  .icon-audio {
    background-image: url("../img/audio-default-16x16@2x.png");
  }
}

/*
 * Platform specific styles
 * The UI should match the user OS
 * Specific font sizes for text paragraphs to match
 * the interface on that platform.
 */

.inverse {
  color: #fff;
}

.light {
  color: rgba(51, 51, 51, .5);
}

/* Web panel */

.info-panel {
  border-radius: 4px;
  background: #fff;
  padding: 20px 0;
  border: 1px solid #e7e7e7;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .03);
  margin: 2rem 0;
}

.info-panel h1 {
  font-size: 1.2em;
  font-weight: 700;
  padding: 20px 0;
  text-align: center;
}

.info-panel h4 {
  color: #aaa;
  text-align: center;
  font-weight: 500;
  font-size: 1.2em;
  margin: 0;
}

/* Logos */

.firefox-logo {
  margin: 0 auto; /* horizontal block centering */
  width: 100px;
  height: 100px;
  background: transparent url(../img/firefox-logo.png) no-repeat center center;
  background-size: contain;
}

/* Dropdown menu */

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  bottom: 0;
  left: 0;
  background-color: #fdfdfd;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  list-style: none;
  padding: 5px;
  border-radius: 2px;
}

html[dir="rtl"] .dropdown-menu {
  left: auto;
  right: 0;
}

.dropdown-menu-item {
  text-align: start;
  margin: .3em 0;
  padding: .2em .5em;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 1em;
  white-space: nowrap;
}

.dropdown-menu-item:hover {
  border: 1px solid #ccc;
  background-color: #eee;
}

.dropdown-menu-item > .icon {
  background-repeat: no-repeat;
  display: inline-block;
}

.dropdown-menu-separator {
  height: 1px;
  margin: 2px -2px 1px -2px;
  border-top: 1px solid #dedede;
  background-color: #fff;
}

/* Custom checkbox */

.checkbox-wrapper {
  -moz-user-select: none;
  user-select: none;
}

.checkbox {
  float: left;
  width: 1em;
  height: 1em;
  -moz-margin-end: .5em;
  margin-top: .1em;
  border: 1px solid #999;
  border-radius: 3px;
  cursor: pointer;
  background-color: transparent;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: 1em 1em;
}

html[dir="rtl"] .checkbox {
  float: right;
}

.checkbox.checked {
  background-image: url("../img/check.svg#check");
}

.checkbox.checked:hover,
.checkbox.checked:hover:active {
  background-image: url("../img/check.svg#check-active");
}

.checkbox.disabled {
  border: 1px solid #909090;
}

.checkbox.checked.disabled {
  background-image: url("../img/check.svg#check-disabled");
}

/* ContextUrlView classes */

.context-content {
  color: black;
  text-align: left;
}

html[dir="rtl"] .context-content {
  text-align: right;
}

.context-content > p {
  font-weight: bold;
  margin-bottom: .8em;
  margin-top: 0;
}

.context-wrapper {
  border: 1px solid #5cccee;
  border-radius: 3px;
  background: #fff;
  padding: .8em;
  /* Use the flex row mode to position the elements next to each other. */
  display: flex;
  flex-flow: row nowrap;
  line-height: 1.1em;
}

.context-wrapper > .context-preview {
  float: left;
  /* 16px is standard height/width for a favicon */
  width: 16px;
  max-height: 16px;
  margin-right: .8em;
  flex: 0 0 auto;
}

html[dir="rtl"] .context-wrapper > .context-preview {
  float: left;
  margin-left: .8em;
  margin-right: 0;
}

.context-wrapper > .context-description {
  flex: 0 1 auto;
  display: block;
  color: black;
  /* 16px for the preview, plus its .8em margin */
  max-width: calc(100% - 16px - .8em);
  word-wrap: break-word;
}

.context-wrapper > .context-description > .context-url {
  display: block;
  color: #59A1D7;
  font-weight: 700;
  clear: both;
}
