.add-event-modal {
  .d-modal__container {
    max-width: 630px;
  }
  .d-modal__body {
    padding: 20px;
  }

  .modal-footer .clear {
    margin: 5px 10px;
  }
}

.add-event {
  text-align: left;

  &.no-text {
    width: 35px;
  }

  .dot {
    padding: 0 4px;
  }
}

.add-event,
.add-event + button {
  border: 1px solid var(--primary-300);
}

.form-element + span {
  display: block;
}

.event-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background-color: var(--primary-100);
  padding: 0.25em 0.5em;
  min-height: 30px;
  box-sizing: border-box;

  .d-icon {
    font-size: var(--font-down-1);
    margin-bottom: 1px;
  }
}

.event-details {
  display: flex;
  flex-flow: wrap;
  margin-top: 0.5em;
  gap: 0.5em;
}

.add-to-calendar {
  position: relative;
  display: inline-block;

  .dropdown-header {
    padding: 0.25em 0.5em;
    height: 30px;
    box-sizing: border-box;
    background-color: var(--primary-100);
  }

  .dropdown-menu {
    top: 25px;
    bottom: initial;
    width: 190px;
    position: absolute;
    display: none;
    background-color: var(--secondary);
    z-index: 100;
    box-shadow: var(--shadow-dropdown);
    border-top: 1px solid var(--primary-very-low);

    &.show {
      display: block;
    }

    ul {
      list-style: none;
      margin: 0;

      li {
        padding: 10px;
        cursor: pointer;

        &:hover {
          background-color: var(--primary-low);
        }
      }
    }
  }
}

.events-calendar-navigation {
  display: inline-flex;
  max-width: 100%;
  gap: 0.5em;
}

.events-calendar-subscription-links {
  display: flex;
  margin-left: auto;
  gap: 0.5em;
}

.select-kit.events-calendar-subscription {
  margin-left: auto;

  .select-kit-body {
    .events-calendar-subscription-warning {
      padding: 6px 16px;
      background-color: rgba(255, 247, 78, 0.32);
      font-size: 1.1em;

      .fa.d-icon {
        margin-right: 6px;
      }
    }

    .select-kit-collection {
      overflow: unset;
      padding: 0.5em;
    }

    li.events-calendar-subscription-row {
      display: flex;
      position: relative;
      padding: unset;

      &:not(:first-of-type) {
        margin-top: 0.5em;
      }

      &.is-highlighted {
        background-color: initial;
      }

      span {
        text-align: center;
        width: 50px;
        flex: initial;
      }

      input {
        flex: 1;
        margin: 0;
        background: var(--primary-very-low);
        border: var(--primary-low);
      }

      .copied {
        position: absolute;
        left: -65px;
        padding: 0.3em 0.5em;
        background: var(--success);
        color: var(--secondary);
        border: 1px solid var(--primary-low);
      }
    }
  }
}

.select-kit.month-dropdown,
.select-kit.year-dropdown {
  width: 150px;
  min-width: 150px;
}

.events-calendar .header {
  display: flex;
}

.events-calendar.responsive {
  .month-dropdown {
    min-width: 120px;
  }

  .year-dropdown {
    min-width: 60px;
  }

  .month-dropdown,
  .year-dropdown {
    &:not(.is-expanded) .select-kit-header {
      width: inherit;
    }

    .d-icon {
      display: none;
    }
  }

  .select-kit.events-calendar-subscription {
    .select-kit-collection {
      li {
        .copied {
          left: unset;
          top: -35px;
        }
      }
    }
  }

  .events-calendar-body {
    margin-top: 10px;
    text-align: center;

    .weekday {
      height: 15px;
      line-height: 15px;

      span {
        padding: 0 2px;
      }
    }

    .day {
      height: 38px;
      cursor: pointer;
      position: relative;

      .header {
        text-align: center;
        margin-top: 2px;
      }

      .date label {
        cursor: pointer;
        display: inline-block;
        height: 19px;
        width: 19px;
        margin: 0;
      }

      .has-events {
        position: absolute;
        bottom: 2px;
        width: 100%;
      }
    }
  }
}

.events-calendar-body {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 15px;
  border-bottom: 1px solid var(--primary-medium);
  border-left: 1px solid var(--primary-medium);
  box-sizing: border-box;

  .day,
  .weekday {
    width: calc(99.9999% / 7);
    border-top: 1px solid var(--primary-medium);
    border-right: 1px solid var(--primary-medium);
    box-sizing: border-box;
  }

  .weekday {
    height: 23px;
    line-height: 23px;

    span {
      padding: 0 4px;
    }
  }

  .day {
    height: 130px;
    transition: all 0.2s;
    position: relative;

    .container {
      background-color: var(--primary-secondary);
    }

    &.today .container {
      background-color: var(--highlight-low);
      height: 100%;
    }

    &.different-month .container {
      background-color: rgba(var(--primary-low), 0.5);
      color: rgba(var(--primary), 0.5);
      height: 100%;
    }

    &.selected .date label {
      background-color: var(--tertiary);
      color: var(--secondary);
      border-radius: 50%;
    }

    &.expanded .container {
      position: absolute;
      z-index: 100;
      height: auto;
      width: auto;
      min-width: 100%;
      overflow: visible;
      border: 1px solid var(--primary-low);
      box-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
      background-color: var(--secondary);

      .events {
        padding: 3px 4px;

        li {
          height: 25px;
          line-height: 25px;

          &.empty {
            display: none;
          }
        }
      }
    }

    .header {
      position: relative;
    }

    .date label {
      margin: 2px;
      padding: 2px 3px;
      margin-bottom: 0;
    }

    .close {
      position: absolute;
      right: 3px;
      top: -3px;

      .d-icon {
        color: var(--primary);
      }
    }

    .hidden-events {
      padding-left: 7px;

      .btn {
        padding: 2px 4px;
      }
    }

    .has-events {
      font-size: 7px;
    }
  }
}

ul.events-calendar-events {
  margin: 0;
  list-style: none;

  li {
    position: relative;
    margin: 1px 0;

    .fk-d-tooltip__trigger,
    .fk-d-tooltip__trigger-container {
      width: 100%;
      height: 20px;
      vertical-align: top;
    }

    .event {
      padding: 0 7px;
      width: 100%;
      height: inherit;
      line-height: 18px;
      border-top: 1px solid transparent;
      border-bottom: 1px solid transparent;
      box-sizing: border-box;
      white-space: nowrap;
      overflow: hidden;
      cursor: pointer;
      display: block;
      color: var(--primary);

      span {
        font-size: 0.9em;
      }

      .fa-circle {
        color: inherit;
        font-size: 0.8em;
      }

      &.all-day {
        background-color: var(--primary-tertiary);
        color: var(--secondary);
        border-top: 1px solid var(--primary-low);
        border-bottom: 1px solid var(--primary-low);

        &:not(.full-width) {
          &.start {
            margin-left: 4px;
            border-radius: 4px 0 0 4px;
          }

          &.multi span.title {
            position: absolute;
            z-index: 1;
            overflow: hidden;
            text-overflow: ellipsis;
          }

          &.start span.time {
            margin-right: 5px;
            float: left;
          }

          &.end {
            margin-right: 4px;
            border-radius: 0 4px 4px 0;
          }
        }
      }

      img.emoji {
        height: 15px;
        width: 15px;
      }
    }
  }
}

.events-calendar-card {
  padding: 0.5em;

  .topic-link {
    font-size: 1.3em;
    color: var(--primary);

    p {
      margin: 0;
    }
  }

  .topic-meta {
    margin-top: 6px;
    width: 100%;
    display: flex;
    flex-flow: wrap;
    align-items: center;
  }

  .topic-event {
    margin-top: 6px;
    width: 100%;
    display: inline-block;
    cursor: pointer;
    color: var(--primary);
    .deadline {
      display: inline-block;
      svg {
        margin-right: 0.3em;
      }
      svg:nth-of-type(2) {
        margin-left: 0.6em;
      }
    }
  }

  .topic-excerpt {
    margin-top: 6px;
    cursor: pointer;
    line-height: 1.4;
    width: 100%;
    word-wrap: break-word;
    color: var(--primary);
    display: inline-block;

    p {
      margin: 0;
    }
  }
}

.events-calendar-day-hidden {
  ul.events-calendar-events {
    li {
      margin: 0.5em 0;

      a {
        box-sizing: border-box;
      }
    }
  }
}

.events-below {
  margin-top: 8px;
  margin-bottom: 15px;

  ul.events-calendar-events li {
    height: auto;
    line-height: 20px;
    margin: 5px 0;
    white-space: normal;

    &.empty {
      display: none;
    }

    img.emoji {
      height: 20px;
      width: 20px;
    }
  }
}

.edit-category-modal .enable-events .min-trust input {
  width: 60px;
}

.event-rsvp {
  display: flex;
  align-items: center;
  gap: 0.5em;

  .spinner {
    width: 3px;
    height: 3px;
    margin-right: 8px;
  }

  .event-rsvp-dropdown.select-kit.single-select.dropdown-select-box {
    .select-kit-row .texts .name {
      font-weight: normal;
    }
  }
}

.event-rsvp-modal {
  overflow: hidden;

  .header {
    display: flex;

    .types {
      padding: 0;
      margin: 0;
      flex: 1;
    }

    .filter {
      align-self: flex-start;
      padding-bottom: 15px;
      border-bottom: 1px solid var(--primary-low);

      input {
        width: 150px;
        min-height: 25px;
      }
    }
  }

  .list {
    height: 300px;
    position: relative;
    overflow: scroll;

    .spinner {
      position: absolute;
      left: calc(50% - 10px);
      top: calc(50% - 10px);
    }

    ul {
      list-style: none;
      margin: 0;

      li {
        padding: 10px 15px;
        border-bottom: 1px solid var(--primary-low);

        .user-info {
          margin-bottom: 0;
          position: relative;
          width: 100%;

          .details {
            position: absolute;
            right: 20px;
            top: 10px;
          }
        }
      }
    }
  }
}

.topic-list {
  .topic-list-item-event {
    margin-top: 0.25em;
    font-size: var(--font-down-2);
    display: flex;
    flex-flow: wrap;
    gap: 0.5em;
  }

  .topic-list-item-event-time {
    .event-label {
      padding: 0em 0.75em;
      min-height: 25px;
    }
  }

  .topic-list-item-event-rsvp {
    font-size: 0.9em;
    margin-top: 4px;
  }
}

.add-event-controls {
  display: flex;
  align-items: center;

  .add-event span svg:nth-of-type(2) {
    margin-left: 0.6em;
  }
}

.composer-controls-event {
  position: relative;
  margin-left: 8px;
  margin-bottom: 8px;

  .popup-tip {
    left: 0;
    right: initial;
    min-width: 300px;
  }

  .btn {
    border-color: var(--primary-400);
    background-color: unset;
    color: var(--primary-high);
  }

  .d-icon {
    color: var(--primary-high);
    font-size: var(--font-down-1);
  }
}

.events-webcal-api {
  margin: 0 0 5px;
}

.webcal-label {
  font-weight: bold;
}

.webcal-notice {
  font-weight: bold;
}

ul.events-webcal-notices {
  float: right;
  margin: 10px 0;
  li {
    font-style: italic;
  }
}

.topic-event-label {
  display: flex;
  gap: 0.5em;

  button {
    background-color: var(--primary-100);
    padding: 0.25em 0.5em;
    height: 30px;
  }
}

.events-subscription-badge {
  &.subscribed {
    background-color: var(--success);
  }
}
