.calendar {
  align-self: center;
  max-width: 36rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3rem;
}

.calendar-bottom {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.calendar-month-select {
  opacity: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  overflow: hidden;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 0;
  background: #fff;
  z-index: 3;
  box-shadow: 0px 0px;
  @include transition-std;

  &.active {
    padding: 3rem;
    height: 37rem;
    box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.25);
    @include transition-std;
    opacity: 1;
  }

  span {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.8rem;
    border: 0.1rem solid rgba(0, 0, 0, 0.25);
    background: #fff;
    @include transition-std;

    &.active {
      background: $base-green;
      color: #fff;
      cursor: pointer;
      @include transition-std;
    }
  }
}

.calendar-top {
  width: 100%;
  font-size: 2.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;

  h4 {
    text-align: center;
  }

  span {
    cursor: pointer;
  }
}

.calendar-prev,
.calendar-next {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  img {
    pointer-events: none;
  }
}

.calendar-table {
  tbody {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }
  th {
    color: $base-green;
  }
  tr {
    pointer-events: none;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    justify-content: space-between;
    gap: 2rem;

    * {
      font-size: 1.8rem;
    }
  }

  td {
    position: relative;
    pointer-events: all;
    @include transition-std;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem;
    cursor: pointer;
    min-width: 3.2rem;
    min-height: 3.2rem;
    border-radius: 50%;
    pointer-events: all;
    background: transparent;

    &.active {
      background: #e53131;
      color: white;
      @include transition-std;
    }

    &.selected {
      background: $base-green;
      color: white;
      @include transition-std;

      .event {
        padding: 2.4rem;
        opacity: 1;
        width: 24.3rem;
        min-height: 13rem;
        height: fit-content;
        @include transition-std;
        z-index: 5;
      }
    }

    span {
      pointer-events: none;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .event {
      pointer-events: all;
      position: absolute;
      overflow: visible;
      opacity: 0;
      width: 0;
      height: 0;
      background: $base-green;
      left: -10rem;
      bottom: calc(100% + 1.4rem);
      padding: 0;
      border-radius: 1rem;
      @include transition-std;

      .sharp {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        position: absolute;
        bottom: -1.4rem;
        left: 43%;

        img {
          width: 0.8rem;
          height: 0.8rem;
        }
      }
    }
  }
}

.calendar-return {
  width: 100%;
  @include button-std(0, 1.4rem, true);
}

// Adaptive

@media screen and (max-width: 1200px) {
  .calendar {
    max-width: 60rem;
    width: 100%;
  }
  .calendar-table {
    td {
      width: 3.2rem;
      height: 3.2rem;
      justify-self: center;
      align-self: center;
    }
  }
  .calendar-bottom {
    width: 100%;
  }
}

@media screen and (max-width: 800px) {
  .calendars {
    gap: 5rem;
    padding: 2.4rem 0;
  }
  .calendar-table {
    td {
      width: 1rem;
      height: 1rem;
    }
    span {
      font-size: 1.6rem;
    }
  }
  .calendar-table tr {
    gap: 0.4rem;
  }
  .calendar-table td.selected .event {
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 18.3rem;
    left: -230%;
  }
  .calendars-right {
    padding: 0 4rem;
  }
}

@media screen and (max-width: 400px) {
  .calendars-right {
    padding: 0 3rem;
  }
}
