@import "../../../../scss/variables";

$chart-header-height: 66px + 30px;
$chart-legend-height: 40px;

chart {
  display: block;
  background-color: $site-bg-color-100;
  box-shadow: $admin-card-box-shadow;
  border: $admin-card-border;
  border-radius: 4px;
  flex: 1 1 auto;
  max-width: 100%;
  max-height: 450px;
  min-width: calc(50% - 25px);
  height: 100%;

  @media only screen and (max-width: $medium) {
    width: 100%;
    flex: 0 0 100%;
  }

  &.pie-chart-container {
    max-width: 500px;
    min-width: calc(30% - 25px);

    .chart-header {
      margin-bottom: 15px;
    }
  }

  &:nth-child(1) {
    margin-right: 25px;
  }

  .chart-body {
    height: calc(100% - #{$chart-header-height + $chart-legend-height});
  }

  .chart-header {
    padding: 15px;
    margin-bottom: 30px;
    border-bottom: 1px solid $site-border-color-200;

    .title {
      font-size: 1.3rem;
      font-weight: 500;
      color: $site-text-color-400;
    }

    .subtitle {
      font-size: 1.2rem;
      color: $site-text-color-300;
    }
  }

  .chart-legend {
    display: flex;
    width: 100%;
    height: $chart-legend-height;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    font-size: 1.3rem;

    .legend-item {
      margin-right: 14px;
      position: relative;
      padding-left: 15px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      text-transform: capitalize;

      &:before {
        display: block;
        content: " ";
        width: 12px;
        height: 12px;
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        margin: auto 0;
      }
    }
  }
}