// See COPYRIGHT.md for copyright information

@import url("fonts.less");
@import url("colours.less");
@import url("common.less");

:root {
  --colour-bg: @colour-bg;
  --colour-highlight-1: @colour-highlight-1;
  --colour-highlight-2: @colour-highlight-2;
  --colour-highlight-3: @colour-highlight-3;
  --colour-highlight-4: @colour-highlight-4;
  --colour-highlight-5: @colour-highlight-5;
  --colour-highlight-default: @colour-highlight-default;
  --colour-linked-fact: @colour-linked-fact;
  --colour-primary-focus: @colour-primary-focus;
  --colour-primary: @colour-primary;
  --colour-secondary: @colour-secondary;
  --colour-related-fact: @colour-related-fact;
}

// To ensure highlighting takes place, !important is used to override inline styles.
// For example: overrides highlighting applied inline to alternate table rows.

.ixbrl-highlight {
  &:not(.ixbrl-no-highlight),
  & .ixbrl-sub-element:not(.ixbrl-no-highlight) {
      background-color: var(--colour-highlight-default) !important; // Override inline styles
  }

  &:not(.ixbrl-no-highlight).ixbrl-highlight-1, 
  &.ixbrl-highlight-1 .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    background-color: var(--colour-highlight-1) !important; // Override inline styles
  }

  &:not(.ixbrl-no-highlight).ixbrl-highlight-2,
  &.ixbrl-highlight-2 .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    background-color: var(--colour-highlight-2) !important; // Override inline styles
  }

  &:not(.ixbrl-no-highlight).ixbrl-highlight-3,
  &.ixbrl-highlight-3 .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    background-color: var(--colour-highlight-3) !important; // Override inline styles
  }

  &:not(.ixbrl-no-highlight).ixbrl-highlight-4,
  &.ixbrl-highlight-4 .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    background-color: var(--colour-highlight-4) !important; // Override inline styles
  }

  &:not(.ixbrl-no-highlight) .ixbrl-highlight-5,
  &.ixbrl-highlight-5 .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    background-color: var(--colour-highlight-5) !important; // Override inline styles
  }
}

.review.review-highlight-untagged-numbers .review-untagged-number {
  background-color: var(--colour-highlight-1);
}

.review.review-highlight-untagged-dates .review-untagged-date {
  background-color: var(--colour-highlight-2);
}

.review .ixbrl-highlight {
  &:not(.ixbrl-no-highlight).ixbrl-highlight-1, 
  &:not(.ixbrl-no-highlight).ixbrl-highlight-2, 
  &:not(.ixbrl-no-highlight).ixbrl-highlight-3, 
  &:not(.ixbrl-no-highlight).ixbrl-highlight-4, 
  &:not(.ixbrl-no-highlight).ixbrl-highlight-5, 
  &.ixbrl-highlight-1 .ixbrl-sub-element:not(.ixbrl-no-highlight),
  &.ixbrl-highlight-2 .ixbrl-sub-element:not(.ixbrl-no-highlight),
  &.ixbrl-highlight-3 .ixbrl-sub-element:not(.ixbrl-no-highlight),
  &.ixbrl-highlight-4 .ixbrl-sub-element:not(.ixbrl-no-highlight),
  &.ixbrl-highlight-5 .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    background-color: var(--colour-highlight-default) !important; // Override inline styles
  }

}

// Apply related fact highlighting (used for calc contributors)
.ixbrl-related {
  &:not(.ixbrl-no-highlight),
  .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    outline: solid 0.125em var(--colour-related-fact);
    outline-offset: 0.0625em;

    td&, th& {
      outline-offset: -0.0625em;
    }
  }
}

// Apply linked fact highlighting (used when hovering on facts in inspector)
.ixbrl-linked-highlight {
  &:not(.ixbrl-no-highlight),
  .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    outline: dashed 0.125em var(--colour-linked-fact);
    outline-offset: 0.0625em;

    td&, th& {
      outline-offset: -0.0625em;
    }
  }
}

// Apply dashed outline to iXBRL elements on hover
// Should override previous rule
.ixbrl-element:not(.ixbrl-no-highlight),
.ixbrl-sub-element:not(.ixbrl-no-highlight) {
  &:hover {
    outline: dashed 0.125em var(--colour-primary-focus);
    outline-offset: 0.0625em;
    cursor: pointer;

    td&, th& {
      outline-offset: -0.0625em;
    }
  }
}

// Apply solid outline to selected elements
.ixbrl-selected {
  &:not(.ixbrl-no-highlight),
  .ixbrl-sub-element:not(.ixbrl-no-highlight) {
    // This rule needs to override the previous one so that already selected
    // elements don't get a dashed line on hover
    &,
    &:hover {
      outline: solid 0.125em var(--colour-primary-focus);
      outline-offset: 0.0625em;

      td&, th& {
        outline-offset: -0.0625em;
      }
    }
  }
}

div.ixbrl-table-handle {
  @export-handle-size: 0.4rem;

  position: absolute;
  left: 0;
  cursor: pointer;
  width: 0;
  height: 0;
  border: @export-handle-size solid transparent;
  border-bottom-color: var(--colour-secondary);
  top: -2 * @export-handle-size;

  &::after {
    content: "";
    position: absolute;
    left: -@export-handle-size;
    top: @export-handle-size;
    width: 0;
    height: 0;
    border: @export-handle-size solid transparent;
    border-top-color: var(--colour-secondary);
  }

  & > span {
    display: none;
    white-space: nowrap;
  }

  &:hover {
    &::after {
      display: none;
    }

    border: none;
    color: var(--colour-bg);
    transition: width 0.3s;
    width: 9rem;
    height: initial;
    left: -0.1rem;
    padding: 0;
    z-index: 1;

    & > span {
      &::before {
        .icon-download();

        position: absolute;
        left: 0.8rem;
        font-size: 1.2rem;
      }

      border: solid 0.1rem var(--colour-bg);
      font-family: sans-serif;
      display: block;
      padding: 0.7rem 1.5rem 0.7rem 2.5rem;
      background-color: var(--colour-secondary);
    }
  }
}
