@use "../../wc";

.content-block {
  background-color: var(--zn-note-background, rgba(var(--zn-panel), var(--zn-panel-opacity)));
  border-bottom: 1px solid rgb(var(--zn-border-color));
  padding-inline: calc(var(--zn-gutter, 0) + var(--zn-base-gap, 0));
}

.content-block-header {
  display: flex;
  align-items: center;
  gap: var(--zn-spacing-small);
  width: 100%;
  max-width: 100%;
  padding-block: var(--zn-spacing-small);
  position: relative;
}

.content-block--collapsible .content-block-header {
  cursor: pointer;
}

.content-block-header__icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.content-block-header__main {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--zn-spacing-small);
  min-width: 0;
  flex-grow: 1;
  overflow: hidden;
}

.content-block-header__caption {
  font-weight: var(--zn-text-h1-font-weight);
  font-size: var(--zn-text-h1-font-size);
  color: rgba(var(--zn-text-panel-title), 100%);
  line-height: var(--zn-icon-size, 20px);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--zn-spacing-small);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.content-block-header__subject {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--zn-font-size-medium);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;

  &--empty {
    opacity: 0.5;
  }
}

.content-block-header__description {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--zn-font-size-medium);
  color: rgb(var(--zn-text-muted));
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: none;
}

.content-block-header__attachments {
  display: inline-flex;
  align-items: center;
  gap: var(--zn-spacing-2x-small);
  font-size: var(--zn-font-size-small);
  color: rgb(var(--zn-text-muted));
  flex-shrink: 0;
  margin-left: auto;
}

.content-block-header__actions {
  display: flex;
  align-items: center;
  gap: var(--zn-spacing-small);
  margin-left: auto;
  flex-shrink: 0;
}

.content-block__attachments {
  display: none;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--zn-spacing-small);
  padding-block-end: var(--zn-spacing-small);

  &--visible {
    display: flex;
  }

  ::slotted(zn-chat-message-attachment) {
    min-width: 0;
  }
}

.content-block--short {
  zn-sp, .content-block__attachments {
    display: none;
  }

  .content-block-header__description {
    display: block;

    @include wc.container-query(null, ph) {
      display: none;
    }
  }
}

.text-section {
  @include wc.text-style(paragraph);

  a {
    font-size: var(--zn-font-size-small);
    opacity: 0.8;
  }
}

.hidden {
  display: none;
}

ol {
  counter-reset: list-0 0;
}

@supports (counter-set:none) {
  ol li, ul li {
    counter-set: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;
  }
}

ol, ul {
  padding: 0;
  margin: 0;
}

li[data-list=checked] > .ql-ui, li[data-list=unchecked] > .ql-ui {
  color: #777;
}

li {
  list-style-type: none;
  position: relative;
}

ul > li::before {
  content: "•";
}

ol > li {
  counter-increment: list-0;
}

ol > li::before {
  content: counter(list-0) ". ";
}

/* Checkbox list markers */
li[data-list="checked"]::before {
  content: "☑";
}

li[data-list="unchecked"]::before {
  content: "☐";
}

li[data-list="checked"]::before,
li[data-list="unchecked"]::before {
  color: #777;
}

ol li::before,
ul li::before {
  display: inline-block;
  margin-left: -1.5em;
  margin-right: 0.3em;
  text-align: right;
  white-space: nowrap;
  width: 1.2em;
}

li:has(> .ql-ui)::before {
  content: none;
  display: none;
}
