/* Popovers (to be used with popovers.js)
-------------------------------------------------- */

.popover {
  position: fixed;
  top: 55px;
  left: 50%;
  z-index: 20;
  display: none;
  width: 280px;
  padding: 5px;
  margin-left: -146px;
  background-color: #555;
  background-image: -webkit-linear-gradient(top, #555 5%, #555 6%, #111 30%);
  background-image: linear-gradient(to bottom, #555 5%, #555 6%,#111 30%);
  border: 1px solid #111;
  border-radius: 6px;
  opacity: 0;
  box-shadow: inset 0 1px 1px -1px #fff, 0 3px 10px rgba(0, 0, 0, .3);
  -webkit-transform: translate3d(0, -15px, 0);
          transform: translate3d(0, -15px, 0);
  -webkit-transition: -webkit-transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
                  transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

/* Caret on top of popover using CSS triangles (thanks to @chriscoyier for solution) */
.popover:before,
.popover:after {
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  content: '';
}
.popover:before {
  top: -20px;
  margin-left: -21px;
  border-right: 21px solid transparent;
  border-bottom: 21px solid #111;
  border-left: 21px solid transparent;
}
.popover:after {
  top: -19px;
  margin-left: -20px;
  border-right: 20px solid transparent;
  border-bottom: 20px solid #555;
  border-left: 20px solid transparent;
}

/* Wrapper for a title and buttons */
.popover-header {
  display: -webkit-box;
  display: box;
  height: 34px;
  margin-bottom: 5px;
}

/* Centered title for popover */
.popover-header .title {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  margin: 15px 0;
  font-size: 16px;
  font-weight: bold;
  line-height: 12px;
  color: #fff;
  text-align: center;
  text-shadow: 0 -1px rgba(0, 0, 0, .5);
}

/* Generic style for all buttons in .popover-header */
.popover-header [class*="button"] {
  z-index: 25;
  font-size: 12px;
  line-height: 22px;
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .3);
  background-color: #454545;
  background-image: -webkit-linear-gradient(top, #454545 0, #353535 100%);
  background-image: linear-gradient(to bottom, #454545 0, #353535 100%);
  border: 1px solid #111;
  -webkit-box-flex: 0;
          box-flex: 0;
}

/* Hacky way to right align buttons outside of flex-box system
   Note: is only absolutely positioned button, would be better if flex-box had an "align right" option */
.popover-header .title + [class*="button"]:last-child,
.popover-header .button + [class*="button"]:last-child,
.popover-header [class*="button"].pull-right {
  position: absolute;
  top: 5px;
  right: 5px;
}

/* Active state for popover header buttons */
.popover-header .button:active {
  color: #fff;
  background-color: #0876b1;
}

/* Popover animation
-------------------------------------------------- */

.popover.visible {
  opacity: 1;
  -webkit-transform: translate3d(0, 0, 0);
          transform: translate3d(0, 0, 0);
}

/* Backdrop (used as invisible touch escape)
-------------------------------------------------- */

.backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
}

/* Block level buttons in popovers
-------------------------------------------------- */

/* Positioning and giving darker border to look sharp against dark popover */
.popover .button-block {
  margin-bottom: 5px;
  border: 1px solid #111;
}

/* Remove extra margin on bottom of last button */
.popover .button-block:last-child {
  margin-bottom: 0;
}

/* Lists in popovers
-------------------------------------------------- */

.popover .list {
  width: auto;
  max-height: 250px;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 0;
  overflow: auto;
  background-color: #fff;
  border: 1px solid #000;
  border-radius: 3px;
  -webkit-overflow-scrolling: touch;
}