@use "lib/viewport";

.before-topic-list-body-outlet.category-calendar {
  display: table-caption;
}

a.holiday {
  cursor: default;
}

.combo-box.user-timezone {
  min-width: 15em;
}

.grouped-event {
  background-color: var(--primary-low);
  border: 1px solid var(--primary-low-mid);
  color: var(--primary);
}

.group-timezones {
  display: grid;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1rem;

  &[data-size="auto"],
  &.auto {
    height: auto;
  }

  &[data-size="small"],
  &.small {
    height: 175px;
  }

  &[data-size="medium"],
  &.medium {
    height: 300px;
  }

  &[data-size="large"],
  &.large {
    height: 600px;
  }
}

.group-timezones-header {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5em;
  box-sizing: border-box;

  .title {
    font-weight: bold;
    text-transform: capitalize;
  }
}

.group-timezones-time-traveler {
  display: flex;
  align-items: center;

  .time {
    font-weight: 700;
    margin-right: 0.5em;
    min-width: 45px;
  }
}

.mobile-view .group-timezones-time-traveler,
.mobile-view .group-timezones-filter {
  display: none;
}

.discourse-group-timezones-slider-wrapper {
  // we need the wrapper because Firefox doesn't allow pseudo selectors on inputs
  position: relative;
  margin: 0.25em 0;
  margin-right: 0.5em;

  &::before {
    display: block;
    content: "";
    position: absolute;
    margin-top: -1px;
    background: var(--tertiary);
    height: 2px;
    top: 50%;
    width: 100%;
  }
}

.group-timezones-slider {
  position: relative;
  z-index: 1; // need a positive z-index to appear above the ::before
  display: flex;
  width: 120px;
  padding: 0.25em;
  appearance: none;
  cursor: pointer;
  font: inherit;
  outline: none;
  box-sizing: border-box;
  background-color: transparent;
}

.group-timezones-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  grid-template-rows: auto;
  grid-gap: 0.25em;
  box-sizing: border-box;
  overflow-y: auto;

  .group-timezones-header {
    .title {
      font-weight: 700;
    }
  }

  .group-timezone,
  .group-timezone-new-day {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 0.25em;
  }

  .group-timezone-new-day {
    align-items: center;
    justify-content: space-between;
    color: inherit;
    font-size: var(--font-down-1);

    .before {
      margin-right: auto;
      text-transform: capitalize;
    }

    .after {
      margin-left: auto;
      text-transform: capitalize;
    }
  }

  .group-timezone {
    color: var(--primary);
    background-color: var(--calendar-normal);
    transition: opacity 0.4s;
    opacity: 0.5;

    &:first-child {
      margin-left: 0;
    }

    &:last-child {
      margin-right: 0;
    }

    &.close-to-working-hours {
      background-color: var(--calendar-close-to-working-hours);
      opacity: 0.7;
    }

    &.in-working-hours {
      background-color: var(--calendar-in-working-hours);
      opacity: 1;
    }

    &:hover {
      opacity: 1;
    }

    .info {
      display: flex;
      flex-direction: row;
      align-items: center;

      .time {
        font-weight: 700;
      }

      .offset {
        font-size: var(--font-down-2);
        margin-left: 0.5em;
      }
    }

    .group-timezones-members {
      padding: 0;
      margin: 0.1em 0;

      .group-timezones-member {
        margin: 0.1em;
        list-style: none;
        display: inline-block;

        &.on-holiday {
          opacity: 0.7;
          position: relative;
        }

        &.on-holiday::after {
          content: "📅";
          position: absolute;
          bottom: -0.15em;
          left: 1em;
          font-size: var(--font-down-2);
        }
      }
    }
  }
}

.group-timezones-reset {
  display: flex;
  margin-left: 0.5em;
}

.group-timezones-filter[type="text"] {
  margin: 0;
  width: 120px;
}

.emoji.on-holiday {
  width: 15px;
  height: 15px;
}

.discourse-post-event-upcoming-events {
  height: 100%;
}

.discourse-calendar-wrap {
  border: 0;
  margin-inline: 3px;
  box-shadow:
    0 0 0 1px var(--primary-300),
    0 0 0 3px var(--primary-100);

  // Makes the outer drop shadow radius equal to --d-border-radius
  border-radius: calc(var(--d-border-radius) - (3px / 2));

  .fc th {
    font-weight: normal;
    text-align: center;
  }

  tr.fc-list-event td {
    padding: 0.25rem !important;
  }

  .fc td,
  .fc th {
    padding: 0 !important;
  }

  .post-calendar {
    .fc .fc-toolbar.fc-header-toolbar {
      margin: 0;
      padding: 0.25rem;
    }
  }
}

.fk-d-menu.discourse-post-event-more-menu-content {
  .mobile-view & {
    z-index: z("modal", "dropdown");
  }
}

.discourse-post-event-loader {
  width: 200px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
