/*
 * Backpack - Skyscanner's Design System
 *
 * Copyright 2016-2021 Skyscanner Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import '~bpk-mixins';

// Matches the height and width of BpkMapMarkerBackground
$marker-height: $bpk-spacing-xl;
$marker-width: $bpk-spacing-lg;
$selected-marker-height: $bpk-spacing-xxl;
$selected-marker-width: $bpk-spacing-xl;

.bpk-icon-marker {
  &__wrapper {
    position: relative;
    z-index: 1;
    width: $marker-width;
    height: $marker-height;
    border: none; // Prevent default <button> styling.
    background: none; // Prevent default <button> styling.

    &--selected {
      z-index: 2;
      width: $selected-marker-width;
      height: $selected-marker-height;
    }
  }

  &__icon {
    // This ensures that the icon is positioned exactly in the
    // centre of the marker.
    $padding: ($marker-width / 2) - ($bpk-icon-size-sm / 2);

    position: absolute;
    top: $padding;
    left: $padding;
    color: $bpk-color-white;

    > svg {
      fill: currentColor;
    }

    &--interactive {
      cursor: pointer;
    }

    &--disabled {
      @include bpk-themeable-property(
        color,
        --bpk-icon-marker-default-disabled-color,
        $bpk-color-monteverde
      );
    }

    &--selected {
      // This ensures that the icon is positioned exactly in the
      // centre of the marker.
      $padding: ($selected-marker-width / 2) - ($bpk-icon-size-sm / 2);

      top: $padding;
      left: $padding;

      @include bpk-themeable-property(
        color,
        --bpk-icon-marker-default-selected-color,
        $bpk-color-monteverde
      );
    }
  }
}
