/* Calendrier */
.calendar-container {
  flex: 1 1 auto;
}

.calendar {
  position: relative;
  width: calc(100vw - var(--vtoolbar-w) - 25px);
  padding: 36px;
  background-color: #d9d9d9;
  margin: 0;
  display: grid;
  column-gap: 3px;
  row-gap: 3px;
  grid-template-columns: 1fr 8px 1fr 1fr 1fr 1fr 1fr;
  color: var(--calendar-color-1);
  font-family: Inter, sans-serif;
  font-weight: 300;
  font-size: 0.875rem;
  line-height: 1.35;
}

.calendar.equal {
  grid-template-columns: repeat(7, 1fr);
}

.day {
  position: relative;
  min-width: 100%; /* Egalisation de la largeur des colonnes */
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-content: flex-start;
  align-items: flex-start;
  background-color: #fff;
  /* background-color: #ccc; */
}

.day:has(.seance:not(.hidden)) {
  background-color: #f6f6f6;
}

.day:nth-last-child(-n + 7) .seance:last-child {
  padding-bottom: 128px;
}

.day.header {
  padding: 6px 2px;
  background-color: var(--cf-turquoise);
  /* background-color: #f6f6f6; */
  text-align: center;
  color: inherit;
  font-size: 1rem;
  font-weight: 500;
}

.day.header > span {
  flex: 0 0 100%;
  font-family: Quicksand;
  text-transform: uppercase;
  font-weight: 600;
}

.calendar:not(.equal) .day.header.closing-day > span {
  visibility: hidden;
}

.date {
  flex: 0 0 auto;
  display: inline-block;
  margin: 6px 0 6px 4px;
  border-bottom: solid 2px #666;
  padding: 0 0 1px 0;
  color: #666;
  font-weight: 500;
}

.day:has(.seance:not(.hidden)) .date {
  /* border-bottom-color: #147; */
  border-bottom-color: var(--calendar-color-1);
  color: var(--calendar-color-1);
}

#today {
  scroll-margin-top: var(--header-h);
}

.days-to {
  flex: 0 0 auto;
  margin: 6px 4px 6px 0;
  border-radius: 6px;
  font-family: "Inter Tight";
  font-weight: 500;
  display: none;
}

#today > .days-to {
  display: inline-block;
  border: solid 1px #147;
  padding: 0 4px 1px 4px;
  color: #f6f6f6;
  background-color: #147;
  font-size: 0.75rem;
}

.future > .days-to:has(+ .seances > .seance:not(.hidden)) {
  display: inline-block;
  padding: 0 8px 1px 8px;
  border: solid 1px #5a7c9e;
  color: #3e668f;
  font-size: 0.75rem;
}

.seances {
  flex: 0 0 100%;
  margin-top: 6px;
}

.no-seance {
  display: none;
}

/* Calendrier : seance */

.seance {
  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-content: stretch;
  cursor: pointer;
  transition: 0.1s;
}

.seance.hidden {
  display: none;
}

.seance.theorique {
  background-color: #dde;
}

.seance.detached {
  background-color: hsl(0, 40%, 60%);
}

.seance.detached:hover {
  background-color: hsl(0, 35%, 65%);
}

.seance.cancelled {
  color: #666 !important;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%25%22%20height%3D%22100%25%22%3E%3Cdefs%3E%3Cpattern%20id%3D%22pinstripe%22%20patternUnits%3D%22userSpaceOnUse%22%20width%3D%228%22%20height%3D%228%22%20patternTransform%3D%22rotate(45)%22%20%3E%3Cline%20x1%3D%224%22%20y%3D%220%22%20x2%3D%224%22%20y2%3D%228%22%20stroke%3D%22%23e0e0e0%22%20stroke-width%3D%224%22%20%2F%3E%3C%2Fpattern%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%23pinstripe)%22%20%2F%3E%3C%2Fsvg%3E") !important;
  margin: 2px 0;
}

.seance.cancelled:hover {
  background-color: inherit;
}

.seance.cancelled.gap-warning,
.seance.cancelled.gap2-warning {
  background-image: none;
}

.seance.cancelled *:not(svg, rect) {
  color: #666 !important;
  fill: #666 !important;
}

.seance.cancelled .salle {
  opacity: 0.75;
}

.seance.cancelled .tickets-container {
  background-color: #ccc;
}

.seance.cancelled .mention.mention-cancelled {
  color: #930 !important;
  font-weight: 500;
}

.seance.cancelled .fold-ctrl {
  background-color: #ccc;
  color: #666;
}

.zone_a {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-content: flex-start;
}

.heure {
  /* flex: 0 0 65%; */
  order: 0;
}

.salle {
  flex: 0 0 35%;
  order: 1;
  text-align: center;
}

.heure-fin {
  flex: 1 1 100%;
  color: #666;
  font-size: 0.688rem;
  order: 2;
  line-height: 1rem;
}

.heure-fin:before {
  content: "→";
}

.gap-warning {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%25%22%20height%3D%22100%25%22%3E%3Cdefs%3E%3Cpattern%20id%3D%22pinstripe%22%20patternUnits%3D%22userSpaceOnUse%22%20width%3D%228%22%20height%3D%228%22%20patternTransform%3D%22rotate(45)%22%20%3E%3Cline%20x1%3D%224%22%20y%3D%220%22%20x2%3D%224%22%20y2%3D%228%22%20stroke%3D%22%23f332%22%20stroke-width%3D%224%22%20%2F%3E%3C%2Fpattern%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%23pinstripe)%22%20%2F%3E%3C%2Fsvg%3E");
  margin: 2px 0;
}

.gap2-warning {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%25%22%20height%3D%22100%25%22%3E%3Cdefs%3E%3Cpattern%20id%3D%22pinstripe%22%20patternUnits%3D%22userSpaceOnUse%22%20width%3D%228%22%20height%3D%228%22%20patternTransform%3D%22rotate(45)%22%20%3E%3Cline%20x1%3D%224%22%20y%3D%220%22%20x2%3D%224%22%20y2%3D%228%22%20stroke%3D%22%23c3c2%22%20stroke-width%3D%224%22%20%2F%3E%3C%2Fpattern%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%23pinstripe)%22%20%2F%3E%3C%2Fsvg%3E");
  margin: 2px 0;
}

.gap {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  order: 3;
  color: #e33;
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 0.75rem;
}

.tickets-container {
  display: flex;
  position: relative;
  flex: 0 0 87%;
  height: 25px;
  margin-top: 6px;
  padding: 3px 0;
  order: 3;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  color: #454554;
  background-color: #bcbccc;
  visibility: hidden;
}

.tickets-container.visible {
  visibility: visible;
}

.tickets-container.validated {
  color: #494950;
  background-color: #a3a3cc;
}

.tickets {
  font-family: "Inter Tight";
  position: relative;
  flex: 0 0 auto;
  z-index: 2;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
}

.tickets-last-24h {
  position: absolute;
  top: 0;
  right: 2px;
  /* transform: translateY(-50%); */
  font-size: 0.6875rem;
  color: #353544;
  font-weight: 400;
}

.tickets-container.validated > .tickets::after {
  content: "";
  position: absolute;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  top: 50%;
  right: -12px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z" /></svg>')
    no-repeat center;
  background-size: contain;
  opacity: 0.65;
}

.zone_b {
  flex: 0 1 100%;
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-content: flex-start;
}

.seance.detached .zone_b {
  flex-direction: row;
  color: #fff;
  font-weight: 500;
}

.multi-rank {
  flex: 0 0 1rem;
  color: #666;
  font-size: 0.688rem;
  vertical-align: bottom;
  transform: translateY(1px);
}

.warning {
  flex: 0 0 1rem;
  transform: translateY(1px);
}

.cycle {
  flex: 1 0 calc(100% - 1rem);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sous-cycle {
  flex: 1 0 calc(100% - 1rem);
  font-size: 0.75rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.libelle-theorique {
  font-style: italic;
}

.items {
  display: block;
  flex: 1 0 calc(100% - 1rem);
}

.mention {
  flex: 1 1 auto;
  color: var(--calendar-color-2, #930);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Calendrier : item de séance */
.conf > .titre {
  color: var(--calendar-color-2, #930);
  font-weight: 500;
  white-space: normal;
}

.realisateur-annee {
  color: #666;
  font-size: 0.923em;
}

.copie {
  display: block;
  font-family: "Inter Tight";
  font-weight: 300;
  color: #666;
  font-size: 0.923em;
}

.fold-ctrl {
  position: relative;
  display: inline-block;
  line-height: 0.15rem;
  height: 0.15rem;
  border: none;
  background-color: var(--cf-turquoise-dark-1, #95b1c5);

  border-radius: 18px;
  vertical-align: middle;
  font-size: 0.75rem;
  color: #fff;
  padding: 6px 0 10px 0;
  box-sizing: border-box;
  overflow: hidden;
  width: 3.5rem;
  text-align: center;
  font-weight: 400;
  transition: 0.2s;
  cursor: pointer;
}

.fold-ctrl::before {
  font-size: 1rem;
  content: "⋯";
}

.open .fold-ctrl {
  background-color: var(--cf-turquoise-dark-2, #ddd);
}

label.open .fold-ctrl::before {
  content: "▴";
}

label:hover > .fold-ctrl {
  background-color: var(--cf-turquoise-dark-2, #158);
}

label.open:hover > .fold-ctrl {
  background-color: var(--cf-turquoise-dark-2, #ddd);
}

.fold {
  display: none;
}

.fold.open {
  display: block;
}

.film-surprise {
  padding: 6px 3px;
  background-color: hsl(289, 15%, 85%);
  transition: 0.1s;
}

.seance:hover .film-surprise {
  background-color: hsl(289, 15%, 95%);
}

.film-surprise-label {
  color: #712d86;
  font-weight: 500;
}

/* Media queries */

/* Largeur >= 1400px, sur 7 colonnes */
@media (min-width: 1400px) {
  .seance {
    padding: 6px 4px;
  }

  .seance .zone_a {
    flex: 0 0 8ch;
    margin: 0;
  }
}

/* Medium, 7 colonnes */
@media (min-width: 600px) and (max-width: 1399px) {
  .seance {
    flex-direction: column;
    padding: 6px;
  }

  .seance .zone_a {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .heure {
    flex: 0 0 auto;
    margin-right: 0.3rem;
  }

  .salle {
    flex: 0 0 auto;
  }

  .heure-fin {
    flex: 1 0 auto;
    text-align: right;
  }

  .gap {
    font-size: 0.688rem;
  }
}

/* Largeur < 600px : sur une colonne */
@media (max-width: 599px) {
  .calendar,
  .calendar.equal {
    grid-template-columns: 1fr;
    width: 100%;
    column-gap: 0;
    row-gap: 0;
    font-size: 1rem;
    padding-bottom: 128px;
  }

  .day {
    display: none;
  }

  .day.header {
    display: none;
  }

  .day:has(.seance:not(.hidden)) {
    /* display: block; */
    display: flex;
    background-color: transparent;
  }

  .day .date {
    font-size: 1.063rem;
    font-weight: 600;
    margin-left: 0;
  }

  .seance {
    padding: 8px 4px 8px 0;
  }

  .day:nth-last-child(-n + 7) .seance:last-child {
    padding-bottom: 0;
  }

  .seance .zone_a {
    flex: 0 1 11ch;
  }

  .sous-cycle {
    font-size: 0.875rem;
  }

  .heure-fin {
    font-size: 0.813rem;
  }
}

@media (max-width: 499px) {
  .salle {
    order: 1;
  }

  .heure-fin {
    flex: 1 1 100%;
    padding-left: 0;
    order: 2;
  }
}

@media (max-width: 299px) {
  .heure-fin {
    order: 1;
  }

  .salle {
    order: 2;
    text-align: left;
  }
}

/* Version imprimée */

@media print {
  @page {
    size: A3 portrait;
  }

  body > div > *:not(#workarea-container),
  #offcanvas,
  .tickets-container,
  .days-to,
  .cancelled,
  .detached {
    display: none !important;
  }

  #workarea-container {
    margin: 0 !important;
  }

  /* TODO: exempter aussi l'élément `label` */
  main *:not(.theorique) {
    background-color: transparent !important;
  }

  .calendar {
    font-size: 9pt;
    line-height: 11.5pt;
    grid-template-columns: 1fr 0fr 1fr 1fr 1fr 1fr 1fr;
    column-gap: 0;
    row-gap: 0;
  }

  .day {
    border-collapse: collapse;
    width: 0;
    border-bottom: solid 0.25pt #ccc;
  }

  .day:not(:nth-child(7n)) {
    border-right: solid 0.25pt #ccc;
  }

  .seances:not(:has(.seance:not(:is(.cancelled, .detached)))) {
    visibility: hidden;
    height: 0;
    margin: 0 !important;
  }

  .seance {
    padding: 2mm;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .seance:not(:last-child)::after {
    position: absolute;
    display: block;
    height: 0;
    width: 4mm;
    border: none;
    border-top: solid 0.25pt #ccc;
    content: "";
    bottom: 0;
    left: 0;
  }

  .fold-ctrl,
  .theorique,
  .gap-warning,
  .gap2-warning,
  .cancelled {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .seance .salle svg,
  .seance .salle svg * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .seance {
    padding: 2mm;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .gap-warning,
  .gap2-warning,
  .theorique,
  svg {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/*
@media print {
  @page {
    size: A3 portrait;
  }

  header {
    display: none !important;
  }

  aside {
    display: none;
  }

  #offcanvas {
    display: none;
  }

  .workarea-container {
    margin-left: 0 !important;
  }

  .container {
    margin: 0;
  }

  .fixed > .scrollable {
    overflow: visible;
  }

  .calendar {
    font-size: 9pt;
    line-height: 11.5pt;
    grid-template-columns: 1fr 0fr 1fr 1fr 1fr 1fr 1fr;
    column-gap: 0;
    row-gap: 0;
  }

  .day {
    border-collapse: collapse;
    width: 0;
    border-bottom: solid 0.25pt #ccc;
  }

  .label-today {
    display: none;
  }

  .item:not(.conf) > .titre {
    color: #036;
  }

  .day:not(:nth-child(7n)) {
    border-right: solid 0.25pt #ccc;
  }

  .seance {
    padding: 2mm;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .day:not(.header):not(:has(.seance:not(.cancelled))) {
    visibility: hidden;
    height: 0;
  }

  .seance:not(:last-child)::after {
    position: absolute;
    display: block;
    height: 0;
    width: 4mm;
    border: none;
    border-top: solid 0.25pt #ccc;
    content: "";
    bottom: 0;
    left: 0;
  }

  .days-to {
    display: none !important;
  }

  .gap-warning,
  .gap2-warning,
  .theorique,
  svg {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .closing-day {
    padding: 0;
    visibility: hidden;
  }

  .sous-cycle {
    font-size: 8pt;
    line-height: 9.5pt;
  }

  .passage {
    font-size: 8pt;
    line-height: 9.5pt;
  }

  .heure-fin {
    font-size: 8pt;
    line-height: 9.5pt;
  }

  .gap {
    font-size: 8pt;
    line-height: 9.5pt;
  }

  .item-ext {
    color: #999;
    font-size: 8pt;
    line-height: 9.5pt;
  }

  .fold-ctrl {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
*/
/* Ajout pour forcer le changement de layout */

/*
  .seance {
    flex-direction: column;
    padding: 6px;
  }

  .seance .zone_a {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .heure {
    flex: 0 0 auto;
    margin-right: 0.3rem;
  }

  .salle {
    flex: 0 0 auto;
  }

  .heure-fin {
    flex: 1 0 auto;
    text-align: right;
  }
}
*/

/* Autres */
@media (hover: hover) and (pointer: fine) {
  .seance:hover {
    background-color: var(--cf-turquoise-light-1, #fff);
    /* background-color: #fff; */
  }

  .seance.theorique:hover {
    background-color: #e7e7f3;
  }
}

.js .calendar:not(.calendar-ready) {
  visibility: hidden;
}

.calendar .day.past > :not(.date) {
  display: none;
}

.calendar .day.past-week {
  display: none;
}

.calendar .day.past {
  background-color: #fff;
}

.calendar .day.past .date {
  color: #ccc;
  border-color: #ddd;
}
