@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");
@import "_colors.css";

@page {
  @bottom-center {
    color: #6f7076;
    content: "Back Office Services - 75 Rue de la République, 69002 Lyon - Tél. : 04 27 11 83 97";
    font-family: "Poppins", sans-serif;
    font-size: 7.5pt;
  }

  @bottom-right {
    content: counter(page) " / " counter(pages);
    font-family: "Poppins", sans-serif;
    font-size: 7.5pt;
  }
}

html {
  font-size: 10pt;
}

main {
  color: #1b232b;

  &::before {
    display: none;
  }
}

header {
  h1 {
    font-weight: 600;
    margin-bottom: 0;
  }

  nav p {
    display: none;
  }
}

body {
  display: block;
  grid-template-areas: none;
  grid-template-columns: none;
  font-family: "Poppins", sans-serif;

  & > main {
    display: block;
    grid-template-columns: none;
    padding: 0;
    width: 100%;
  }

  & > * {
    padding: 0;
  }

  &::before {
    background: url(/static/images/logo.svg) 0 50% no-repeat;
    content: "";
    display: block;
    height: 2cm;
    margin-bottom: 1cm;
    width: 5cm;
  }

  > header,
  .subnav,
  > footer,
  #actions,
  form,
  section aside,
  nav {
    display: none;
  }

  > footer {
    dl,
    &.appointment-icon {
      display: none;

      &::before {
        display: none;
      }
    }
  }

  main > header {
    background: transparent;
  }

  h1 {
    font-size: 20pt;
    font-weight: 600;
  }

  h2 {
    font-weight: 600;
    font-size: 15pt;
  }

  &.privacy {
    .pii {
      background-color: currentColor;
    }
  }

  &.development {
    border: none;

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

main header {
  &.client-information,
  &.statistics-information {
    h2::before {
      content: none;
    }

    .statistics-web {
      display: none;
    }

    .statistics-print {
      display: block;

      /* Using an empty span element to avoid
       * a blank first page on the
       * global statistics page */
      #avoid-breaking-page {
        display: block;
        height: 1px;
        visibility: hidden;
      }
    }

    .statistics-cover {
      margin-top: 5cm;
      width: 100%;

      h1 {
        display: block;
        font-size: 30pt;
        font-weight: 600;

        &::after {
          content: none;
        }
      }

      h2 {
        font-weight: 500;
        margin-bottom: 0;
      }

      .details {
        background-color: var(--light);
        border-radius: 0.5em;
        display: block;
        margin-top: 1cm;
        padding: 0.5cm 0.5cm 0.5cm 1cm;

        dl {
          dd {
            width: auto;
          }

          dt {
            white-space: nowrap;
          }
        }

        h2 {
          font-size: 20pt;
          margin-top: 0;
        }
      }
    }
  }
}

table {
  font-size: 0.8em;

  tr {
    border-color: #c5d0db;
  }

  thead {
    color: #1b232b;

    tr {
      background: #eceff3;
      border: 0;
    }

    td, th {
      font-size: 0.9em;
      font-weight: 600;
    }
  }

  th, td {
    padding: 0.5em;
  }

  &.stats-table {
    /* Hide undesired visible gray border (Weasyprint rendering bug) */
    th {
      border-color: transparent;
    }

    tr td {
      border-right: 1px solid var(--border);
    }

    thead {
      tr:first-of-type {
        background: none;
      }

      &:not(:first-of-type) {
        font-size: 1.25rem;
      }

      /* Lighter headers when printing */
      &:first-of-type {
        tr th {
          background: #eceff3;
          border-right: 1px solid #eceff3;
          color: #1b232b;
        }
      }

      &.confidential {
        tr {
          /* Weasyprint tinycss2 does not support color-mix yet:
             https://github.com/Kozea/tinycss2/issues/65 */
          /* background: color-mix(in srgb, var(--alert), white 25%); */
          background: #fddad5;

          td {
            #show-confidential ~ #collapse-button,
            #show-confidential ~ #expand-button {
              display: none;
            }
          }
        }

        /* Input is not checked in PDF report but confidential statistics should
         * always be visible /*
        /* Global stats */
        &:has(input:not(:checked)) + tbody,
        /* Customer stats */
        &:has(input:not(:checked)) ~ thead,
        &:has(input:not(:checked)) + thead ~ tbody {
          visibility: visible;
        }
      }
    }

    dl {
      display: block;

      dt:after {
        content: "\A";
        white-space: pre-line;
      }
    }
  }
}

section.charts {
  flex-wrap: wrap;
}

object {
  margin: 0.5cm 0 0.25cm 0.25cm;
  width: 10cm;
}

[id^="side-"] {
  display: none;
}

dl {
  dt, dd {
    display: inline;
  }

  dt::after {
    content: " : ";
  }

  dd {
    margin-left: 0;
    width: 100%;

    &:after {
      content: "\A";
      white-space: pre-line;
    }
  }

  /* statistics report particularity */
  &.main-information {
    dt:last-of-type {
      margin-left: 0.25cm;
    }
  }
}

#svgFilterWrapper {
  display: none;
}

/* Intervention report */
main header {
  &.client-information {
    display: block;

    .actions,
    .view-print,
    .view-web {
      display: none;
    }

    .actions ~ dl {
      display: none;
    }
  }
}

.metrics,
.report-details {
  display: none;
}

.view-print {
  dl {
    display: block;
  }
}
