/* Settings modals */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
}

.modal.visible {
  display: flex;
}

.modal-content {
  position: relative;
  background-color: var(--color-surface);
  padding: var(--space-md);
  border-radius: 8px;
  max-width: 90%;
  width: 400px;
}

.modal--ng-source .modal-content {
  width: min(720px, 90vw);
  max-height: 85vh;
}

.ng-source-modal__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  height: 100%;
}

.ng-source-modal__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.ng-source-modal__headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.ng-source-modal__title {
  margin: 0;
  font-size: 1.25rem;
}

.ng-source-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background-color: #fff;
  color: var(--color-text);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ng-source-modal__close:hover {
  background-color: rgba(60, 79, 171, 0.08);
  color: var(--color-primary);
}

.ng-source-modal__actions {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 599px) {
  .ng-source-modal__actions {
    justify-content: flex-start;
  }
}

@media (min-width: 600px) {
  .ng-source-modal__header {
    align-items: stretch;
  }

  .ng-source-modal__headline {
    align-items: center;
  }
}

.ng-source-modal__button {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: none;
  background-color: var(--color-primary);
  color: #fff;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ng-source-modal__button:hover {
  background-color: #3c4fab;
}

.ng-source-modal__button--ghost {
  background-color: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.ng-source-modal__button--ghost:hover {
  background-color: rgba(60, 79, 171, 0.08);
}

.ng-source-modal__lists {
  flex: 1;
  display: grid;
  gap: var(--space-md);
  overflow-y: auto;
  padding-right: 4px;
}

@media (min-width: 768px) {
  .ng-source-modal__lists {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.ng-source-modal__section {
  background-color: #f8f9ff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-height: clamp(220px, 45vh, 360px);
  overflow: hidden;
}

.ng-source-modal__section--official {
  max-height: none;
  overflow: auto;
}

.ng-source-modal__section-title {
  margin: 0;
  font-size: 1rem;
  color: var(--color-primary);
}

.ng-source-modal__list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  overflow-y: auto;
  padding-right: 4px;
}

.ng-source-modal__list--nested {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.ng-source-modal__official-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.ng-source-modal__official-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: 6px;
  background-color: #fff;
  border: 1px solid #e1e5ff;
}

.ng-source-modal__official-group-title {
  margin: 0;
  font-size: 1rem;
  color: var(--color-primary);
}

.ng-source-modal__official-category {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.ng-source-modal__official-category-title {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text);
}

@media (max-width: 599px) {
  .ng-source-modal__section {
    max-height: clamp(200px, 50vh, 320px);
  }
}

.ng-source-modal__item {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-xs);
}

.ng-source-modal__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ng-source-modal__label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  color: var(--color-text);
}

.ng-source-modal__source {
  flex: 1;
  line-height: 1.5;
}

.ng-word-modal__form {
  margin-bottom: var(--space-md);
}

.ng-word-modal__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.ng-word-modal__section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.ng-word-modal__empty {
  margin: 0;
}

.ng-word-modal__list {
  max-height: 240px;
  overflow-y: auto;
}

.ng-word-modal__word {
  flex: 1 1 auto;
}

.ng-word-modal__submit {
  width: 100%;
}

@media (min-width: 576px) {
  .ng-word-modal__submit {
    width: auto;
  }
}
.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-dropdown {
  position: relative;
}

.header-dropdown__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.header-dropdown.is-open .header-dropdown__toggle {
  background: rgba(255, 255, 255, 0.18);
}

.header-dropdown__toggle:hover,
.header-dropdown__toggle:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  outline: none;
}

.header-dropdown__icon {
  font-size: 1rem;
}

.header-dropdown__text {
  font-weight: 600;
}

.header-dropdown__panel {
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  width: min(20rem, 90vw);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 0.75rem;
  box-shadow: 0 20px 45px rgba(16, 18, 27, 0.18);
  padding: 0.75rem 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
  z-index: 1100;
}

.header-dropdown__panel[aria-hidden='true'] {
  display: none;
}

.header-dropdown__list,
.header-dropdown__sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-dropdown__item + .header-dropdown__item {
  margin-top: 0.25rem;
}

.header-dropdown__link {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  color: inherit;
  text-decoration: none;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.header-dropdown__link:hover,
.header-dropdown__link:focus-visible {
  background-color: rgba(31, 27, 46, 0.08);
  color: inherit;
  outline: none;
}

.header-dropdown__link--button {
  font: inherit;
}

.header-dropdown__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 1rem;
  color: currentColor;
}

.header-dropdown__item-text {
  flex: 1;
}

.header-dropdown__item--group {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.header-dropdown__group-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.5);
  padding: 0 1rem 0.25rem;
}

.header-dropdown__subitem + .header-dropdown__subitem {
  margin-top: 0.25rem;
}

.header-dropdown__subitem .header-dropdown__link {
  padding-left: 1.5rem;
}

.header-dropdown__checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.header-dropdown__checkbox:hover,
.header-dropdown__checkbox:focus-within {
  background-color: rgba(31, 27, 46, 0.08);
}

.header-dropdown__checkbox-input {
  width: 1rem;
  height: 1rem;
  accent-color: #5a378c;
  order: 2;
  margin-left: auto;
}

.header-dropdown__checkbox-label {
  font-size: 0.95rem;
  cursor: pointer;
  flex: 1;
  order: 1;
}

.header-dropdown__checkbox .header-dropdown__item-icon {
  order: 0;
}

@media (max-width: 767.98px) {
  .page-header__actions {
    display: none;
  }

}
