@import './variables';

:root {
  --jvm-border-color: #{$border-color};
  --jvm-box-shadow: #{$box-shadow};

  // Tooltip
  --jvm-tooltip-font-size: #{$tooltip-font-size};
  --jvm-tooltip-bg-color: #{$tooltip-bg-color};
  --jvm-tooltip-color: #{$tooltip-color};
  --jvm-tooltip-padding: #{$tooltip-padding};
  --jvm-tooltip-shadow: var(--jvm-box-shadow);
  --jvm-tooltip-radius: #{$tooltip-radius};

  // Zoom buttons
  --jvm-zoom-btn-bg-color: #{$zoom-btn-bg-color};
  --jvm-zoom-btn-color: #{$zoom-btn-color};
  --jvm-zoom-btn-size: #{$zoom-btn-size};
  --jvm-zoom-btn-radius: #{$zoom-btn-radius};

  // Series
  --jvm-series-container-right: #{$series-container-right};

  // Legends
  --jvm-legend-bg-color: #{$legend-bg-color};
  --jvm-legend-radius: #{$legend-radius};
  --jvm-legend-margin-left: #{$legend-margin-left};
  --jvm-legend-padding: #{$legend-padding};

  // Legend title
  --jvm-legend-title-padding-bottom: #{$legend-title-padding-bottom};
  --jvm-legend-title-margin-bottom: #{$legend-title-margin-bottom};

  // Legend ticks
  --jvm-legend-tick-margin-top: #{$legend-tick-margin-top};
  --jvm-legend-tick-sample-radius: #{$legend-tick-sample-radius};
  --jvm-legend-tick-sample-height: #{$legend-tick-sample-height};
  --jvm-legend-tick-sample-width: #{$legend-tick-sample-width};
  --jvm-legend-tick-text-font-size: #{$legend-tick-text-font-size};
  --jvm-legend-tick-text-margin-top: #{$legend-tick-text-margin-top};
}

// Global resets
image, text, .jvm-zoom-btn { user-select: none }

// jsVectorMap container
.jvm-container {
  position: relative;
  height: 100%;
  width: 100%;
}

// Tooltip
.jvm-tooltip {
  border-radius: var(--jvm-tooltip-radius);
  background-color: var(--jvm-tooltip-bg-color);
  color: var(--jvm-tooltip-color);
  font-size: var(--jvm-tooltip-font-size);
  box-shadow: var(--jvm-tooltip-shadow);
  padding: var(--jvm-tooltip-padding);
  white-space: nowrap;
  position: absolute;
  display: none;
  &.active {
    display: block;
  }
}

// Zoom buttons
.jvm-zoom-btn {
  background-color: var(--jvm-zoom-btn-bg-color);
  color: var(--jvm-zoom-btn-color);
  border-radius: var(--jvm-zoom-btn-radius);
  height: var(--jvm-zoom-btn-size);
  width: var(--jvm-zoom-btn-size);
  box-sizing: border-box;
  position: absolute;
  left: 10px;
  line-height: var(--jvm-zoom-btn-size);
  text-align: center;
  cursor: pointer;

  &.jvm-zoomin {
    top: var(--jvm-zoom-btn-size)
  }

  &.jvm-zoomout {
    top: calc(var(--jvm-zoom-btn-size) * 2 + (var(--jvm-zoom-btn-size) / 3));
  }
}

// Series
.jvm-series-container {
  position: absolute;
  right: var(--jvm-series-container-right);
  &.jvm-series-h { bottom: 15px }
  &.jvm-series-v {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    top: 15px;
  }
}

// Legends
.jvm-legend {
  background-color: var(--jvm-legend-bg-color);
  border: 1px solid var(--jvm-border-color);
  margin-left: var(--jvm-legend-margin-left);
  border-radius: var(--jvm-legend-radius);
  padding: var(--jvm-legend-padding);
  box-shadow: var(--jvm-box-shadow);
}

.jvm-legend-title {
  line-height: 1;
  border-bottom: 1px solid var(--jvm-border-color);
  padding-bottom: var(--jvm-legend-title-padding-bottom);
  margin-bottom: var(--jvm-legend-title-margin-bottom);
  text-align: left;
}

.jvm-legend-tick {
  display: flex;
  align-items: center;
  min-width: 40px;
  &:not(:first-child) {
    margin-top: var(--jvm-legend-tick-margin-top);
  }
}

.jvm-legend-tick-sample {
  border-radius: var(--jvm-legend-tick-sample-radius);
  margin-right: 0.45rem;
  height: var(--jvm-legend-tick-sample-height);
  width: var(--jvm-legend-tick-sample-width);
}

.jvm-legend-tick-text {
  font-size: var(--jvm-legend-tick-text-font-size);
  text-align: center;
  line-height: 1;
}

// Line animation
.jvm-line[animation="true"] {
  -webkit-animation: jvm-line-animation 10s linear forwards infinite;
  animation: jvm-line-animation 10s linear forwards infinite;

  @keyframes jvm-line-animation {
    from { stroke-dashoffset: 250; }
  }
}
