/* =========================================================
   UNIPAY CHAT — RESCUE SCROLL TACTILE MOBILE
   Version : 20260613L-zoom50-bottombar
   Base : rollback avant insistance.

   Objectif :
   - ne pas bouger les barres haute, gauche, basse ;
   - rendre seulement la partie active scrollable au doigt ;
   - conserver la largeur réelle du contenu principal ;
   - éviter transform/zoom sur le conteneur scrollable lui-même.
   ========================================================= */

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue,
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue body {
  width: 100vw !important;
  max-width: 100vw !important;
  height: calc(var(--unipay-vh, 1vh) * 100) !important;
  min-height: calc(var(--unipay-vh, 1vh) * 100) !important;
  overflow: hidden !important;
  overscroll-behavior-x: none !important;
  overscroll-behavior-y: contain !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

/* Titre du portail de messagerie, compact et lisible dans l'axe actif. */
html body.unipay-page-chat .unipay-chat-page-title {
  display: inline-block !important;
  width: auto !important;
  max-width: min(680px, calc(100% - 24px)) !important;
  margin: 9px 12px 15px !important;
  padding: 10px 17px 10px 22px !important;
  border: 1px solid rgba(107, 233, 255, .48) !important;
  border-left: 3px solid #63efff !important;
  border-radius: 11px 20px 11px 20px !important;
  background: linear-gradient(110deg, rgba(6, 42, 66, .86), rgba(24, 18, 62, .74), rgba(3, 47, 68, .72)) !important;
  color: #e9fdff !important;
  font: 800 clamp(1.08rem, 1.75vw, 1.5rem)/1.23 ui-monospace, Consolas, monospace !important;
  letter-spacing: .025em !important;
  text-transform: uppercase !important;
  text-shadow: 0 0 11px rgba(90, 241, 255, .6) !important;
  box-shadow: inset 0 0 16px rgba(35, 203, 236, .1), 0 0 18px rgba(29, 218, 246, .15) !important;
}
html body.unipay-page-chat .unipay-chat-page-title::after {
  content: '';
  position: absolute;
  right: 9px;
  top: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #70faff;
  box-shadow: 0 0 8px #70faff;
  animation: unipayChatTitleBeacon 2.8s ease-in-out infinite;
}
@keyframes unipayChatTitleBeacon { 50% { opacity:.28; transform:scale(.65); } }
@media (max-width:600px) {
  html body.unipay-page-chat .unipay-chat-page-title {
    max-width: calc(100% - 14px) !important;
    margin: 5px 7px 9px !important;
    padding: 7px 13px 7px 15px !important;
    border-radius: 9px 15px 9px 15px !important;
    font-size: clamp(.87rem, 3.7vw, 1rem) !important;
    line-height: 1.25 !important;
    letter-spacing: .015em !important;
  }
}
@media (prefers-reduced-motion:reduce) {
  html body.unipay-page-chat .unipay-chat-page-title::after { animation:none; }
}

@media (max-width:600px) {
  body.unipay-page-chat #unipayStatusHub .status-carousel-container {
    position: relative !important;
    gap: 0 !important;
    padding: 0 !important;
  }
  body.unipay-page-chat #unipayStatusHub #statusBelt {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
  body.unipay-page-chat #unipayStatusHub .nav-extreme-btn {
    position: absolute !important;
    z-index: 5 !important;
    top: 50% !important;
    width: 21px !important;
    min-width: 21px !important;
    height: 48px !important;
    padding: 0 !important;
    border: 1px solid rgba(89,234,250,.48) !important;
    border-radius: 9px !important;
    background: rgba(2,20,38,.7) !important;
    transform: translateY(-50%) !important;
    font-size: 1rem !important;
  }
  body.unipay-page-chat #unipayStatusHub #navPrevStatus { left: 0 !important; }
  body.unipay-page-chat #unipayStatusHub #navNextStatus { right: 0 !important; }
  body.unipay-page-chat #unipayStatusHub .nav-extreme-btn .nav-arrow { line-height: 1 !important; }
}

/* Carte Intelligence : garder le profil et sa dynamique visibles sur petit ecran. */
@media (max-width: 600px) {
  body.unipay-page-chat #unipaySmartHub.unipay-smart-hub {
    padding: 12px !important;
    border-radius: 16px !important;
  }
  body.unipay-page-chat #unipaySmartHub .smart-hub-header {
    margin-bottom: 10px !important;
  }
  body.unipay-page-chat #unipaySmartHub .smart-hub-header > div {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
  }
  body.unipay-page-chat #unipaySmartHub .smart-kicker {
    font-size: .66rem !important;
    letter-spacing: .1em !important;
  }
  body.unipay-page-chat #unipaySmartHub #smartHubRefresh {
    flex: 0 0 auto !important;
    min-height: 36px !important;
    padding: 7px 10px !important;
    font-size: .68rem !important;
    letter-spacing: .06em !important;
  }
  body.unipay-page-chat #unipaySmartHub .smart-grid { gap: 9px !important; }
  body.unipay-page-chat #unipaySmartHub .profile-ai-card {
    min-height: 0 !important;
    margin: 0 !important;
    padding: 12px 10px !important;
    border-radius: 14px !important;
  }
  body.unipay-page-chat #unipaySmartHub .profile-ai-card .smart-card-title {
    margin-bottom: 6px !important;
    padding-bottom: 4px !important;
  }
  body.unipay-page-chat #unipaySmartHub .smart-profile-line {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    margin-bottom: 5px !important;
    text-align: left !important;
  }
  body.unipay-page-chat #unipaySmartHub #smartProfileAvatar {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    border-radius: 50% !important;
  }
  body.unipay-page-chat #unipaySmartHub .smart-profile-line > div { min-width: 0 !important; }
  body.unipay-page-chat #unipaySmartHub #smartProfileName {
    margin: 0 0 2px !important;
    font-size: .92rem !important;
    line-height: 1.2 !important;
  }
  body.unipay-page-chat #unipaySmartHub #smartProfileEmail {
    margin: 0 !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
    line-height: 1.2 !important;
  }
  body.unipay-page-chat #unipaySmartHub .smart-status {
    margin: 2px 0 0 !important;
    line-height: 1.2 !important;
  }
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue body {
  position: fixed !important;
  inset: 0 !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  touch-action: pan-y pinch-zoom !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue .page-scope {
  position: static !important;
  display: block !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: calc(var(--unipay-vh, 1vh) * 100) !important;
  min-height: 0 !important;
  overflow: hidden !important;
  transform: none !important;
  zoom: 1 !important;
  contain: none !important;
}

/* Le conteneur scrollable n'est PAS zoomé : le tactile reste natif et stable. */
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue .page-scope > main.content {
  position: fixed !important;
  top: var(--chat-active-top, 116px) !important;
  left: var(--chat-active-left, 66px) !important;
  right: var(--chat-active-right, 10px) !important;
  bottom: var(--chat-active-bottom, 96px) !important;
  z-index: 10 !important;

  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;

  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;

  display: block !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  touch-action: pan-y !important;
  scroll-behavior: auto !important;

  transform: none !important;
  zoom: 1 !important;
  transform-origin: top left !important;
  will-change: scroll-position !important;
  contain: none !important;
  scrollbar-width: thin !important;
}

/* Le contenu interne reste à 100% : le zoom 50% créait une zone morte et
   empêchait de voir le flux complet sur les petits écrans. */
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue .page-scope > main.content > .unipay-chat-touch-zoom-surface {
  position: relative !important;
  display: block !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: 0 !important;
  padding: 10px 10px 20px !important;
  margin: 0 !important;
  transform: none !important;
  transform-origin: top left !important;
  zoom: 1 !important;
  overflow: visible !important;
  touch-action: pan-y !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue .page-scope > main.content > .unipay-chat-touch-zoom-surface > * {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Fond global continu : la galerie ne doit plus remplacer l'image de page
   par un panneau noir opaque lorsqu'elle entre dans la zone scrollable. */
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue .unipay-mini-gallery {
  background: rgba(6, 12, 26, 0.24) !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue .unipay-mini-gallery-bg {
  background: transparent !important;
}

/* Les anciennes règles de zoom fullscreen sont neutralisées sans modifier les barres. */
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue.unipay-native-fullscreen .page-scope > main.content,
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue.unipay-root-fullscreen-active .page-scope > main.content,
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue:fullscreen .page-scope > main.content {
  transform: none !important;
  zoom: 1 !important;
  width: auto !important;
  max-width: none !important;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
  touch-action: pan-y !important;
}

/* La première section redevient contenue dans la zone active réduite. */
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue :is(#unipaySmartHub,.unipay-smart-hub,.unipay-status-hub,.messaging-section,.login-section,#mainMessagingSection,#bottomDashboards) {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .smart-hub-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .smart-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .profile-ai-card {
  grid-column: 1 / -1 !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .smart-card,
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .smart-card * {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .smart-search-panel {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .smart-search-panel input {
  width: 100% !important;
  min-width: 0 !important;
}

/* Les carrousels restent horizontaux et ne capturent pas le scroll vertical. */
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue :is(.status-belt,#statusBelt,.status-carousel-container,.fut-bottom-list,.fut-sidebar-list) {
  -webkit-overflow-scrolling: touch !important;
}

/* Les barres gardent leur zoom. Leur position et leurs dimensions restent sous
   le contrôle des composants globaux afin que Chat ne déplace plus les objets. */
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue :is(#fut-sidebar,.fut-sidebar,header,nav.menu,.menu) {
  transform: none !important;
  zoom: 1 !important;
}

html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #fut-bottombar {
  zoom: 1 !important;
}

/* Déconnexion fixe au-dessus de la barre inférieure. */
html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipay-universal-logout:not(.hidden) {
  position: fixed !important;
  z-index: 2147483405 !important;
  left: var(--chat-active-left, 66px) !important;
  right: var(--chat-active-right, 10px) !important;
  bottom: calc(var(--chat-bottombar-height, 76px) + 16px) !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  transform: none !important;
  zoom: 1 !important;
  touch-action: manipulation !important;
}

@media (max-width: 420px) {
  html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .smart-grid {
    grid-template-columns: 1fr !important;
  }
  html.unipay-page-chat.unipay-phone-portrait.unipay-chat-touch-scroll-rescue #unipaySmartHub .smart-search-panel {
    grid-template-columns: 1fr !important;
  }
}

.unipay-chat-page-title {
  margin: 8px 18px 14px;
  color: #e9fbff;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  line-height: 1.2;
}

.principal-location-disclosure,
.unipay-password-help,
.unipay-password-strength-text {
  color: #c6dce8;
  font-size: .86rem;
  line-height: 1.45;
}

.unipay-password-strength {
  display: block;
  width: 100%;
  min-height: 12px;
  margin-top: 7px;
}

.pro-checkbox-line a {
  color: #6fefff;
  text-underline-offset: 3px;
}

@media (max-width: 720px) {
  .unipay-chat-page-title { margin: 6px 12px 10px; font-size: 1.2rem; }
  .pro-account-modal button,
  .recover-modal button,
  .pro-account-modal input:not([type="checkbox"]),
  .pro-account-modal select,
  .recover-modal input:not([type="checkbox"]) { min-height: 44px; }
}

/* Authentification mobile : une seule surface lisible, entièrement défilable. */
@media (max-width: 720px) {
  body.unipay-page-chat #loginSection {
    box-sizing: border-box !important;
    width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 112px) !important;
    margin: 8px auto 86px !important;
    padding: 12px !important;
    overflow: hidden auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  body.unipay-page-chat #loginForm {
    width: 100% !important;
    max-width: none !important;
    gap: 6px !important;
  }
  body.unipay-page-chat #loginForm h2 { margin: 0 0 4px !important; font-size: 1.45rem !important; }
  body.unipay-page-chat #loginForm .login-intro { margin: 0 0 6px !important; font-size: .84rem !important; line-height: 1.35 !important; }
  body.unipay-page-chat #loginForm label { margin-top: 4px !important; padding: 2px 0 !important; font-size: .9rem !important; }
  body.unipay-page-chat #loginForm input { margin-top: 0 !important; min-height: 44px !important; padding: 10px 12px !important; }
  body.unipay-page-chat #loginForm br { display: none !important; }
  body.unipay-page-chat #loginForm button { margin-top: 6px !important; min-height: 44px !important; padding: 10px 12px !important; }
  body.unipay-page-chat #loginForm .principal-location-consent { display: grid !important; grid-template-columns: 24px minmax(0,1fr) !important; align-items: center; gap: 7px !important; }
  body.unipay-page-chat #loginForm .principal-location-consent input { min-height: 22px !important; width: 22px !important; }
  body.unipay-page-chat #loginForm .login-options { gap: 8px !important; flex-wrap: wrap; line-height: 1.25; }
  body.unipay-page-chat .pro-account-modal,
  body.unipay-page-chat .recover-modal { padding: 8px !important; align-items: center !important; }
  body.unipay-page-chat .pro-account-modal-content,
  body.unipay-page-chat .recover-modal-content {
    box-sizing: border-box !important;
    width: min(100%, 520px) !important;
    max-height: calc(100dvh - 24px) !important;
    overflow: hidden auto !important;
    padding: 14px !important;
    -webkit-overflow-scrolling: touch;
  }
  body.unipay-page-chat .pro-account-modal-content h2,
  body.unipay-page-chat .recover-modal-content h2 { font-size: 1.25rem !important; line-height: 1.2 !important; }
  body.unipay-page-chat .pro-row,
  body.unipay-page-chat .recover-row { gap: 7px !important; margin-top: 7px !important; }
  body.unipay-page-chat .field-group,
  body.unipay-page-chat .recover-field { min-width: 0 !important; flex-basis: 100% !important; }
  body.unipay-page-chat .field-group input,
  body.unipay-page-chat .field-group select,
  body.unipay-page-chat .recover-field input { min-height: 44px !important; padding: 9px 10px !important; }
}
