/* WP App Mode — styles publics. */

/* ---------------------------------------------------------------
   Mode sombre
   --------------------------------------------------------------- */

html[data-wpam-scheme="dark"]:not(.wpam-invert) {
  color-scheme: dark;
}

/* Inversion intelligente : la page est inversée, les médias retrouvent leurs couleurs. */
html.wpam-invert[data-wpam-scheme="dark"] {
  filter: invert(1) hue-rotate(180deg);
  background-color: #fff;
}
html.wpam-invert[data-wpam-scheme="dark"] :is(img, picture, video, canvas, iframe, embed, object, .wpam-no-invert, [style*="background-image"]) {
  filter: invert(1) hue-rotate(180deg);
}
/* Évite la double inversion des images imbriquées. */
html.wpam-invert[data-wpam-scheme="dark"] :is(picture, .wpam-no-invert, [style*="background-image"]) :is(img, picture, video, canvas, iframe) {
  filter: none;
}

html.wpam-switching,
html.wpam-switching body {
  transition: filter .3s ease, background-color .3s ease, color .3s ease;
}

/* ---------------------------------------------------------------
   Boutons flottants
   --------------------------------------------------------------- */

.wpam-ui, .wpam-ui * { box-sizing: border-box; }

.wpam-i {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.wpam-fab {
  position: fixed;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.wpam-fab > * { pointer-events: auto; }

.wpam-pos-bottom-right { right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(var(--wpam-offset, 20px) + var(--wpam-nav-offset, env(safe-area-inset-bottom, 0px))); }
.wpam-pos-bottom-left  { left:  calc(16px + env(safe-area-inset-left, 0px));  bottom: calc(var(--wpam-offset, 20px) + var(--wpam-nav-offset, env(safe-area-inset-bottom, 0px))); flex-direction: row-reverse; }
.wpam-pos-top-right    { right: calc(16px + env(safe-area-inset-right, 0px)); top: calc(var(--wpam-offset, 20px) + env(safe-area-inset-top, 0px)); }
.wpam-pos-top-left     { left:  calc(16px + env(safe-area-inset-left, 0px));  top: calc(var(--wpam-offset, 20px) + env(safe-area-inset-top, 0px)); flex-direction: row-reverse; }

.wpam-toggle {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 50%;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .15);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.wpam-toggle:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(15, 23, 42, .2); }
.wpam-toggle:active { transform: scale(.94); }
.wpam-toggle:focus-visible,
.wpam-install:focus-visible { outline: 3px solid var(--wpam-accent, #2563eb); outline-offset: 2px; }

.wpam-toggle .wpam-i { display: none; width: 22px; height: 22px; }
.wpam-toggle[data-state="light"] .wpam-i-light,
.wpam-toggle[data-state="dark"] .wpam-i-dark,
.wpam-toggle[data-state="auto"] .wpam-i-auto { display: block; }
.wpam-i .wpam-fill { fill: currentColor; stroke: none; }

/* Version shortcode : s'intègre au menu / en-tête. */
.wpam-toggle.wpam-toggle-inline {
  width: 40px;
  height: 40px;
  background: transparent;
  color: inherit;
  border-color: transparent;
  box-shadow: none;
}
.wpam-toggle.wpam-toggle-inline:hover { background: rgba(127, 127, 127, .12); transform: none; box-shadow: none; }

/* Mode sombre « classe CSS » : le bouton passe en sombre (en mode inversion, il l'est déjà). */
html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-toggle:not(.wpam-toggle-inline) {
  background: #1e293b;
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, .08);
}

.wpam-install-wrap {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--wpam-accent, #2563eb);
  box-shadow: 0 6px 20px rgba(15, 23, 42, .2);
  animation: wpam-in .3s ease both;
}
.wpam-install-wrap[hidden] { display: none; }

.wpam-install {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--wpam-accent, #2563eb);
  color: #fff;
  font: 600 15px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.wpam-install[hidden] { display: none; }
.wpam-install-fab { padding-right: 6px; background: transparent; }

.wpam-install-dismiss {
  appearance: none;
  width: 36px;
  height: 36px;
  margin: 0 4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, .8);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.wpam-install-dismiss:hover { background: rgba(255, 255, 255, .15); color: #fff; }

@media (max-width: 420px) {
  .wpam-install-fab span { display: none; }
  .wpam-install-fab { padding: 12px 6px 12px 14px; }
}

/* ---------------------------------------------------------------
   Mode d'emploi iOS
   --------------------------------------------------------------- */

.wpam-sheet { position: fixed; inset: 0; z-index: 99995; }
.wpam-sheet[hidden] { display: none; }
.wpam-sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); animation: wpam-fade .2s ease both; }
.wpam-sheet-panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  transform: translateX(-50%);
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  background: #fff;
  color: #0f172a;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
  animation: wpam-up .25s ease both;
}
.wpam-sheet-panel h2 { margin: 0 0 14px; font-size: 19px; line-height: 1.3; color: inherit; }
.wpam-sheet-panel ol { margin: 0; padding-left: 22px; }
.wpam-sheet-panel li { margin: 0 0 10px; }
.wpam-i-inline { width: 18px; height: 18px; vertical-align: -3px; color: #007aff; }
.wpam-sheet-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: #f1f5f9; color: #334155; font-size: 22px; line-height: 1; cursor: pointer;
}
html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-sheet-panel { background: #111827; color: #f1f5f9; }
html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-sheet-close { background: #1f2937; color: #e5e7eb; }
html.wpam-sheet-open { overflow: hidden; }

.wpam-sheet [hidden] { display: none !important; }
.wpam-sheet-note { margin: 14px 0 0; font-size: 13px; color: #64748b; }

/* ---------------------------------------------------------------
   Bannière d'installation
   --------------------------------------------------------------- */

.wpam-banner {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 99996;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 14px;
  background: #fff;
  color: #0f172a;
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 6px 24px rgba(15, 23, 42, .16);
  animation: wpam-fade .3s ease both;
}
.wpam-banner[hidden] { display: none; }
.wpam-banner-top {
  top: var(--wp-admin--admin-bar--height, 0px);
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  border-bottom: 3px solid var(--wpam-accent, #2563eb);
}
.wpam-banner-bottom {
  bottom: var(--wpam-nav-offset, 0px);
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 3px solid var(--wpam-accent, #2563eb);
}
.wpam-banner-icon { width: 44px; height: 44px; flex: none; border-radius: 11px; object-fit: cover; background: #f1f5f9; }
.wpam-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wpam-banner-text strong { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wpam-banner-text span { color: #64748b; font-size: 13px; }
.wpam-banner .wpam-banner-installed-text,
.wpam-banner.wpam-banner-installed .wpam-banner-default-text,
.wpam-banner.wpam-banner-installed .wpam-banner-install { display: none; }
.wpam-banner.wpam-banner-installed .wpam-banner-installed-text { display: block; }
.wpam-banner-spacer { display: block; width: 100%; }
.wpam-banner .wpam-install { padding: 10px 16px; font-size: 14px; }
.wpam-banner .wpam-install .wpam-i { width: 18px; height: 18px; }
.wpam-banner-close { color: #64748b; margin: 0; }
.wpam-banner-close:hover { background: #f1f5f9; color: #0f172a; }

@media (min-width: 768px) {
  .wpam-banner { left: 50%; right: auto; width: min(620px, calc(100% - 32px)); transform: translateX(-50%); }
  .wpam-banner-top { border-radius: 0 0 16px 16px; }
  .wpam-banner-bottom { border-radius: 16px 16px 0 0; }
}
@media (max-width: 420px) {
  .wpam-banner.wpam-banner-installed .wpam-banner-installed-text,
  .wpam-banner-text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; }
  .wpam-banner .wpam-install .wpam-i { display: none; }
}

html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-banner { background: #111827; color: #f1f5f9; }
html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-banner-close:hover { background: #1f2937; color: #fff; }

/* ---------------------------------------------------------------
   Boutons d'en-tête (clair/sombre + traduction)
   --------------------------------------------------------------- */

.wpam-header-tools { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; margin: 0 4px; }
.wpam-header-tools[hidden] { display: none; }
li.wpam-menu-item { display: flex; align-items: center; list-style: none; }
li.wpam-menu-item::before, li.wpam-menu-item::after { content: none; }

/* Le bouton flottant est inutile quand celui de l'en-tête existe. */
html.wpam-has-header-toggle .wpam-fab > .wpam-toggle { display: none; }

.wpam-translate { position: relative; display: inline-flex; }
.wpam-translate-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 40px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
}
.wpam-translate-btn:hover { background: rgba(127, 127, 127, .12); }
.wpam-translate-btn:focus-visible { outline: 3px solid var(--wpam-accent, #2563eb); outline-offset: 2px; }

.wpam-translate-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 99997;
  min-width: 200px;
  max-height: min(60vh, 380px);
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .18);
  text-align: left;
}
.wpam-translate-menu[hidden] { display: none; }
.wpam-translate-menu li { margin: 0; padding: 0; list-style: none; }
.wpam-translate-menu li::before { content: none; }
.wpam-translate-menu button {
  appearance: none;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 14px/1.25 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: left;
  cursor: pointer;
}
.wpam-translate-menu button:hover { background: #f1f5f9; }
.wpam-translate-menu em { font-style: normal; color: #94a3b8; font-size: 12px; }
.wpam-translate-menu .wpam-check { width: 16px; height: 16px; visibility: hidden; color: var(--wpam-accent, #2563eb); }
.wpam-translate-menu button[aria-current="true"] { font-weight: 600; }
.wpam-translate-menu button[aria-current="true"] .wpam-check { visibility: visible; }

html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-translate-menu { background: #111827; color: #f1f5f9; border-color: rgba(255, 255, 255, .08); }
html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-translate-menu button:hover { background: #1f2937; }

/* Version menu mobile : grands boutons avec libellé, liste des langues dépliée dans le menu. */
.wpam-header-tools.wpam-mobile-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 12px 16px;
  width: 100%;
  border-bottom: 1px solid rgba(127, 127, 127, .18);
}
li.wpam-menu-item > .wpam-mobile-tools { padding-left: 0; padding-right: 0; }
.wpam-mobile-tools .wpam-translate { flex: 1 1 0; min-width: 140px; flex-direction: column; }
.wpam-mobile-tools .wpam-toggle.wpam-toggle-inline,
.wpam-mobile-tools .wpam-translate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(127, 127, 127, .28);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: 600 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wpam-mobile-tools .wpam-toggle.wpam-toggle-inline { flex: 1 1 0; min-width: 140px; }
.wpam-mobile-tools .wpam-toggle .wpam-i { width: 20px; height: 20px; }
.wpam-mobile-tools .wpam-translate-code {
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(127, 127, 127, .15);
  font-size: 11px;
}
.wpam-mobile-tools .wpam-translate-menu {
  position: static;
  width: 100%;
  min-width: 0;
  max-height: 260px;
  margin-top: 6px;
  box-shadow: none;
  border-color: rgba(127, 127, 127, .25);
  background: transparent;
  color: inherit;
}
.wpam-mobile-tools .wpam-translate-menu button:hover { background: rgba(127, 127, 127, .12); }

/* Repli flottant inutile sur mobile quand les boutons sont dans le menu mobile. */
@media (max-width: 1024px) {
  html.wpam-has-mobile-tools .wpam-in-fab { display: none; }
}

/* Repli : boutons d'en-tête affichés parmi les boutons flottants. */
.wpam-header-tools.wpam-in-fab { margin: 0; gap: 10px; }
.wpam-in-fab .wpam-translate-btn,
.wpam-in-fab .wpam-toggle.wpam-toggle-inline {
  height: 46px;
  background: #fff;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 6px 20px rgba(15, 23, 42, .15);
}
.wpam-in-fab .wpam-toggle.wpam-toggle-inline { width: 46px; }
.wpam-in-fab .wpam-translate-btn { padding: 0 14px; }
.wpam-fab[class*="wpam-pos-bottom"] .wpam-translate-menu { top: auto; bottom: calc(100% + 8px); }
.wpam-fab[class*="-left"] .wpam-translate-menu { right: auto; left: 0; }

/* Google Traduction : on masque sa barre et ses infobulles (notre menu sert à revenir à l'original). */
#wpam-gt { display: none !important; }
html.wpam-translated body { top: 0 !important; }
html.wpam-translated .skiptranslate > iframe,
html.wpam-translated iframe.skiptranslate,
.goog-te-banner-frame,
#goog-gt-tt,
.goog-te-balloon-frame,
.VIpgJd-ZVi9od-ORHb-OEVmcd,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf { display: none !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }

/* ---------------------------------------------------------------
   Barre de navigation du bas (affichée par la media query injectée
   selon la largeur réglée)
   --------------------------------------------------------------- */

:root { --wpam-nav-h: 60px; }

.wpam-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99980;
  display: none;
  align-items: stretch;
  justify-content: space-around;
  height: calc(var(--wpam-nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: rgba(255, 255, 255, .96);
  color: #64748b;
  border-top: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 -4px 18px rgba(15, 23, 42, .06);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  transition: transform .25s ease;
  -webkit-user-select: none;
  user-select: none;
}
.wpam-bottom-nav.wpam-nav-no-labels { --wpam-nav-h: 54px; }
html.wpam-nav-hidden .wpam-bottom-nav,
html.wpam-typing .wpam-bottom-nav,
html.wpam-sheet-open .wpam-bottom-nav { transform: translateY(110%); }

.wpam-nav-item {
  appearance: none;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 0;
  padding: 6px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit !important;
  font: 500 11px/1.1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-decoration: none !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wpam-nav-item:focus-visible { outline: 2px solid var(--wpam-accent, #2563eb); outline-offset: -4px; border-radius: 10px; }
.wpam-nav-icon { position: relative; display: grid; place-items: center; width: 44px; height: 28px; border-radius: 14px; transition: background-color .2s ease, transform .15s ease; }
.wpam-nav-icon .wpam-i { width: 23px; height: 23px; }
.wpam-nav-item:active .wpam-nav-icon { transform: scale(.9); }
.wpam-nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wpam-nav-no-labels .wpam-nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wpam-nav-item.is-active { color: var(--wpam-accent, #2563eb) !important; font-weight: 700; }
.wpam-nav-item.is-active .wpam-nav-icon { background: color-mix(in srgb, var(--wpam-accent, #2563eb) 14%, transparent); }
.wpam-nav-item.is-active .wpam-i { stroke-width: 2.3; }

.wpam-nav-badge {
  position: absolute;
  top: -4px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font: 700 10px/14px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: center;
}
.wpam-nav-badge[hidden] { display: none; }

html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-bottom-nav {
  background: rgba(15, 23, 42, .94);
  color: #94a3b8;
  border-top-color: rgba(255, 255, 255, .08);
}
html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-nav-badge { border-color: #0f172a; }

/* Icônes reprises du BuddyPanel (police bb-icons ou image). */
.wpam-nav-icon .wpam-bb-icon {
  display: inline-block;
  margin: 0 !important;
  padding: 0 !important;
  width: auto;
  font-size: 23px !important;
  line-height: 1 !important;
  color: inherit !important;
}
.wpam-nav-icon .wpam-bb-icon::before { margin: 0 !important; }
.wpam-nav-icon img.wpam-bb-icon { width: 23px; height: 23px; object-fit: contain; }

/* Onglet « Plus » */
.wpam-nav-more-btn.is-open { color: var(--wpam-accent, #2563eb) !important; }
.wpam-nav-dot { min-width: 10px; width: 10px; height: 10px; padding: 0; top: -1px; left: calc(50% + 8px); }
html.wpam-more-open .wpam-bottom-nav { transform: none; }

/* Panneau « Plus » : feuille qui monte au-dessus de la barre. */
.wpam-more { position: fixed; inset: 0; z-index: 99979; }
.wpam-more[hidden] { display: none; }
.wpam-more-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .4); animation: wpam-fade .2s ease both; }
.wpam-more-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--wpam-nav-offset, 0px);
  max-height: calc(100% - var(--wpam-nav-offset, 0px) - 60px);
  overflow-y: auto;
  padding: 8px 12px 16px;
  border-radius: 22px 22px 0 0;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, .18);
  animation: wpam-sheet-up .25s ease both;
  overscroll-behavior: contain;
}
.wpam-more-handle { width: 42px; height: 5px; margin: 2px auto 12px; border-radius: 3px; background: rgba(100, 116, 139, .35); cursor: pointer; }
.wpam-more-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 340px) { .wpam-more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.wpam-more-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit !important;
  font: 500 12px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: center;
  text-decoration: none !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.wpam-more-item .wpam-nav-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--wpam-accent, #2563eb) 10%, transparent);
  color: var(--wpam-accent, #2563eb);
}
.wpam-more-item .wpam-nav-label { white-space: normal; overflow-wrap: anywhere; }
.wpam-more-item:active { background: rgba(127, 127, 127, .1); }
.wpam-more-item.is-active { font-weight: 700; color: var(--wpam-accent, #2563eb) !important; }
.wpam-more-item.is-active .wpam-nav-icon { background: var(--wpam-accent, #2563eb); color: #fff; }
.wpam-more-item .wpam-nav-badge { top: -4px; left: auto; right: -6px; }
@keyframes wpam-sheet-up { from { transform: translateY(100%); } }

html[data-wpam-scheme="dark"]:not(.wpam-invert) .wpam-more-panel { background: #111827; color: #f1f5f9; }

/* ---------------------------------------------------------------
   Barre de chargement entre les pages
   --------------------------------------------------------------- */

.wpam-loader {
  position: fixed;
  top: var(--wp-admin--admin-bar--height, 0px);
  left: 0;
  z-index: 99999;
  width: 100%;
  height: 3px;
  pointer-events: none;
  background: var(--wpam-accent, #2563eb);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
}
html.wpam-loading .wpam-loader { opacity: 1; animation: wpam-progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes wpam-progress { 0% { transform: scaleX(0); } 10% { transform: scaleX(.35); } 100% { transform: scaleX(.95); } }

/* ---------------------------------------------------------------
   Mise en page « app » sur mobile (BuddyBoss en priorité)
   --------------------------------------------------------------- */

@media (max-width: 767px) {
  html.wpam-app-ui body { -webkit-font-smoothing: antialiased; }

  /* Marges : moins d'espace perdu sur les côtés et en haut. */
  html.wpam-app-ui .site-content { padding-top: 12px !important; padding-bottom: 16px !important; }
  html.wpam-app-ui :is(.site-content, .bb-grid, #page) > .container,
  html.wpam-app-ui .site-content .container { padding-left: 12px; padding-right: 12px; }

  /* Cartes : arrondies et rapprochées, comme dans une app. */
  html.wpam-app-ui :is(.activity-list.bp-list > li, .bp-list > li .list-wrap, .widget, .bb-card, .bp-feedback, .entry-content-wrap, #buddypress .bb-media-container) {
    border-radius: 14px;
  }
  html.wpam-app-ui .activity-list.bp-list > li { margin-bottom: 10px; }
  html.wpam-app-ui .widget { margin-bottom: 12px; }

  /* Titres plus compacts. */
  html.wpam-app-ui :is(.entry-title, .page-title, h1.bb-title) { font-size: 1.4rem; line-height: 1.25; margin-bottom: .6em; }
  html.wpam-app-ui :is(h2.widget-title, .widget .widget-title) { font-size: 1rem; }

  /* En-têtes de profil / groupe moins hauts. */
  html.wpam-app-ui :is(#cover-image-container, .bb-cover-image-container) #header-cover-image,
  html.wpam-app-ui :is(.groups-header, .users-header) #header-cover-image { height: 150px; }

  /* Onglets de section : défilement horizontal au doigt. */
  html.wpam-app-ui :is(.bp-navs.bp-subnavs, #subnav, .bb-subnav) ul {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  html.wpam-app-ui :is(.bp-navs.bp-subnavs, #subnav, .bb-subnav) ul::-webkit-scrollbar { display: none; }
  html.wpam-app-ui :is(.bp-navs.bp-subnavs, #subnav, .bb-subnav) li { flex: none; }

  /* Champs : pas de zoom auto, cibles tactiles confortables. */
  html.wpam-app-ui :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { font-size: 16px; }
  html.wpam-app-ui :is(.button, button.button, input[type="submit"], .bb-button) { min-height: 40px; }

  /* Défilement fluide et sans rebond parasite sous la barre du bas. */
  html.wpam-app-ui { scroll-padding-bottom: var(--wpam-nav-offset, 0px); }
  html.wpam-app-ui img { -webkit-user-drag: none; }
}

/* Dans l'app installée : pas de pied de page de site web sur mobile / tablette. */
@media (max-width: 1024px) {
  html.wpam-standalone.wpam-hide-footer :is(#colophon, .site-footer, .footer-bottom, .bb-footer, footer.wp-block-template-part) { display: none !important; }
}

@keyframes wpam-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes wpam-up { from { transform: translate(-50%, 100%); } }
@keyframes wpam-fade { from { opacity: 0; } }

/* ---------------------------------------------------------------
   Optimisations selon l'appareil (spécificité nulle avec :where
   pour ne jamais écraser les styles du thème)
   --------------------------------------------------------------- */

html.wpam-optimize {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
:where(html.wpam-optimize.wpam-touch) { -webkit-tap-highlight-color: rgba(0, 0, 0, .06); }

:where(html.wpam-optimize) :where(img, video, iframe, embed, object, svg) { max-width: 100%; }
:where(html.wpam-optimize) :where(pre) { overflow-x: auto; }
:where(html.wpam-optimize) :where(.entry-content, .wp-block-post-content, .post-content) :where(p, li, a, td) { overflow-wrap: anywhere; }

@media (max-width: 767px) {
  :where(html.wpam-optimize) :where(.entry-content, .wp-block-post-content, .post-content, .wp-block-table) :where(table) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* iPhone : un champ de moins de 16px provoque un zoom automatique. */
@media (max-width: 1024px) {
  html.wpam-optimize.wpam-os-ios input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  html.wpam-optimize.wpam-os-ios select,
  html.wpam-optimize.wpam-os-ios textarea {
    font-size: max(16px, 1em);
  }
}

/* App installée : pas de rebond qui révèle le fond, sélection plus « app ». */
html.wpam-standalone { overscroll-behavior-y: none; }
html.wpam-standalone :where(a, button) { -webkit-touch-callout: none; }

@media (prefers-reduced-motion: reduce) {
  .wpam-ui *, html.wpam-switching, html.wpam-switching body { animation: none !important; transition: none !important; }
}

@media print {
  .wpam-ui { display: none !important; }
  html.wpam-invert[data-wpam-scheme="dark"] { filter: none; }
}
