@use './theme.data.scss' as data;
@use './theme.lib.scss' as lib;

.dropdown-option-widget {
  cursor: pointer;
  display: block;
  padding: data.$optionPadding;
  background-color: var(--theme-hack-bg2-color);

  &.cdk-focused,
  &:focus,
  &:active {
    outline: none;
  }
}

.button-widget {
  cursor: pointer;

  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;

  width: auto;
  padding: 0 10px;

  text-decoration: inherit;
  white-space: nowrap;

  background-color: inherit;
  border: none;
  border-radius: 3px;
  outline: none;

  transition:
    background 0.1s ease-out 0s,
    box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38) 0s;
  transition-duration: 0s, 0.15s;

  app-cmf-doodle-icon,
  app-cmf-icon {
    display: flex;
  }

  [disabled],
  &.disabled {
    pointer-events: none;
    user-select: none;
    color: var(--color-gray-888);
    background-color: var(--color-gray-eee);
  }
}

@include lib.buttons(data.$buttonsMap);

.button-widget-content {
  overflow: hidden;
  margin: 0 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[tabindex] {
  &:focus,
  &:active {
    outline: none;
  }
}

.cmf-inline-crud-caption {
  font-size: var(--caption-font-size);
  font-weight: var(--caption-font-weight);
}

div.tox .tox-pop__dialog {
  background-color: var(--color-gray-fff, #fff);
}

div.tox .tox-dialog {
  background-color: var(--theme-hack-bg2-color, var(--color-gray-fff, #fff));
}

div.tox .tox-label {
  color: var(--default-color);
}

div.tox .tox-dialog__popups .tox-tiered-menu .tox-collection__item-label {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;

  width: min-content;

  -webkit-line-clamp: 2;
}

div.tox .tox-dialog__footer,
div.tox .tox-dialog__header {
  color: var(--theme-hack-color, #222f3e);
  background-color: var(--theme-hack-bg2-color, var(--color-gray-fff, #fff));
}

div.tox .tox-pop.tox-pop--bottom::after {
  border-color: var(--color-gray-fff, #fff) transparent transparent transparent;
}

div.tox .tox-dialog__body-nav-item {
  color: var(--theme-hack-color, rgb(34 47 62 / 70%));
}

div.tox .tox-dialog-wrap__backdrop {
  background-color: var(--default-background-backdrop-overlay);
}

div.tox .tox-dialog__body .tox-dropzone {
  background-color: var(--theme-hack-bg2-color, var(--color-gray-fff, #fff));
}

div.tox .tox-dialog__body .tox-dropzone p {
  color: var(--theme-hack-color, rgb(34 47 62 / 70%));
}

div.tox .tox-listboxfield .tox-listbox--select:focus,
div.tox .tox-textarea:focus,
div.tox .tox-textfield:focus,
div.tox .tox-listboxfield .tox-listbox--select,
div.tox .tox-textarea,
div.tox .tox-textfield,
div.tox .tox-toolbar-textfield {
  font: var(--wiki-text-font);
  color: var(--user-content-color, var(--default-color));
  background: var(--color-gray-fff, #fff);
}

div.tox .tox-listbox__select-chevron svg {
  fill: var(--default-color);
}

body:not(:has(app-cmf-object-editor)) {
  div.tox .tox-pop .tox-toolbar__group:has(button[aria-label='Объединить ячейки']),
  div.tox .tox-pop .tox-toolbar__group:has(button[aria-label='Свойства таблицы']),
  div.tox .tox-pop .tox-toolbar__group:has(button[aria-label='Удалить строку']),
  div.tox .tox-pop .tox-toolbar__group:has(button[aria-label='Удалить столбец']) {
    display: none;
  }

  div.tox
    .tox-pop:has(button[aria-label='Объединить ячейки']):has(button[aria-label='Свойства таблицы']):has(
      button[aria-label='Удалить строку']
    ):has(button[aria-label='Удалить столбец']):not(:has(.tox-toolbar .tox-toolbar__group:nth-child(5))) {
    display: none;
  }
}
