@use 'variables' as *;

.svgMap-wrapper,
.svgMap-container {
  position: relative;
}

.svgMap-block-zoom-notice {
  position: absolute;
  z-index: 2;
  top: 100%;
  left: 0;
  right: 0;
  bottom: 0;
  background: $blockZoomNoticeBackgroundColor;
  pointer-events: none;
  opacity: 0;
  color: $blockZoomNoticeColor;
  transition: opacity 250ms;

  .svgMap-block-zoom-notice-active & {
    pointer-events: all;
    top: 0;
    opacity: 1;
  }

  > div {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0 32px;
    transform: translateY(-50%);
    font-size: 28px;

    @media (max-width: 900px) {
      font-size: 22px;
    }
  }
}

.svgMap-map-wrapper {
  position: relative;
  width: 100%;
  padding-top: 50%;
  overflow: hidden;
  background: $oceanColor;
  color: $textColor;

  * {
    box-sizing: border-box;
  }

  :focus:not(:focus-visible) {
    outline: 0;
  }

  .svgMap-map-image {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
  }

  // Controls

  .svgMap-map-controls-wrapper {
    position: absolute;
    z-index: 1;
    display: flex;
    overflow: hidden;
    border-radius: 2px;
    box-shadow: $mapControlsBoxShadow;

    &.svgMap-controls-position-bottomLeft {
      bottom: 10px;
      left: 10px;
    }
    &.svgMap-controls-position-bottomRight {
      bottom: 10px;
      right: 10px;
    }
    &.svgMap-controls-position-topLeft {
      top: 10px;
      left: 10px;
    }
    &.svgMap-controls-position-topRight {
      top: 10px;
      right: 10px;
    }

    &.svgMap-disabled {
      display: none;
    }
  }

  .svgMap-map-controls-zoom,
  .svgMap-map-controls-move {
    display: flex;
    margin-right: 5px;
    overflow: hidden;
    background: $mapControlsBackgroundColor;

    &:last-child {
      margin-right: 0;
    }
  }

  .svgMap-control-button {
    background-color: $mapControlsBackgroundColor;
    border: none;
    border-radius: 0;
    color: $mapControlsColor;
    font: inherit;
    line-height: inherit;
    margin: 0;
    padding: 0;
    overflow: visible;
    text-transform: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    position: relative;

    &.svgMap-zoom-button {
      &::before,
      &::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: $mapControlsIconColor;
        transition: background-color 250ms;
      }

      &::before {
        width: 11px;
        height: 3px;
      }

      @media (hover: hover) {
        &:hover {
          &::before,
          &::after {
            background: $mapControlsIconColorActive;
          }
        }
      }

      &:active {
        &::before,
        &::after {
          background: $mapControlsIconColorActive;
        }
      }

      &.svgMap-zoom-reset-button {
        &::before {
          width: 11px;
          height: 11px;
          background: none;
          border: 2px solid $mapControlsIconColor;
          transition: border-color 250ms;
        }

        @media (hover: hover) {
          &:hover {
            &::before {
              background: none;
              border-color: $mapControlsIconColorActive;
            }
          }
        }

        &:active {
          &::before {
            background: none;
            border-color: $mapControlsIconColorActive;
          }
        }
      }

      &.svgMap-disabled {
        &::before,
        &::after {
          background: $mapControlsDisabledColor;
        }
      }

      &.svgMap-zoom-reset-button {
        &.svgMap-disabled {
          cursor: default;

          &::before {
            border: 2px solid $mapControlsDisabledColor;
            background: none;
          }
        }
      }
    }

    &.svgMap-zoom-in-button {
      &::after {
        width: 3px;
        height: 11px;
      }
    }
  }

  // Contient controls
  .svgMap-map-continent-controls-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    display: flex;
    border-radius: 2px;
    box-shadow: $continentControlsBoxShadow;
  }

  // Countries

  .svgMap-country {
    fill: var(--svg-map-country-fill, #E2E2E2);
    stroke: $countryStrokeColor;
    stroke-width: 1;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    transition:
      fill 250ms,
      stroke 250ms;

    &[data-link] {
      cursor: pointer;
    }

    @media (hover: hover) {
      &:hover {
        stroke: $mapActiveStrokeColor;
        stroke-width: $mapActiveStrokeWidth;
      }
    }

    &.svgMap-active {
      stroke: $mapActiveStrokeColor;
      stroke-width: $mapActiveStrokeWidth;
    }
  }
}

.svgMap-wrapper.svgMap-country-click-callback .svgMap-map-wrapper .svgMap-country {
  cursor: pointer;
}
