/* required styles */

.tsmap-pane,
.tsmap-tile,
.tsmap-marker-icon,
.tsmap-marker-shadow,
.tsmap-tile-container,
.tsmap-pane > svg,
.tsmap-pane > canvas,
.tsmap-zoom-box,
.tsmap-image-layer,
.tsmap-layer {
  position: absolute;
  left: 0;
  top: 0;
  width:100%;
}

.tsmap-container {
  overflow: hidden;
}

.tsmap-tile,
.tsmap-marker-icon,
.tsmap-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

/* Safari renders non-retina tile on retina better with this, but Chrome is worse */

.tsmap-safari {
  .tsmap-tile {
    image-rendering: -webkit-optimize-contrast;
  }

  /* hack that prevents hw layers "stretching" when loading new tiles */
  .tsmap-tile-container {
    width: 1600px;
    height: 1600px;
    -webkit-transform-origin: 0 0;
  }
}

.tsmap-marker-icon,
.tsmap-marker-shadow {
  display: block;
}

/* .tsmap-container svg: reset svg max-width declaration shipped in Joomla! (joomla.org) 3.x */
/* .tsmap-container img: map is broken in FF if you have max-width: 100% on tiles */

.tsmap-container {
  .tsmap-overlay-pane svg {
    max-width: none !important;
    max-height: none !important;
  }

  .tsmap-marker-pane img,
  .tsmap-shadow-pane img,
  .tsmap-tile-pane img,
  img.tsmap-image-layer,
  .tsmap-tile {
    max-width: none !important;
    max-height: none !important;
    width: auto;
    padding: 0;
  }

  img.tsmap-tile {
    /* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */
    mix-blend-mode: plus-lighter;
  }

  &.tsmap-touch-zoom {
    touch-action: pan-x pan-y;
  }

  &.tsmap-touch-drag {
    /* Fallback for FF which doesn't support pinch-zoom */
    touch-action: none;
    touch-action: pinch-zoom;

    &.tsmap-touch-zoom {
      touch-action: none;
    }
  }

  -webkit-tap-highlight-color: transparent;

  a {
    -webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
  }
}

.tsmap-tile {
  visibility: hidden;
}

.tsmap-tile-loaded {
  visibility: inherit;
}

.tsmap-zoom-box {
  width: 0;
  height: 0;
  box-sizing: border-box;
  z-index: 800;
}

.tsmap-pane {
  z-index: 400;
}

.tsmap-tile-pane {
  z-index: 200;
}

.tsmap-overlay-pane {
  z-index: 400;
}

.tsmap-shadow-pane {
  z-index: 500;
}

.tsmap-marker-pane {
  z-index: 600;
}

.tsmap-tooltip-pane {
  z-index: 650;
}

.tsmap-popup-pane {
  z-index: 700;
}

.tsmap-map-pane {
  canvas {
    z-index: 100;
  }

  svg {
    z-index: 200;
  }
}

/* control positioning */

.tsmap-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
  float: left;
  clear: both;
}

.tsmap-top,
.tsmap-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.tsmap-top {
  top: 0;
  .tsmap-control {
    margin-top: 10px;
  }
}

.tsmap-right {
  right: 0;
  .tsmap-control {
    float: right;
    margin-right: 10px;
  }
}

.tsmap-bottom {
  bottom: 0;
  .tsmap-control {
    margin-bottom: 10px;
  }
}

.tsmap-left {
  left: 0;
  .tsmap-control {
    margin-left: 10px;
  }
}

/* zoom and fade animations */

.tsmap-fade-anim {
  .tsmap-popup {
    opacity: 0;
    transition: opacity 0.2s linear;
  }

  .tsmap-map-pane .tsmap-popup {
    opacity: 1;
  }
}

.tsmap-zoom-animated {
  transform-origin: 0 0;
  svg& {
    will-change: transform;
  }
}

.tsmap-zoom-anim {
  .tsmap-zoom-animated {
    transition: transform 0.25s cubic-bezier(0, 0, 0.25, 1);
  }

  .tsmap-tile {
    transition: none;
  }

  .tsmap-zoom-hide {
    visibility: hidden;
  }
}

.tsmap-pan-anim .tsmap-tile {
  transition: none;
}

/* Upright panes — counter-rotate the pane so marker icons, popups and
 * tooltips stay visually upright when the map is rotated (bearing != 0).
 * The transform and transform-origin are driven from JS (see
 * `TsMap._applyBearingToPanes`). */
.tsmap-upright {
  will-change: transform;
}

/* cursors */

.tsmap-interactive {
  cursor: pointer;
}

.tsmap-grab {
  cursor: grab;
}

.tsmap-crosshair {
  cursor: crosshair;

  .tsmap-interactive {
    cursor: crosshair;
  }
}

.tsmap-popup-pane,
.tsmap-control {
  cursor: auto;
}

.tsmap-dragging {
  .tsmap-grab {
    cursor: grabbing;

    .tsmap-interactive {
      cursor: grabbing;
    }
  }

  .tsmap-marker-draggable {
    cursor: grabbing;
  }
}

/* marker & overlays interactivity */
.tsmap-marker-icon,
.tsmap-marker-shadow,
.tsmap-image-layer,
.tsmap-pane > svg path,
.tsmap-tile-container {
  pointer-events: none;
}

.tsmap-marker-icon.tsmap-interactive,
.tsmap-image-layer.tsmap-interactive,
.tsmap-pane > svg path.tsmap-interactive,
svg.tsmap-image-layer.tsmap-interactive path {
  pointer-events: auto;
}

/* visual tweaks */

.tsmap-container {
  background: #ddd;
  outline-offset: 1px;

  a {
    color: #0078a8;
  }
}

/* prevent showing outline-box on Chromium when clicking on a vector with a tooltip */
path.tsmap-interactive:focus:not(:focus-visible) {
  outline: 0;
}

.tsmap-zoom-box {
  border: 2px dotted #38f;
  background: rgba(255, 255, 255, 0.5);
}

/* general typography */
.tsmap-container {
  font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-size: 0.75rem;
  line-height: 1.5;
}

/* general toolbar styles */

.tsmap-bar {
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
  border-radius: 4px;

  a {
    background-color: #fff;
    border-bottom: 1px solid #ccc;
    width: 26px;
    height: 26px;
    line-height: 26px;
    display: block;
    text-align: center;
    text-decoration: none;
    color: black;
    background-position: 50% 50%;
    background-repeat: no-repeat;
    display: block;
    &:hover,
    &:focus {
      background-color: #f4f4f4;
    }

    &:first-child {
      border-top-left-radius: 4px;
      border-top-right-radius: 4px;
    }

    &:last-child {
      border-bottom-left-radius: 4px;
      border-bottom-right-radius: 4px;
      border-bottom: none;
    }

    &.tsmap-disabled {
      cursor: default;
      background-color: #f4f4f4;
      color: #bbb;
    }
  }
}

.tsmap-control-layers-toggle {
  background-position: 50% 50%;
  background-repeat: no-repeat;
  display: block;
}

.tsmap-touch .tsmap-bar a {
  width: 30px;
  height: 30px;
  line-height: 30px;

  &:first-child {
    border-top-left-radius: 2px;
    border-top-right-radius: 2px;
  }

  &:last-child {
    border-bottom-left-radius: 2px;
    border-bottom-right-radius: 2px;
  }
}

/* zoom control */

.tsmap-control-zoom-in,
.tsmap-control-zoom-out {
  font: bold 18px 'Lucida Console', Monaco, monospace;
  text-indent: 1px;
  .tsmap-touch & {
    font-size: 22px;
  }
}

/* layers control */

.tsmap-control-layers {
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
  background: #fff;
  border-radius: 5px;

  .tsmap-control-layers-list {
    display: none;
  }
}

.tsmap-control-layers-toggle {
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2736%27 height=%2736%27 viewBox=%270 0 36 36%27%3E%3Crect x=%274%27 y=%274%27 width=%2714%27 height=%2714%27 fill=%27%23fff%27 stroke=%27%23666%27 stroke-width=%271.5%27/%3E%3Crect x=%2710%27 y=%2710%27 width=%2714%27 height=%2714%27 fill=%27%23e8e8e8%27 stroke=%27%23666%27 stroke-width=%271.5%27/%3E%3Crect x=%2716%27 y=%2716%27 width=%2714%27 height=%2714%27 fill=%27%23d0d0d0%27 stroke=%27%23666%27 stroke-width=%271.5%27/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: center;
  width: 36px;
  height: 36px;

  .tsmap-touch & {
    width: 44px;
    height: 44px;
  }
}

.tsmap-control-layers-expanded {
  .tsmap-control-layers-toggle {
    display: none;
  }

  .tsmap-control-layers-list {
    display: block;
    position: relative;
  }
}

.tsmap-control-layers-list {
  border: 0;
  margin: 0;
  padding: 0;
}

.tsmap-control-layers-expanded {
  padding: 6px 10px 6px 6px;
  color: #333;
  background: #fff;
}

.tsmap-control-layers-scrollbar {
  overflow-y: scroll;
  overflow-x: hidden;
  padding-right: 5px;
}

.tsmap-control-layers-selector {
  margin-top: 2px;
  position: relative;
  top: 1px;
}

.tsmap-control-layers label {
  display: block;
  font-size: 13px;
  font-size: 1.08333em;
}

.tsmap-control-layers-separator {
  height: 0;
  border-top: 1px solid #ddd;
  margin: 5px -10px 5px -6px;
}

/* Path-detection probe for DefaultIcon (see DefaultIcon._detectIconPath) */
.tsmap-default-icon-path {
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2725%27 height=%2741%27%3E%3Cpath fill=%27%232b83f6%27 d=%27M12.5 0C5.6 0 0 5.6 0 12.5c0 9.4 12.5 28.5 12.5 28.5S25 21.9 25 12.5C25 5.6 19.4 0 12.5 0z%27/%3E%3C/svg%3E');
}

/* attribution and scale controls */

.tsmap-container .tsmap-control-attribution {
  background: #fff;
  background: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.tsmap-control-attribution,
.tsmap-control-scale-line {
  padding: 0 5px;
  color: #333;
  line-height: 1.4;
}

.tsmap-control-attribution a {
  text-decoration: none;

  &:hover,
  &:focus {
    text-decoration: underline;
  }
}

.tsmap-attribution-flag {
  display: inline !important;
  vertical-align: baseline !important;
  width: 1em;
  height: 0.6669em;
  margin-right: 0.277em;
}

.tsmap-left .tsmap-control-scale {
  margin-left: 5px;
}

.tsmap-bottom .tsmap-control-scale {
  margin-bottom: 5px;
}

.tsmap-control-scale-line {
  border: 2px solid #777;
  border-top: none;
  line-height: 1.1;
  padding: 2px 5px 1px;
  white-space: nowrap;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.8);
  text-shadow: 1px 1px #fff;

  &:not(:first-child) {
    border-top: 2px solid #777;
    border-bottom: none;
    margin-top: -2px;

    &:not(:last-child) {
      border-bottom: 2px solid #777;
    }
  }
}

.tsmap-touch {
  .tsmap-control-attribution,
  .tsmap-control-layers,
  .tsmap-bar {
    box-shadow: none;
  }

  .tsmap-control-layers,
  .tsmap-bar {
    border: 2px solid rgba(0, 0, 0, 0.2);
    background-clip: padding-box;
  }
}

/* popup */

.tsmap-popup {
  position: absolute;
  text-align: center;
  margin-bottom: 20px;
}

.tsmap-popup-content-wrapper {
  padding: 1px;
  text-align: left;
  border-radius: 12px;
}

.tsmap-popup-content {
  margin: 13px 24px 13px 20px;
  line-height: 1.3;
  font-size: 13px;
  font-size: 1.08333em;
  min-height: 1px;

  p {
    margin: 17px 0;
    margin: 1.3em 0;
  }
}

.tsmap-popup-tip-container {
  width: 40px;
  height: 20px;
  position: absolute;
  left: 50%;
  margin-top: -1px;
  margin-left: -20px;
  overflow: hidden;
  pointer-events: none;
}

.tsmap-popup-tip {
  width: 17px;
  height: 17px;
  padding: 1px;
  margin: -10px auto 0;
  pointer-events: auto;
  transform: rotate(45deg);
}

.tsmap-popup-content-wrapper,
.tsmap-popup-tip {
  background: white;
  color: #333;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

.tsmap-container a.tsmap-popup-close-button {
  position: absolute;
  top: 0;
  right: 0;
  border: none;
  text-align: center;
  width: 24px;
  height: 24px;
  font: 16px/24px Tahoma, Verdana, sans-serif;
  color: #757575;
  text-decoration: none;
  background: transparent;

  &:hover,
  &:focus {
    color: #585858;
  }
}

.tsmap-popup-scrolled {
  overflow: auto;
}

/* div icon */

.tsmap-div-icon {
  background: #fff;
  border: 1px solid #666;
}

/* Tooltip */
/* Base styles for the element that has a tooltip */
.tsmap-tooltip {
  position: absolute;
  padding: 6px;
  background-color: #fff;
  border: 1px solid #fff;
  border-radius: 3px;
  color: #222;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);

  &.tsmap-interactive {
    cursor: pointer;
    pointer-events: auto;
  }
}

.tsmap-tooltip-top:before,
.tsmap-tooltip-bottom:before,
.tsmap-tooltip-left:before,
.tsmap-tooltip-right:before {
  position: absolute;
  pointer-events: none;
  border: 6px solid transparent;
  background: transparent;
  content: '';
}

/* Directions */

.tsmap-tooltip-bottom {
  margin-top: 6px;

  &:before {
    left: 50%;
    margin-left: -6px;
    top: 0;
    margin-top: -12px;
    margin-left: -6px;
    border-bottom-color: #fff;
  }
}

.tsmap-tooltip-top {
  margin-top: -6px;

  &:before {
    left: 50%;
    margin-left: -6px;
    bottom: 0;
    margin-bottom: -12px;
    border-top-color: #fff;
  }
}

.tsmap-tooltip-left {
  margin-left: -6px;

  &:before {
    top: 50%;
    margin-top: -6px;
    right: 0;
    margin-right: -12px;
    border-left-color: #fff;
  }
}

.tsmap-tooltip-right {
  margin-left: 6px;

  &:before {
    top: 50%;
    margin-top: -6px;
    left: 0;
    margin-left: -12px;
    border-right-color: #fff;
  }
}

/* Printing */

@media print {
  /* Prevent printers from removing background-images of controls. */
  .tsmap-control {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
