/**
* if the language model API is not avaialable, 
* then the buttons to start a new chat or create a new prompt aren't active
*/
main#app[data-built-in-ai-languagemodel=false] {

  menu[role=toolbar] {
    
    li[role=menuitem] {
      
      button[type=button][value=new-chat] {
        pointer-events: none;
        color: var( --placeholder-color );
      }
        
      button[type=button][value=new-prompt] {
        pointer-events: none;
        color: var( --placeholder-color );
      }
    }
  }  
}

/**
* if the translator API is not avaialable, 
* then the button to open the translation dialog is not active
*/
main#app[data-built-in-ai-translator=false] {

  menu[role=toolbar] {

    li[role=menuitem] {
      
      button[type=button][popovertarget=translation-dialog][popovertargetaction=show] {
        pointer-events: none;
        color: var( --placeholder-color );
      }
      
    }

  }
}

/**
* if the summarizer API is not avaialable, 
* then the button to open the summarizer dialog is not active
*/
main#app[data-built-in-ai-summarizer=false] {

  menu[role=toolbar] {

    li[role=menuitem] {
      
      button[type=button][popovertarget=summarization-dialog][popovertargetaction=show] {
        pointer-events: none;
        color: var( --placeholder-color );
      }
      
    }
  }  
}

/**
* if the proofreader API is not avaialable, 
* then the button to open the proofreader dialog is not active
*/
main#app[data-built-in-ai-proofreader=false] {

  menu[role=toolbar] {

    li[role=menuitem] {
      
      button[type=button][popovertarget=proofreader-dialog][popovertargetaction=show] {
        pointer-events: none;
        color: var( --placeholder-color );
      }
      
    }
  }
}

/**
* if the writer API is not avaialable, 
* then the button to open the writer dialog is not active
*/
main#app[data-built-in-ai-writer=false] {

  menu[role=toolbar] {

    li[role=menuitem] {
      
      button[type=button][popovertarget=writer-dialog][popovertargetaction=show] {
        pointer-events: none;
        color: var( --placeholder-color );
      }
      
    }
  }
}

/**
* if the rewriter API is not avaialable, 
* then the button to open the rewriter dialog is not active
*/
main#app[data-built-in-ai-rewriter=false] {

  menu[role=toolbar] {

    li[role=menuitem] {
      
      button[type=button][popovertarget=rewriter-dialog][popovertargetaction=show] {
        pointer-events: none;
        color: var( --placeholder-color );
      }
      
    }
  }
}

/**
* If the translation dialog is opened, 
* then translation toolbar button does not respond to clicks and appears depressed  
*/
body:has( dialog#translation-dialog:popover-open) {
  > main#app {
    > header {
      > menu[role=toolbar] {
        > li[role=menuitem] {
          > button[type=button][popovertarget=translation-dialog] {
            pointer-events: none;
            border-style: inset;
            background-color: var( --dark-background-color );
          }
        }
      }
    }
  }
}

/**
* If the writer dialog is opened, 
* then writer toolbar button does not respond to clicks and appears depressed  
*/
body:has( dialog#writer-dialog:popover-open) {
  > main#app {
    > header {
      > menu[role=toolbar] {
        > li[role=menuitem] {
          > button[type=button][popovertarget=writer-dialog] {
            pointer-events: none;
            border-style: inset;
            background-color: var( --dark-background-color );
          }
        }
      }
    }
  }
}  

/**
* If the rewriter dialog is opened, 
* then rewriter toolbar button does not respond to clicks and appears depressed  
*/
body:has( dialog#rewriter-dialog:popover-open) {
  > main#app {
    > header {
      > menu[role=toolbar] {
        > li[role=menuitem] {
          > button[type=button][popovertarget=rewriter-dialog] {
            pointer-events: none;
            border-style: inset;
            background-color: var( --dark-background-color );
          }
        }
      }
    }
  }
}  


/**
* If the summarization dialog is opened, 
* then summarization toolbar button does not respond to clicks and appears depressed  
*/
body:has( dialog#summarization-dialog:popover-open) {
  > main#app {
    > header {
      > menu[role=toolbar] {
        > li[role=menuitem] {
          > button[type=button][popovertarget=summarization-dialog] {
            pointer-events: none;
            border-style: inset;
            background-color: var( --dark-background-color );
          }
        }
      }
    }
  }
}  

/**
* If the proofreader dialog is opened, 
* then proofreader toolbar button does not respond to clicks and appears depressed  
*/
body:has( dialog#proofreader-dialog:popover-open) {
  > main#app {
    > header {
      > menu[role=toolbar] {
        > li[role=menuitem] {
          > button[type=button][popovertarget=proofreader-dialog] {
            pointer-events: none;
            border-style: inset;
            background-color: var( --dark-background-color );
          }
        }
      }
    }
  }
}

/**
* If the about dialog is opened, 
* then about toolbar button does not respond to clicks and appears depressed  
*/
body:has( dialog#about-dialog:popover-open) {
  > main#app {
    > header {
      > menu[role=toolbar] {
        > li[role=menuitem] {
          > button[type=button][popovertarget=about-dialog] {
            pointer-events: none;
            border-style: inset;
            background-color: var( --dark-background-color );
          }
        }
      }
    }
  }
}  