// Copyright 2018-Present Okta, Inc.

// 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.

.ods-meter {
  // Reset the default appearance
  width: 100%;
  height: $spacing-m; // match line-height of label
  border: 0;
  border-radius: $base-border-radius;
  background: $border-color-display;
  box-shadow: none;
  appearance: meter;
}

//  WebKit
.ods-meter::-webkit-meter-bar {
  height: $spacing-m; // match line-height of label
  border: 0;
  border-radius: $base-border-radius;
  background: $border-color-display;
  box-shadow: none;
}

.ods-meter::-webkit-meter-optimum-value,
.ods-meter::-webkit-meter-suboptimum-value,
.ods-meter::-webkit-meter-even-less-good-value {
  border-radius: $base-border-radius 0 0 $base-border-radius;
}

.ods-meter::-webkit-meter-optimum-value {
  background: $color-success-base;
}

.ods-meter::-webkit-meter-suboptimum-value {
  background: $color-caution-base;
}

.ods-meter::-webkit-meter-even-less-good-value {
  background: $color-danger-base;
}

// Firefox
.ods-meter::-moz-meter-bar {
  height: $spacing-m; // match line-height of label
  border: 0;
  border-radius: $base-border-radius 0 0 $base-border-radius;
}

.ods-meter:-moz-meter-optimum::-moz-meter-bar {
  background: $color-success-base;
}

.ods-meter:-moz-meter-sub-optimum::-moz-meter-bar {
  background: $color-caution-base;
}

.ods-meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
  background: $color-danger-base;
}

.ods-meter--value {
  font-weight: 600;
}

.ods-meter--label {
  display: block;
}

// Meter Fallback
.ods-meter--fallback {
  display: block;
  width: 100%;
  height: $spacing-m; // match line-height of label
  margin-top: $spacing-s;
  border-radius: $base-border-radius;
  background: $border-color-display;
}

.ods-meter--fallback > .ods-meter--fallback--value {
  display: block;
  height: inherit;
  border-radius: $base-border-radius;
  background-size: 100% 100%;
  text-indent: -9999px;
}

.ods-meter--optimum-value {
  background: $color-success-base;
}

.ods-meter--suboptimum-value {
  background: $color-caution-base;
}

.ods-meter--subsuboptimum-value {
  background: $color-danger-base;
}