/* ORGANISATION CARD */

/* SITE CARD (S/M) */
.card.card--site {
  height: 100%;

  .badge-wrapper {
    flex-wrap: wrap;
  }
}

/* SITE MEMBERSHIP CARD (S/M) */
.cards-container#site-and-department-memberships {
  overflow-y: clip;
  max-height: unset;

  .card.site-membership-card-s {
    gap: 0;
    padding: 0.5rem;

    &[open] {
      background-color: var(--lightest-gray);
    }

    .card.department-membership-card-m {
      border-radius: 0;
      border-left: 1px solid var(--theme-color-darker);
      padding: 0.5rem;
    }
  }
}

/* USER CARD */
.card.card--user tooltip.permissions-preview {
  /* 3 Badges per row, gap between badges, tooltip padding */
  max-width: calc((2rem * 3) + (0.5rem * 2) + (1rem * 2));
}

/* NOTIFICATION CARD */
.notification-card {
  header.notification-header .notification-type {
    /*color: var(--theme-color-darker);*/
    /*border-left: 1px solid var(--light-gray);*/
    /*padding-left: 0.25rem;*/
  }

  &:has(input[type="checkbox"]:checked) {
    background-color: var(--lightest-gray);
    box-shadow: inset -1px 1px 4px rgba(128, 128, 128, 0.25);
  }
}

/* COMMENT CARD */
.card.comment-card {
  height: fit-content;

  &.new-comment {
    /* Temporary class added in addTemporaryNewCommentClass() */
    animation: fadeIn 0.5s ease-in-out;
    box-shadow: 0.25rem 0.25rem 0.25rem rgba(39, 153, 240, 0.25);
  }
}

/* REACTION CARD */
.cards-container#reactions {
  height: 19.5rem;

  .card.reaction-card.blended {
    padding: 0.5rem 0;

    header.reaction-card-header {
      gap: 0.5rem;

      .card-user-reaction {
        align-self: stretch;
        border-right: 1px solid var(--light-gray);
        display: inline-flex;
        justify-content: center;
        min-width: 4rem;
      }
    }
  }
}

/*Chat & Announcement List Card*/
.card.card__chat {
  max-height: 9rem;
  min-height: 9rem;

  &.card__chat--dashboard {
    max-height: unset;
    min-height: unset;

    &:not(:first-child) {
      border-top: 1px solid var(--light-gray);
      padding-top: 0.5rem;
    }
  }

  &.card__active {
    position: relative;
    border: 2px solid transparent;
    background-clip: padding-box;

    &::after {
      content: "";
      position: absolute;
      inset: -2px;
      z-index: -1;
      border-radius: var(--border-radius);
      background: linear-gradient(180deg, var(--theme-tenth-opacity-color), var(--theme-color-darker), var(--theme-tenth-opacity-color)),
        linear-gradient(-90deg, var(--theme-tenth-opacity-color), var(--theme-color-darker), var(--theme-tenth-opacity-color));
    }

  }

}

.card.card__chat,
.card.card__chat-announcement {
  box-shadow: none;
  gap: 0.5rem;
  height: fit-content;

 
  &.card__chat--unread .chat-last-message,
  &.card__chat-announcement--unread .announcement-last-message {
    color: var(--ink);
    font-weight: 600;
  }

  .chat-card-header,
  .announcement-card-header {
    gap: 0.5rem;
    min-height: 2rem;
  }

  .chat-card-header .chat-card-status {
    &:not(:has(.public-chat-heading)) {
      justify-content: flex-end;
    }
  }

  .chat-last-message,
  .announcement-last-message {
    color: var(--ink-gray);
    width: 100%
  }

  .chat-summary-details,
  .announcement-summary-details {
    align-items: flex-end;
    flex: 1;

    p {
      white-space: nowrap
    }

    ;
  }
}

/* CHAT AND ANNOUNCEMENT CARD */
.card.card__chat-announcement {
  border-bottom: 1px solid var(--yellow);
  border-radius: unset;
  max-height: 8rem;
  min-height: 8rem;

  header.announcement-card-header {

    /*2818: Remove after icon update*/
    svg {
      min-width: 0.875rem;
    }
  }

  &.card__chat-announcement--unread {
    #announcement-icon {
      fill: var(--yellow-darker)
    }

    h5 {
      color: var(--yellow-darker);
    }
  }

  &.card__active {
    border-bottom: 4px solid var(--yellow);
    box-shadow: 0.25rem 0.25rem 0.25rem rgba(39, 153, 240, 0.25);
  }
}

.card.card__chat-announcement.ryalto-branding {
  border-bottom: 1px solid var(--secondary-theme-color);

  &.card__chat-announcement--unread {
    #announcement-icon {
      fill: var(--secondary-theme-color)
    }

    h5 {
      color: var(--ink);
    }
  }

  &.card__active {
    border-bottom: 4px solid var(--secondary-theme-color);
    box-shadow: 0.25rem 0.25rem 0.25rem rgba(39, 153, 240, 0.25);
  }
}

.chat-card-heading-graphic {
  width: fit-content;

  .graphic-wrapper {
    align-items: center;
    border: 1px solid var(--light-gray);
    background-size: cover;
    display: inline-flex;
    justify-content: center;
    overflow: hidden;

    &.article-graphic-s {
      border-radius: var(--border-radius);

      img {
        aspect-ratio: 16 / 9;
      }

      &:has(.no-header-image) {
        aspect-ratio: 16 / 9;
        background-color: var(--light-gray);
        padding: 0.5rem;
        text-align: center;
      }

      &+.graphic-tooltip {
        width: var(--container-s);
      }
    }

    &.chat-graphic-s,
    &.chat-graphic-m {
      border-radius: 50%;

      img {
        aspect-ratio: 1;
      }
    }

    &.chat-graphic-s {
      height: 3rem;
      width: 3rem;

      &+.graphic-tooltip {
        width: var(--container-xs);
      }
    }

    &.chat-graphic-m {
      height: 4.5rem;
      width: 4.5rem;

      &+.graphic-tooltip {
        width: var(--container-s);
      }
    }
  }

  &:has(.graphic-tooltip) {
    position: relative;

    &:hover .graphic-tooltip {
      max-width: unset;
      opacity: 1;
    }

    .graphic-tooltip {
      background-color: var(--off-white);
      border: 1px solid var(--light-gray);
      border-radius: var(--border-radius);
      box-shadow: var(--gray-box-shadow);
      display: flex;
      height: auto;
      opacity: 0;
      position: absolute;
      max-width: 0;
      right: 0;
      top: 0;
      transform: translateX(calc(100% + 0.5rem));
      transition: 0.4s ease-in-out;

      img {
        border-radius: inherit;
      }
    }
  }
}

/* PUBLIC CHAT CARD */
.public-chat-card-m {
  max-height: 16.5rem;
  min-height: 16.5rem;

  .public-chat-card-header {
    gap: 1rem;
  }

  .public-chat-description {
    flex: 1;
    max-height: 5rem;
    /* Same as .input-m */
    overflow-y: scroll;
  }
}

/* TOPIC CARD */
.card.topic-card {
  height: fit-content;
}

.topic-card .topic-header .heading-wrapper counter {
  width: fit-content;
}

/* SURVEY CARD */
.card.survey-question-card {
  &[open]>.toggle-icon {
    transform: rotate(180deg);
  }

  header.card-header {
    h5 span {
      font-size: initial;
      font-weight: 600;
      margin-right: 0.5rem;
    }
  }

  section .preview-options-container {
    width: 100%;

    .preview-option:has(form) {
      align-items: flex-start;
      flex-direction: column;
    }

    .list-sm .preview-option:not(:last-child) {
      border-bottom: 1px solid var(--light-gray);
      padding-bottom: 0.5rem;
    }
  }
}

/* COLLAPSIBLE CARD (Faq card & survey question card)*/
.card.faq-card,
.card.survey-question-card,
.nested-card.faq-card {
  background-color: var(--light-gray);
  box-shadow: unset;
  gap: 0;
  padding: 0;

  header.card-header {
    padding: 0.5rem 1rem;
  }

  section.collapsible-section,
  section.nested-collapsible-section {
    background-color: var(--off-white);
    border-radius: 0 0 var(--border-radius) var(--border-radius);

    a:not(.btn) {
      text-decoration: underline;
      font-weight: var(--font-weight-semibold);
      color: var(--theme-color-lighter);
      transition: all 0.2s ease-in;

      &:hover {
        color: var(--theme-color-darker);
      }
    }
  }
}

/* AUDIENCE CARDS */
.cards-wrapper.wrapper-two:has(.card.whole-organisation-card) .card.whole-organisation-card {
  max-width: 100%;
  min-width: 100%;

  .card-header {
    gap: 0.5rem;
  }
}

.card.site-card-s {
  height: 100%;
  justify-content: center;
}

.card.whole-organisation-card,
.card.site-card-s,
.card.site-group-card,
.card.category-card {
  cursor: pointer;

  input[type="checkbox"] {
    display: none;
  }
}

.cards-container#site-cards-container {
  .card-wrapper#site_new_form {
    max-width: 0;
    min-width: 0;
    display: contents;
    opacity: 0;

    &:has(.form-wrapper) {
      display: inline-flex;
      max-width: calc(33.3% - 0.33rem);
      min-width: calc(33.3% - 0.33rem);
      opacity: 1;

    }
  }
}

/* CATEGORY SUMMARY CARDS */
.cards.category-summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 768px) {
  .cards.category-summary-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.card.category-summary-card {
  padding: 1.125rem;
  gap: 0;

  .category-summary-section__header {
    display: flex;
    gap: 0.875rem;
    align-items: center;
  }

  hr {
    border: none;
    border-top: 1px solid var(--theme-color);
    margin: 0.875rem 0;
  }
}

.category-summary-card .category-summary-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.category-summary-card .category-summary-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-summary-card .badge-with-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}