.toplevel_page_filter_ai > .wp-menu-image:before {
  content: '';
  display: block;
  mask: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc5MycgaGVpZ2h0PScxNjInIHZpZXdCb3g9JzAgMCA5MyAxNjInIGZpbGw9J25vbmUnPjxwYXRoIGQ9J00xNCAxMjJIMFYzN0g1NFY1MUgxNFY3M0g0OFY4NkgxNFYxMjJaJyBmaWxsPSdjdXJyZW50Q29sb3InLz48cGF0aCBkPSdNMCAxNjJWMTUwSDU0VjE2MkgwWicgZmlsbD0nY3VycmVudENvbG9yJy8+PHBhdGggZD0nTTg1IDBMODIuNDggNS41TDc3IDhMODIuNDggMTAuNTJMODUgMTZMODcuNSAxMC41Mkw5MyA4TDg3LjUgNS41TTY1IDZMNjAgMTdMNDkgMjJMNjAgMjdMNjUgMzhMNzAgMjdMODEgMjJMNzAgMTdNODUgMjhMODIuNDggMzMuNDhMNzcgMzZMODIuNDggMzguNUw4NSA0NEw4Ny41IDM4LjVMOTMgMzZMODcuNSAzMy40OCcgZmlsbD0nY3VycmVudENvbG9yJy8+PC9zdmc+')
    no-repeat 50% 50%;
  mask-size: 70% auto;
  background-color: currentColor;
  margin: 0 auto;
  transform: translateX(2px);
}

.filter-ai-settings {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.filter-ai-settings .components-button.is-secondary.has-icon > svg {
  margin-left: -2px;
  margin-right: -10px;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

.filter-ai-settings-header {
  background-color: #003f79;
  background-image: url('../assets/blue-bg.png');
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-position: center right;
  border-bottom: 1px solid #e0e0e0;
  padding: 24px 16px 24px 18px;
  margin: -10px -20px 0 -22px;
  position: sticky;
  top: 32px;
  z-index: 1;
  flex-shrink: 0;
  color: #fff;

  & h1,
  & p {
    margin: 0;
    padding: 0;
    color: #fff;
  }

  & h1 {
    font-size: 20px;
    line-height: 40px;
    font-weight: 500;
  }

  & p {
    font-size: 13px;
    line-height: 20px;
  }

  & img {
    width: 40px;
    height: 40px;
  }

  & .filter-ai-settings-header-content {
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 24px;
  }

  & #leadin-disconnected-banner {
    display: none;
  }

  &:has(.nav-tab-wrapper) {
    padding-bottom: 0;
  }

  & .nav-tab-wrapper {
    padding-top: 24px;
    border-bottom: 0;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    gap: 8px;
  }

  & .nav-tab {
    margin: 0;
    background: transparent;
    color: #fff;
    border: 0;
    /* Reserve the active underline's 2px on every tab (transparent on
       inactive). Without this, WP core's 50ms `border` transition on <a> tags
       animates the border-bottom width between 0 and 2px when switching tabs,
       causing a brief 1px row-height drop at the transition midpoint. With the
       width reserved, only the colour transitions — layout stays put. */
    border-bottom: 2px solid transparent;
    font-size: 15px;
    line-height: 20px;
    font-weight: 500;
    padding: 12px 16px;

    /* Suppress the sticky blue focus ring after a click — the underline on
       .nav-tab-active is the selection cue. Keyboard focus (focus-visible)
       still shows the browser default for accessibility. */
    &:focus:not(:focus-visible) {
      box-shadow: none;
      outline: 0;
    }
  }

  & .nav-tab:not(.nav-tab-active) {
    opacity: 0.75;
  }

  /* Override WP core's `.nav-tab-active, ...:focus:active` rule (common.css)
     which would otherwise flash a light-grey background and 1px grey border
     when you mouse-down on the already-active tab. The :focus:active variant
     has specificity (0,3,0) — we need to match or beat it on every interactive
     state. */
  & .nav-tab-active,
  & .nav-tab-active:hover,
  & .nav-tab-active:focus,
  & .nav-tab-active:focus:active {
    background: transparent;
    color: #fff;
    border-bottom: 2px solid #e1236c;
  }
}

/* Flat selectors keep the settings tabs readable in browsers or admin CSS
   pipelines that do not evaluate native CSS nesting before WP core nav-tab
   styles apply. */
.filter-ai-settings-header .nav-tab-wrapper {
  padding-top: 24px;
  border-bottom: 0;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.filter-ai-settings-header .nav-tab {
  margin: 0;
  background: transparent;
  color: #fff;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  padding: 12px 16px;
}

.filter-ai-settings-header .nav-tab:focus:not(:focus-visible) {
  box-shadow: none;
  outline: 0;
}

.filter-ai-settings-header .nav-tab:not(.nav-tab-active) {
  opacity: 0.75;
}

.filter-ai-settings-header .nav-tab-active,
.filter-ai-settings-header .nav-tab-active:hover,
.filter-ai-settings-header .nav-tab-active:focus,
.filter-ai-settings-header .nav-tab-active:focus:active {
  background: transparent;
  color: #fff;
  border-bottom: 2px solid #e1236c;
}

@media (max-width: 782px) {
  .filter-ai-settings-header {
    margin: -10px -12px 0;
    top: 46px;
  }
}

@media (max-width: 600px) {
  .filter-ai-settings-header {
    position: static;
  }
}

.filter-ai-settings-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.filter-ai-settings-spinner.filter-ai-settings-spinner {
  width: 2rem;
  height: 2rem;
  align-self: center;
  margin-top: 4rem;
  margin-bottom: 4rem;
}

.filter-ai-settings-panel {
  border-radius: 8px;
  border: 0;

  &.disabled {
    opacity: 0.7;
  }

  & .components-panel__header h2 {
    font-size: 15px;
  }

  & .components-panel__body.has-dependency {
    border-top-color: #fff;
  }

  & .components-panel__body p {
    &:first-child {
      margin-top: 0;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }

  & .components-panel__body table {
    & th:first-child,
    & td:first-child {
      padding: 4px 16px 4px 0;
    }

    & th:nth-child(n + 2),
    & td:nth-child(n + 2) {
      padding: 4px 16px;
    }
  }

  & .components-panel__row:not(:first-of-type) {
    margin-top: 16px;
  }
}

.filter-ai-settings-field {
  gap: 10px;
}

.filter-ai-settings-field-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-wrap: pretty;

  & label {
    font-weight: 500;
  }
}

.filter-ai-settings-field-warning {
  color: #b32d2e;
  font-size: 13px;
  line-height: 1.4;
}

.filter-ai-settings-field-reset.filter-ai-settings-field-reset {
  margin-top: 8px;
}

.filter-ai-content-source-save.filter-ai-content-source-save {
  margin-top: 16px;
}

.filter-ai-settings-toggle-options {
  &.has-icon {
    padding: 0;
    min-width: 24px;
  }

  &[disabled] {
    opacity: 0.5;
  }
}

.filter-ai-label-title {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: uppercase;
  display: block;
  padding: 0px;
}

.filter-ai-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.components-menu-item__button.components-button .components-menu-items__item-icon.has-icon-right {
  margin-left: 0px;
}

.filter-wrap {
  margin: 10px 20px 0 2px;
}

@media screen and (max-width: 782px) {
  .filter-wrap {
    clear: both;
    margin-right: 12px;
    margin-left: 0;
  }
}

.notice.update-nag.inline ~ .filter-wrap {
  margin-top: 35px;
}

.filter-ai-selector-button,
.filter-ai-selector-button.components-button.has-icon.has-text {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 6px 4px 6px 10px;
}

.filter-ai-selector-menu .components-popover__content {
  border-radius: 8px;
}

.filter-ai-settings-seo-title-templates {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-ai-settings-seo-title-template {
  display: inline-flex;
  flex-direction: row;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e0e0e0;

  & .filter-ai-settings-seo-title-template-item {
    color: #0f172a;
    background-color: #e2e8f0;
    border-radius: 17px;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 500;
    padding: 2px 8px;
  }
}

.filter-ai-settings-panel .components-panel__body .filter-ai-error-log-table {
  margin-top: 16px;

  & th,
  & td {
    padding: 12px 18px;
    vertical-align: top;
  }

  & th:first-child,
  & td:first-child {
    padding-left: 18px;
    width: 170px;
  }

  & th:last-child,
  & td:last-child {
    width: 150px;
  }
}

.filter-ai-error-log-detail {
  padding-top: 2px;
}

.filter-ai-error-log-back {
  margin-bottom: 14px;

  & .components-button.is-link {
    height: auto;
    padding: 0;
  }
}

.filter-ai-error-log-detail h3 {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.35;
}

.filter-ai-error-log-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 16px 0 20px;

  & dt {
    font-weight: 600;
  }

  & dd {
    margin: 0;
  }
}

.filter-ai-error-log-content {
  white-space: pre-wrap;
  max-width: 1200px;
  background: #fff;
  border: 1px solid #ccd0d4;
  padding: 16px;
  overflow: auto;
}
