/* Bayān 10.21 — correctifs issus de l'audit QA global.
   Cette couche est volontairement chargée en dernier afin de neutraliser les anciens
   styles historiques qui pouvaient dissocier la couleur d'un fond de celle de son texte. */

/* Navigation interne : le fond actif et le texte actif proviennent toujours de la MEME paire de thème. */
html[data-bayaan-theme] body:is(.app-quran,.app-torah,.app-gospels,.app-peshitta)
  .app-local-nav > :is(.nav-button,.nav-btn).active{
  background:var(--bayaan-nav-active-bg)!important;
  color:var(--bayaan-nav-active-text)!important;
  border-color:var(--bayaan-nav-active-bg)!important;
  opacity:1!important;
}
html[data-bayaan-theme] body:is(.app-quran,.app-torah,.app-gospels,.app-peshitta)
  .app-local-nav > :is(.nav-button,.nav-btn).active :is(span,b,strong,i,small,.nav-icon,.nav-label){
  color:var(--bayaan-nav-active-text)!important;
  opacity:1!important;
}
html[data-bayaan-theme] body:is(.app-quran,.app-torah,.app-gospels,.app-peshitta)
  .app-local-nav > :is(.nav-button,.nav-btn):not(.active),
html[data-bayaan-theme] body:is(.app-quran,.app-torah,.app-gospels,.app-peshitta)
  .app-local-nav > :is(.nav-button,.nav-btn):not(.active) :is(span,b,strong,i,small,.nav-icon,.nav-label){
  color:var(--bayaan-nav-text)!important;
  opacity:1!important;
}

/* Actions : aucune ancienne règle ne peut imposer texte blanc sur accent clair. */
html[data-bayaan-theme] body :is(button.primary-button,button.primary-btn,.primary-button,.primary-btn){
  background:var(--bayaan-action-bg)!important;
  color:var(--bayaan-action-text)!important;
  border-color:var(--bayaan-action-bg)!important;
}
html[data-bayaan-theme] body :is(button.primary-button,button.primary-btn,.primary-button,.primary-btn) :is(span,b,strong,i,small){
  color:inherit!important;
}
html[data-bayaan-theme] body :is(button.secondary-button,button.secondary-btn,.secondary-button,.secondary-btn,.ghost-button,.ghost-btn){
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}
html[data-bayaan-theme] body :is(button.secondary-button,button.secondary-btn,.secondary-button,.secondary-btn,.ghost-button,.ghost-btn) :is(span,b,strong,i,small){
  color:inherit!important;
}

/* Les entrées gardent toujours le texte du thème sur le fond de champ. */
html[data-bayaan-theme] body :is(input,textarea,select){
  color:var(--bayaan-text)!important;
}
html[data-bayaan-theme] body :is(input,textarea)::placeholder{
  color:var(--bayaan-muted)!important;
  opacity:1!important;
}

/* Verrou de spécificité : plusieurs feuilles historiques utilisent :not(...) et !important.
   On force ici les paires de contraste finales sans changer la palette du thème. */
html[data-bayaan-theme]:root body:is(.app-quran,.app-torah,.app-gospels,.app-peshitta)
  .app-local-nav.app-local-nav > :is(.nav-button.nav-button,.nav-btn.nav-btn).active{
  background:var(--bayaan-nav-active-bg)!important;
  color:var(--bayaan-nav-active-text)!important;
  border-color:var(--bayaan-nav-active-bg)!important;
}
html[data-bayaan-theme]:root body:is(.app-quran,.app-torah,.app-gospels,.app-peshitta)
  .app-local-nav.app-local-nav > :is(.nav-button.nav-button,.nav-btn.nav-btn).active :is(span,b,strong,i,small,.nav-icon,.nav-label){
  color:var(--bayaan-nav-active-text)!important;
}
html[data-bayaan-theme]:root body :is(.primary-button.primary-button.primary-button,.primary-btn.primary-btn.primary-btn){
  background:var(--bayaan-action-bg)!important;
  color:var(--bayaan-action-text)!important;
  border-color:var(--bayaan-action-bg)!important;
}
html[data-bayaan-theme]:root body :is(.secondary-button.secondary-button.secondary-button,.secondary-btn.secondary-btn.secondary-btn,.ghost-button.ghost-button.ghost-button,.ghost-btn.ghost-btn.ghost-btn){
  background:var(--bayaan-surface-2)!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
}

/* 10.21.1 — verrou final sur les composants interactifs réellement présents dans les applications.
   Les IDs/classes ci-dessous battent volontairement les anciennes couches avec !important. */
html[data-bayaan-theme]:root body.app-quran button.primary-button.primary-button,
html[data-bayaan-theme]:root body.app-quran #searchButton,
html[data-bayaan-theme]:root body.app-torah button.primary-btn.primary-btn,
html[data-bayaan-theme]:root body.app-gospels button.primary-btn.primary-btn,
html[data-bayaan-theme]:root body.app-peshitta button.primary-btn.primary-btn{
  background-color:var(--bayaan-action-bg)!important;
  background-image:none!important;
  color:var(--bayaan-action-text)!important;
  border-color:var(--bayaan-action-bg)!important;
  opacity:1!important;
}
html[data-bayaan-theme]:root body.app-quran button.primary-button.primary-button :is(span,b,strong,i,small),
html[data-bayaan-theme]:root body.app-torah button.primary-btn.primary-btn :is(span,b,strong,i,small),
html[data-bayaan-theme]:root body.app-gospels button.primary-btn.primary-btn :is(span,b,strong,i,small),
html[data-bayaan-theme]:root body.app-peshitta button.primary-btn.primary-btn :is(span,b,strong,i,small){
  color:inherit!important;
  opacity:1!important;
}

/* Même principe pour les actions secondaires : surface et texte toujours issus de la même palette. */
html[data-bayaan-theme]:root body.app-quran button.secondary-button.secondary-button,
html[data-bayaan-theme]:root body.app-quran button.ghost-button.ghost-button,
html[data-bayaan-theme]:root body.app-torah button.ghost-btn.ghost-btn,
html[data-bayaan-theme]:root body.app-gospels button.ghost-btn.ghost-btn,
html[data-bayaan-theme]:root body.app-peshitta button.ghost-btn.ghost-btn{
  background-color:var(--bayaan-surface-2)!important;
  background-image:none!important;
  color:var(--bayaan-text)!important;
  border-color:var(--bayaan-border)!important;
  opacity:1!important;
}

/* Navigation interne : aucune couleur héritée d'une icône ou d'un label ne peut casser le contraste. */
html[data-bayaan-theme]:root body.app-quran .app-local-nav.app-local-nav .nav-button.nav-button.active,
html[data-bayaan-theme]:root body.app-torah .app-local-nav.app-local-nav .nav-btn.nav-btn.active,
html[data-bayaan-theme]:root body.app-gospels .app-local-nav.app-local-nav .nav-btn.nav-btn.active,
html[data-bayaan-theme]:root body.app-peshitta .app-local-nav.app-local-nav .nav-btn.nav-btn.active{
  background-color:var(--bayaan-nav-active-bg)!important;
  background-image:none!important;
  color:var(--bayaan-nav-active-text)!important;
  border-color:var(--bayaan-nav-active-bg)!important;
  opacity:1!important;
}
html[data-bayaan-theme]:root body:is(.app-quran,.app-torah,.app-gospels,.app-peshitta)
 .app-local-nav.app-local-nav :is(.nav-button.nav-button,.nav-btn.nav-btn).active *{
  color:inherit!important;
  opacity:1!important;
}
