/* Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
   for details. All rights reserved. Use of this source code is governed by a
   BSD-style license that can be found in the LICENSE file. */

@use 'variables';

.package-badge {
  display: inline-block;
  background: var(--pub-neutral-bgColor);
  border: 1px solid var(--pub-badge-default-color);
  border-radius: 20px;
  color: var(--pub-badge-default-color);

  font-size: 12px;
  padding: 1px 6px;
  margin: 0 8px 0 0;

  &.package-badge-red {
    border-color: var(--pub-badge-red-color);
    color: var(--pub-badge-red-color);
  }

  &.package-badge-name-match {
    position: relative;
    top: -5px;
  }

  .package-badge-icon {
    max-width: 13px;
    max-height: 13px;
    position: relative;
    top: 2px;
    margin-right: 4px;
  }

  /*
    NOTE: This changes the side margins for the badge(s) on the package page,
          while subsequent badges still have 8px between them.
  */
  .detail-header-content-block .metadata & {
    margin-left: 4px;
    margin-right: 4px;
  }
}

.package-vp-icon {
  display: inline-block;
  height: 14px;
  position: relative;
  top: 3px;
  opacity: 0.5;
  margin-right: 3px;
}

.versions-rss-image {
  margin-left: 8px;
  position: relative;
  top: 2px;
}

.version-table {
  width: 100%;
  border-spacing: 0;

  td, th {
    border-bottom: 1px solid #c8c8ca;
    padding: 8px 4px;
    text-align: left;

    &.badge {
      width: 100px;

      @media (max-width: variables.$device-mobile-max-width) {
        display: none;
      }
    }

    &.sdk {
      white-space: nowrap;
      width: 80px;
    }

    &.uploaded {
      white-space: nowrap;
      width: 100px;
    }

    &.documentation {
      width: 60px; /* TODO: change to 40 after 'failed' text is removed. '*/
      text-align: center;
    }

    &.archive {
      width: 40px;
      text-align: center;
    }
  }

  > thead > tr > th {
    font-size: 16px;
    font-weight: 400;

    &.version > span.label {
      display: inline-block;
      min-width: 100%;
    }

    &.documentation > span.label,
    &.archive > span.label {
      display: none;
    }

    @media (max-width: variables.$device-mobile-max-width) {
      &.sdk > span.label,
      &.uploaded > span.label {
        display: none;
      }
    }
  }

  > tbody {
    font-size: 14px;

    .version {
      font-family: var(--pub-font-family-body);
      font-size: 24px;
    }
  }
}

.changelog-entry {
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid #c8c8ca;

  .changelog-version {
    border-bottom: none;
    margin: 0;
    width: 120px;
  }

  .changelog-content {
    flex-grow: 1;
    font-size: 14px;
    margin: 4px 0 4px 16px;
    width: 100%;
  }
}

.score-key-figures {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 20px 0 30px 0;

  @media (min-width: variables.$device-desktop-min-width) {
    padding: 40px 0 50px 0;
  }

  .score-key-figure-title {
    color: var(--pub-score_value-text-color);
    text-align: center;
  }

  .score-key-figure-value {
    font-family: var(--pub-font-family-body);
    font-size: 32px;
    line-height: 1;

    @media (min-width: variables.$device-desktop-min-width) {
      font-size: 64px;
    }
  }

  .score-key-figure-supplemental {
    font-family: var(--pub-font-family-body);
    font-size: 24px;
  }

  .score-key-figure-label {
    color: var(--pub-score_label-text-color);
    font-family: var(--pub-font-family-body);
    font-size: 14px;
    text-align: center;
    text-transform: uppercase;
  }
}

.pkg-report {
  border-bottom: 1px solid #c8c8ca;

  .pkg-report-section {
    border-top: 1px solid #c8c8ca;
    padding: 13px 0;
  }

  .pkg-report-header {
    display: flex;
    align-items: center;

    cursor: pointer;
  }

  .pkg-report-header-icon {
    display: flex;
    align-items: center;

    min-width: 40px;
    max-width: 40px;

    >.pkg-report-icon {
      width: 18px;
    }
  }

  .pkg-report-header-title {
    flex-grow: 1;
  }

  .pkg-report-header-title {
    font-family: var(--pub-font-family-body);
    font-size: 24px;
  }

  .pkg-report-header-score {
    display: flex;
    align-items: center;

    font-family: var(--pub-font-family-body);
    font-size: 22px;

    &.-is-red {
      color: var(--pub-report_header_score_error-text-color);
    }

    &.-is-yellow {
      color: var(--pub-report_header_score_warning-text-color);
    }

    .foldable-icon {
      margin-left: 18px;
      width: 12px;

      transform: rotate(180deg);
      transition: transform .3s linear;
    }
  }

  .foldable.-active {
    .foldable-icon {
      transform: rotate(360deg);
    }
  }


  .pkg-report-content {
    padding-left: 40px;

    .markdown-body {
      table {
        @media (min-width: variables.$device-desktop-min-width) {
          // Normally markdown-tables do use 100% width, but for
          // an unknown layout rule this is not doing it.
          // Forcing table to take the maximum available width,
          // but it won't scroll if overflown.
          display: table;
        }
      }
    }
  }

  .pkg-report-content-summary {
    margin: 12px 0;

    > h3 {
      position: relative;

      .report-summary-icon {
        position: absolute;
        right: 100%;
        top: 4px;
        width: 14px;
        height: 14px;
        margin-right: 6px;
      }
    }
  }
}

  .downloads-chart {
    display: flex;
    height: 700px;
    width: 100%;
    flex-direction: column;
    margin-top: 16px;
  }

  .downloads-chart-version-modes {
    float: right;

    @media (max-width: variables.$downloads-chart-display-max-width) {
      float: left;
    }
  }

  .downloads-chart-display-modes {
    float: left;
  }

  .downloads-chart-radio-button {
    display: flex;
    flex-direction: row;
    margin-left: 10px;

    @media (max-width: variables.$downloads-chart-radio-max-width) {
      display: flex;
      flex-direction: column;
    }
  }

  .downloads-chart-axis-line {
    fill:none;
    stroke-width: 1;
    stroke: var(--pub-downloads-chart-frame-color);
  }

  .downloads-chart-tooltip {
    border-radius: 5px;
    margin: 0px;
    padding: 2px 8px;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
    background-color:var(--pub-downloads-chart-tooltip-background);
    // opacity: 0.9;
    z-index: 100000;
    position: absolute;
    border: 0.5px solid var(--pub-downloads-chart-frame-color);
  }

  .downloads-chart-tooltip-square {
    display: flex;
    height: 12px;
    width: 12px;
    border: 1px solid;
    margin-right: 5px;
    margin-left: 5px;
  }
  .downloads-chart-tooltip-date {
    font-size: small;
    color:  var(--pub-score_label-text-color);;
  }
  .downloads-chart-tooltip-downloads {
    padding-right: 4px;
    padding-left: 10px;
  }

  .downloads-chart-tooltip-highlight {
    font-weight: bold;
    color:var(--pub-neutral-textColor);
  }


  .downloads-chart-tooltip-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    font-size: small;
    color: var(--pub-score_label-text-color);
    padding-right: 4px;
  }

  .downloads-chart-cursor {
    stroke: var(--pub-score_label-text-color);
    stroke-width: 1;
  }

  .downloads-chart-x-axis {
    fill: none;
    stroke-width: 1;
    stroke: var(--pub-score_label-text-color);
  }

  .downloads-chart-tick-label {
    fill: var(--pub-score_label-text-color);
    font-size: small;
  }

  .downloads-chart-tick-label-x {
    text-anchor: middle;
    @media (max-width: variables.$downloads-chart-label-max-width) {
      display: none;
    }
  }

  // These labels are not removed even if the screen gets smaller.
  .downloads-chart-anchored-tick-label-x {
    text-anchor: middle;
  }

  .downloads-chart-tick-label-y {
    dominant-baseline: middle;
  }

  .downloads-chart-legend {
    fill-opacity: 0.3;
    stroke-width: 1;
  }

  .downloads-chart-legend-label-highlight {
    fill:var(--pub-neutral-textColor);
    font-size: small;
    font-weight: bold;
  }

  .downloads-chart-fill-blue {
    fill:var(--pub-downloads-chart-color-0);
  }

  .downloads-chart-fill-red {
    fill:var(--pub-downloads-chart-color-1);
  }

  .downloads-chart-fill-green {
    fill:var(--pub-downloads-chart-color-2);
  }

  .downloads-chart-fill-purple {
    fill:var(--pub-downloads-chart-color-3);
  }

  .downloads-chart-fill-orange {
    fill:var(--pub-downloads-chart-color-4);
  }

  .downloads-chart-fill-turquoise {
    fill:var(--pub-downloads-chart-color-5);
  }

  .downloads-chart-square-blue {
    background-color:var(--pub-downloads-chart-color-bg-0);
    color:var(--pub-downloads-chart-color-0);
  }

  .downloads-chart-square-red {
    background-color:var(--pub-downloads-chart-color-bg-1);
    color: var(--pub-downloads-chart-color-1);
  }

  .downloads-chart-square-green {
    background-color:var(--pub-downloads-chart-color-bg-2);
    color: var(--pub-downloads-chart-color-2)
  }

  .downloads-chart-square-purple {
    background-color:var(--pub-downloads-chart-color-bg-3);
    color:var(--pub-downloads-chart-color-3);
  }

  .downloads-chart-square-orange {
    background-color:var(--pub-downloads-chart-color-bg-4);
    color:var(--pub-downloads-chart-color-4);
  }

  .downloads-chart-square-turquoise {
    background-color:var(--pub-downloads-chart-color-bg-5);
    color:var(--pub-downloads-chart-color-5);
  }

  .downloads-chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
  }

  .downloads-chart-line-faded {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    opacity: 0.3;
  }

  .downloads-chart-area {
    opacity: 0.3;
  }

  .downloads-chart-area-faded {
    opacity: 0.1;
  }

  .downloads-chart-stroke-blue {
    stroke: var(--pub-downloads-chart-color-0);
  }

  .downloads-chart-stroke-red {
    stroke: var(--pub-downloads-chart-color-1);
  }

  .downloads-chart-stroke-green {
    stroke: var(--pub-downloads-chart-color-2);
  }

  .downloads-chart-stroke-purple {
    stroke: var(--pub-downloads-chart-color-3);
  }

  .downloads-chart-stroke-orange {
    stroke: var(--pub-downloads-chart-color-4);
  }

  .downloads-chart-stroke-turquoise {
    stroke: var(--pub-downloads-chart-color-5);
  }

.pkg-page-title-copy {
  position: relative;
  display: inline-block;
  height: 20px;
  width: 20px;
  margin: 0px 12px;

  .pkg-page-title-copy-icon {
    display: block;
    width: 20px;
    height: 20px;
    cursor: pointer;

    // Lower contrast than the regular monochrome icon rules.
    --pub-monochrome-opacity-initial: 0.3;
    --pub-monochrome-opacity-hover: 0.7;
  }

  .pkg-page-title-copy-feedback {
    position: absolute;
    top: -12px;
    left: 32px;
    font-size: 11px;
    padding: 8px;
    background: var(--pub-copy_feedback-background-color);
    box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.05);
    white-space: nowrap;

    opacity: 1;
    display: none;
    transition: opacity variables.$copy-feedback-transition-opacity-delay;

    >.code {
      font-family: var(--pub-font-family-code);
      display: block;
    }

    &.visible {
      display: block;
    }

    &.fadeout {
      opacity: 0;
    }
  }
}

.tool-env-info {
  margin-top: 40px;
  font-size: 14px;
}

.detail-tab-license-content.markdown-body {
  .highlight {
    pre {
      // Most lines have 80 characters, better to scale down the font size
      // to keep everything visible at the same time.
      font-size: 50%;

      @media (min-width: variables.$device-desktop-min-width) {
        // On larger screens the above setting seems to be too small. The
        // vertical width scaling will roughly make the 80-character lines
        // fit the available width of the container.
        //
        // The scaling breaks down on smaller screens, keeping it for
        // desktop only.
        font-size: 1.0vw;
      }
    }
  }
}
