/* /modules/integrations/css/chat_integrations.css */
.ms-chat {
  position: relative;
}

.ms-messages {
  position: relative;
}

.ms-ci-slot {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  min-height: 0;
  max-height: 0;
  transform: translateY(120%);
  overflow: hidden;
  overflow-anchor: none;
  transition: transform var(--ci-transition-ms, 500ms) linear;
  will-change: transform;
  z-index: 8;
}

.ms-ci-slot.is-visible {
    max-height: 120px;
    cursor: pointer;
    transform: translateY(0);
}

.ms-ci-slot.is-closing {
  max-height: var(--ci-close-height, 120px);
  pointer-events: none;
  transform: translateY(120%);
}

.ms-ci-slot.is-expanded {
    position: sticky;
    bottom: 0px;
    display: flex;
    flex-direction: column;
    width: -webkit-fill-available;
    height: fit-content;
    max-height: calc(100% - 14px);
    overflow: hidden;
    background: rgb(30 40 60 / 40%);
    border-radius: var(--br);
    padding: 8px;
    cursor: default;
    z-index: 60;
}

.ms-ci-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 100%;
    padding: 10px;
    border: var(--brd-box);
    border-radius: var(--br);
    background: var(--bg-box-modal);
}

.ms-ci-card.is-expanded {
  cursor: default;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  border: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}

.ms-ci-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.ms-ci-card-main.has-media {
  grid-template-columns: auto minmax(0, 1fr);
}

.ms-ci-card.is-expanded .ms-ci-card-main {
  align-items: start;
}

.ms-ci-media {
  width: 58px;
  height: 58px;
  border-radius: var(--br);
  overflow: hidden;
}

.ms-ci-media img,
.ms-ci-media video,
.ms-ci-gallery-item img,
.ms-ci-gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ms-ci-media--youtube {
  position: relative;
}

.ms-ci-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--br);
  background: rgba(0,0,0,.62);
  color: #fff;
  font-size: 10px;
  line-height: 1;
}

.ms-ci-content {
  min-width: 0;
}

.ms-ci-topic {
  font-size: 11px;
  line-height: 1.2;
  color: #7fb7ff;
  letter-spacing: 0;
}

.ms-ci-title {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: 0;
  color: #fff;
  overflow-wrap: anywhere;
}

.ms-ci-body {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255,255,255,.82);
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.ms-ci-slot:not(.is-expanded) .ms-ci-body {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ms-ci-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: var(--br);
  color: #fff;
  background: rgba(255,255,255,.07);
  cursor: pointer;
}

.ms-ci-close .ms-icon {
  width: 16px;
  height: 16px;
}

.ms-ci-full {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ms-ci-youtube {
  aspect-ratio: 16 / 9;
  width: min(500px, 100%);
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--br);
  background: #000;
}

.ms-ci-body .ms-ci-youtube,
.ms-ci-body .ms-ci-full-media {
  margin-top: 10px;
}

.ms-ci-youtube iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.ms-ci-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.ms-ci-gallery-item {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--br);
  background: rgba(255,255,255,.06);
}

.ms-ci-full-media {
  width: fit-content;
  max-width: min(500px, 100%);
  max-height: 400px;
  overflow: hidden;
  border-radius: var(--br);
}

.ms-ci-full-media img,
.ms-ci-full-media video {
  display: block;
  width: auto;
  max-width: min(500px, 100%);
  max-height: 400px;
  object-fit: contain;
}

.ms-ci-link {
  color: #7fb7ff;
  position: relative;
  z-index: 2;
}

.ms-ci-modal .ms-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70dvh;
  overflow-y: auto;
}

.ms-modal.ms-ci-modal {
  position: relative;
  max-height: min(920px, calc(100dvh - 28px));
  overflow: visible;
}

.ms-ci-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ms-ci-create-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ms-ci-create-head {
  padding: 4px 0 2px;
}

.ms-ci-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.ms-ci-form.is-opening {
    background: var(--bg-box-modal);
    border-radius: var(--br);
    box-shadow: var(--sh-sub);
    border: var(--brd-box);
    padding: 10px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-8px);
    transition: max-height .28s ease, opacity .24s ease, transform .28s ease;
}

.ms-ci-form.is-opening.is-open {
  max-height: 1300px;
  opacity: 1;
  overflow: visible;
  transform: translateY(0);
}

.ms-ci-add-center {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}

.ms-ci-create-head--split {
  justify-content: space-between;
  gap: 8px;
}

.ms-ci-add-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 180px;
}

.ms-ci-add-toggle .ms-icon {
  width: 18px;
  height: 18px;
}

.ms-ci-disabled-note {
  padding: 9px 10px;
  border-radius: var(--br);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.72);
  font-size: 13px;
  line-height: 1.35;
}

.ms-ci-loading {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255,255,255,.72);
  font-size: 13px;
}

.ms-ci-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.14);
  border-top-color: #2378dc;
  animation: ms-ci-spin .8s linear infinite;
}

@keyframes ms-ci-spin {
  to { transform: rotate(360deg); }
}

.ms-ci-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ms-ci-field > span {
  font-size: 12px;
  line-height: 1.2;
  color: rgba(255,255,255,.78);
}

.ms-int-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ms-int-root {
  position: relative;
  background: var(--bg-box-modal);
  border: var(--brd-box);
  border-radius: var(--br);
}

.ms-int-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 150px;
  max-height: 350px;
  overflow-y: auto;
  border: none;
  outline: none;
  padding: 10px 10px 0;
  border-radius: var(--br);
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: auto;
}

.ms-int-input:empty::before {
  content: attr(data-placeholder);
  opacity: .55;
  pointer-events: none;
}

.ms-int-tools-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 2px 10px;
  height: 30px;
}

.ms-int-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
}

.ms-int-tool-set {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ms-int-upload {
  position: relative;
}

.ms-int-btn {
  height: 24px;
  padding: 5px 0;
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.ms-int-btn svg,
.ms-int-btn .ms-icon {
  width: 22px;
  height: 22px;
  stroke: gray;
  transition: stroke .3s ease;
}

.ms-int-btn:hover svg,
.ms-int-btn:hover .ms-icon {
  stroke: rgb(35 150 255);
}

.ms-int-upload-menu {
  position: absolute;
  z-index: 10000;
  left: 0;
  bottom: calc(100%);
  min-width: 150px;
  padding: 8px;
  border-radius: var(--br);
  background: rgb(12 16 28 / 90%);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
}

.ms-int-upload-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--br);
  background: transparent;
  font-size: 12px;
  line-height: 1;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.ms-int-upload-menu__item:hover,
.ms-int-upload-menu__item:focus-visible {
  background: rgba(255,255,255,.10);
  color: #fff;
}

.ms-int-picker-panel {
    position: absolute;
    z-index: 9999;
    top: calc(100% + 0px);
    left: 0;
    width: min(355px, 95vw);
    max-width: 100%;
    height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--br);
    background: var(--bg-box-modal);
    border: var(--brd-box);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
    backdrop-filter: blur(2px);
    user-select: none;
}

.ms-int-picker-head {
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(12,16,28,.5);
}

.ms-int-picker-nav {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 3px;
  border-top: 1px solid rgba(255,255,255,.04);
}

.ms-int-picker-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
}

.ms-int-picker-sec {
  margin-bottom: 12px;
}

.ms-int-picker-sec__title {
  font-size: 12px;
  font-weight: 700;
  opacity: .8;
  margin-bottom: 8px;
}

.ms-int-picker-grid--emoji {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  justify-content: center;
  flex-direction: row;
}

.ms-int-picker-empty {
  padding: 8px;
  font-size: 13px;
  opacity: .7;
}

.ms-int-emoji-select {
  font-size: 18px;
  line-height: 1;
  text-align: center;
  padding: 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.ms-int-emoji-select:hover,
.ms-int-emoji-select:focus-visible {
  transform: scale(1.3);
  background: rgba(255,255,255,.08);
}

.ms-int-input .ms-int-inline-media {
  position: relative;
  display: inline-flex;
  max-width: min(220px, 100%);
  margin: 4px 4px 4px 0;
  vertical-align: middle;
}

.ms-int-inline-youtube__poster {
  position: relative;
  display: inline-flex;
}

.ms-int-inline-youtube .ms-ci-play {
  pointer-events: none;
}

.ms-int-inline-media__media {
  display: block;
  max-width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: var(--br);
}

.ms-ci-inline-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: var(--br);
  background: rgba(0,0,0,.54);
  color: #fff;
  cursor: pointer;
}

.ms-ci-inline-remove .ms-icon {
  width: 14px;
  height: 14px;
}

.ms-ci-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.ms-ci-attach {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 6px 28px 6px 6px;
  border-radius: var(--br);
  background: rgba(255,255,255,.06);
}

.ms-ci-attach-media {
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: var(--br);
  background: rgba(0,0,0,.22);
}

.ms-ci-attach-media img,
.ms-ci-attach-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ms-ci-attach-name {
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-ci-attach-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--br);
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
}

.ms-ci-attach-remove .ms-icon {
  width: 13px;
  height: 13px;
}

.ms-ci-limits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}

.ms-ci-limit {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: var(--brd-box);
    border-radius: var(--br);
    background: var(--bg-box-modal);
}

.ms-ci-limit.is-off {
  opacity: .5;
}

.ms-ci-limit-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: rgba(255,255,255,.84);
}

.ms-ci-limit input[type="number"] {
  width: 100%;
}

.ms-ci-total {
  padding: 8px 10px;
  border-radius: var(--br);
  background: rgba(35,120,220,.13);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.ms-ci-subtitle {
  margin-top: 4px;
}

.ms-ci-own-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ms-ci-own-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: -webkit-fill-available;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--br);
  background: var(--bg-box-modal);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .2s ease;
}

.ms-ci-own-row.has-media {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.ms-ci-own-row:hover {
  background: var(--bg-hover-menu);
}

.ms-ci-own-row.is-active {
  box-shadow: 0 0 0 1px rgba(64, 211, 132, .42);
}

.ms-ci-own-row.is-finished {
  box-shadow: 0 0 0 1px rgba(255, 98, 98, .42);
}
.ms-ci-own-row[data-ci-panel-source="viewed"],
.ms-ci-own-row[data-ci-panel-source="archive"] {
    box-shadow: var(--sh-btn);
}

.ms-ci-own-thumb {
  display: block;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: var(--br);
}

.ms-ci-own-thumb img,
.ms-ci-own-thumb video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ms-ci-own-row.is-new {
  animation: ms-ci-own-in .42s ease both;
}

@keyframes ms-ci-own-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ms-ci-own-row strong,
.ms-ci-own-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-ci-own-row span,
.ms-ci-own-stats,
.ms-ci-empty {
  font-size: 12px;
  color: rgba(255,255,255,.68);
}

.ms-ci-own-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.ms-ci-own-action {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.ms-ci-own-action.is-danger {
  color: #ff9c9c;
}

.ms-ci-archive-toggle {
  min-width: 110px;
}

.ms-ci-detail-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-radius: inherit;
  background: rgba(0,0,0,.58);
}

.ms-ci-detail-card {
  position: relative;
  width: min(680px, 100%);
  max-height: min(820px, calc(100dvh - 64px));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(35,120,220,.28);
  border-radius: var(--br);
  background: rgba(13, 24, 38, .98);
  box-shadow: 0 18px 44px rgba(0,0,0,.36);
}

.ms-ci-detail-body {
  font-size: 14px;
}

.ms-ci-panel-card {
    width: -webkit-fill-available;
    position: absolute;
}

.ms-ci-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: auto;
}

.ms-ci-panel-loading {
  min-height: 150px;
}

.ms-ci-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.ms-ci-topic-settings {
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
  margin-top: 2px;
  padding: 8px;
  border-radius: var(--br);
  background: rgba(255,255,255,.04);
}

.ms-ci-topic-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .ms-ci-slot.is-expanded {
    height: fit-content;
    max-height: calc(100% - 14px);
  }

  .ms-ci-card-main.has-media {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .ms-ci-media {
    width: 52px;
    height: 52px;
  }

  .ms-ci-limits,
  .ms-ci-own-row {
    grid-template-columns: 1fr;
  }

  .ms-ci-own-row.has-media {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .ms-ci-own-row.has-media .ms-ci-own-stats,
  .ms-ci-own-row.has-media .ms-ci-own-actions {
    grid-column: 2;
  }
}
