@import (multiple, reference, optional) '../../theme.config';

@type: extra;
@element: custom;

@borderWidth: 1px;
@border: @borderWidth solid @borderColor;
@boxShadow: @subtleShadow;

div#view .ui.container > .styled-industry_map:last-child {
  margin-bottom: 0;
}

.industry-map {
  height: 800px;
  min-height: 800px;
  box-shadow: @boxShadow;

  .privacy-protection {
    width: 100%;

    .overlay .wrapped {
      opacity: 1;
    }
  }

  .ol-map {
    height: 800px;
    min-height: 800px;

    .ol-viewport {
      overflow: visible !important;
    }
  }

  .ol-control {
    &.ol-custom {
      right: 0.5rem !important;
      left: unset !important;

      .menu-button {
        display: none;

        @media only screen and (max-width: @largestTabletScreen) {
          display: block;
        }
      }
    }
  }

  .popover-header {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #ebebeb;
    margin-bottom: 0;
    background-color: #f7f7f7;
    border-top-left-radius: calc(0.3rem - 1px);
    border-top-right-radius: calc(0.3rem - 1px);
    font-size: 1rem;
    overflow-wrap: break-word;
  }

  .popover-actions {
    padding: 1rem 2rem;
    border-top: 1px solid #ebebeb;
    background-color: #f7f7f7;
    border-bottom-left-radius: calc(0.3rem - 1px);
    border-bottom-right-radius: calc(0.3rem - 1px);
    text-align: center;
  }

  .popover-body {
    padding: 0.5rem 0.75rem;
  }

  .popover-body code {
    color: #e83e8c;
    font-size: 87.5%;
    word-wrap: break-word;
  }

  .ol-popup {
    #popup {
      position: absolute;
      bottom: 10px;
      min-width: 280px;
      max-width: 280px;
      border: 1px solid #cccccc;
      background-color: white;
      border-radius: 0.2em;
      box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
      transform: translateX(-50%);

      &::after,
      &::before {
        position: absolute;
        top: 100%;
        width: 0;
        height: 0;
        border: solid transparent;
        content: ' ';
        pointer-events: none;
      }

      &::after {
        left: 50%;
        border-width: 10px;
        border-top-color: white;
        transform: translateX(-50%);
      }

      &::before {
        left: 50%;
        border-width: 11px;
        border-top-color: #cccccc;
        margin-left: -11px;
      }
    }
  }

  .ol-dynamic-filter {
    left: 100px;
    display: block !important;
    overflow: auto;
    min-width: 320px;
    max-width: 320px;
    height: 100%;
    transition: opacity 0.3s ease-in-out;

    > div {
      height: 100%;
    }

    #map-sidebar {
      height: fit-content;
      min-height: 100%;
      padding: 2rem 1rem;
      background-color: #fff;
      box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
      color: @primaryColor;

      h2 .delete.icon {
        display: none;
      }

      .ui.dropdown {
        > .dropdown.icon:before {
          color: @orange;
        }

        .text {
          overflow: hidden;
          width: 100%;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }

      .clear-button {
        --text-color: @orange;
        width: 100%;
        margin-top: 1.5rem;
      }

      @media only screen and (max-width: @largestTabletScreen) {
        h2 .delete.icon {
          display: initial;
        }
      }
    }

    @media only screen and (max-width: @largestTabletScreen) {
      display: none !important;
      width: 100%;
      max-width: 100%;
    }
  }

  .loader {
    position: absolute;
    z-index: 1;
    right: 1rem;
    bottom: 1rem;
    padding: 4px 6px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    color: @primaryColor;
    font-size: 1em;
    font-weight: bold;
  }

  @media only screen and (max-width: @largestMobileScreen) {
    padding: 0 1rem;
  }
}

.ui.modal#popup-detailed {
  > .header,
  h3 {
    color: @primaryColor;

    &:not(:first-child) {
      margin-top: 1rem;
    }
  }

  > .header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    .icon {
      color: @orange !important;
      cursor: pointer;

      &:hover {
        .darkenFilter(0.9);
      }
    }
  }

  > .actions {
    padding: 1rem !important;
    text-align: center;
  }

  p:not(:last-child) {
    margin-bottom: 0.5em;
  }
}

body.map-sidebar-visible .industry-map .ol-dynamic-filter {
  @media only screen and (max-width: @largestTabletScreen) {
    z-index: 1;
    left: 0;
    display: block !important;
    width: 100%;
  }
}
