/* ========================================================================== */
/* ARKYN CORE — MOBILE SHELL CANONIQUE / CLEAN EPOCH 2026-10-07               */
/* Une seule coque mobile : HighBar fixe + viewport applicatif + BottomBar.    */
/* Toute ancienne règle de nav flottante / padding de page est volontairement  */
/* supprimée de cette couche.                                                  */
/* ========================================================================== */

@media (max-width:767px){
  :root{
    --arkyn-mobile-topbar-content:58px;
    --arkyn-mobile-topbar-height:calc(var(--arkyn-mobile-topbar-content) + env(safe-area-inset-top,0px));
    --arkyn-mobile-bottom-content:64px;
    --arkyn-mobile-bottom-height:calc(var(--arkyn-mobile-bottom-content) + env(safe-area-inset-bottom,0px));
    --arkyn-mobile-viewport-height:calc(100dvh - var(--arkyn-mobile-topbar-height) - var(--arkyn-mobile-bottom-height));
    --swat-workspace-top:var(--arkyn-mobile-topbar-height);
    --swat-mobile-nav-height:var(--arkyn-mobile-bottom-content);
    --swat-mobile-nav-gap:0px;
  }

  html,body{
    width:100%;height:100%;min-height:100dvh;max-width:100%;
    margin:0;overflow:hidden!important;overscroll-behavior:none;
    background:var(--ja-bg,#060812);
  }
  body.swat-workspace-unified,
  body.swat-nav-v3{height:100dvh!important;min-height:100dvh!important;overflow:hidden!important}
  body.swat-workspace-unified #root,
  body.swat-nav-v3 #root{
    width:100%!important;height:100dvh!important;min-height:0!important;
    padding:0!important;margin:0!important;overflow:hidden!important;box-sizing:border-box!important;
  }

  .swat-navigation-rail{display:none!important}

  /* BottomBar = chrome natif. Elle n'est jamais une carte flottante. */
  .swat-bottom-navigation{
    display:grid!important;position:fixed!important;z-index:2147482500!important;
    left:0!important;right:0!important;bottom:0!important;width:100%!important;
    height:var(--arkyn-mobile-bottom-height)!important;min-height:var(--arkyn-mobile-bottom-height)!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;align-items:start!important;gap:0!important;
    padding:4px 6px env(safe-area-inset-bottom,0px)!important;box-sizing:border-box!important;
    border:0!important;border-top:1px solid color-mix(in srgb,var(--ja-line,#293347) 88%,transparent)!important;
    border-radius:0!important;background:color-mix(in srgb,var(--ja-bg-elevated,#0c1018) 98%,transparent)!important;
    -webkit-backdrop-filter:blur(18px) saturate(118%)!important;backdrop-filter:blur(18px) saturate(118%)!important;
    box-shadow:0 -10px 28px rgba(0,0,0,.16)!important;
  }
  .swat-bottom-navigation button{
    position:relative!important;height:60px!important;min-height:60px!important;min-width:0!important;
    padding:5px 3px 4px!important;border:0!important;border-radius:0!important;background:transparent!important;
    color:var(--ja-muted,#8f9aaa)!important;display:grid!important;grid-template-rows:29px 14px!important;
    place-items:center!important;align-content:center!important;gap:2px!important;touch-action:manipulation!important;
    -webkit-tap-highlight-color:transparent!important;transform:none!important;
  }
  .swat-bottom-navigation button::before{
    content:"";position:absolute;top:-4px;left:28%;right:28%;height:2px;border-radius:0 0 2px 2px;
    background:transparent;transition:background 150ms ease,left 150ms ease,right 150ms ease;
  }
  .swat-bottom-navigation button i{height:29px!important;width:34px!important;display:grid!important;place-items:center!important}
  .swat-bottom-navigation button svg{width:22px!important;height:22px!important}
  .swat-bottom-navigation button span{font-size:9px!important;line-height:1!important;font-weight:720!important;letter-spacing:0!important}
  .swat-bottom-navigation button.active{
    color:var(--domain-accent,var(--ja-accent,#55c9ff))!important;
    background:linear-gradient(180deg,color-mix(in srgb,var(--domain-accent,var(--ja-accent)) 10%,transparent),transparent 72%)!important;
  }
  .swat-bottom-navigation button.active::before{
    left:18%;right:18%;background:var(--domain-accent,var(--ja-accent,#55c9ff));
    box-shadow:0 0 12px color-mix(in srgb,var(--domain-accent,var(--ja-accent)) 52%,transparent);
  }

  /* Contrat unique du viewport : tout module vit ENTRE HighBar et BottomBar. */
  .swat-sdk-workspace,
  body.swat-scanner-open.swat-workspace-unified .swat-scanner-module{
    position:fixed!important;z-index:1380!important;
    top:var(--arkyn-mobile-topbar-height)!important;right:0!important;
    bottom:var(--arkyn-mobile-bottom-height)!important;left:0!important;
    width:auto!important;height:auto!important;min-height:0!important;max-height:none!important;
    inset:var(--arkyn-mobile-topbar-height) 0 var(--arkyn-mobile-bottom-height) 0!important;
    overflow:hidden!important;border:0!important;border-radius:0!important;box-shadow:none!important;
  }
  .swat-sdk-layout{height:100%!important;min-height:0!important;overflow:hidden!important}
  .swat-sdk-main{
    height:100%!important;min-height:0!important;overflow-x:hidden!important;overflow-y:auto!important;
    padding-bottom:0!important;-webkit-overflow-scrolling:touch!important;overscroll-behavior-y:contain!important;
  }

  /* Hub, Scanner et surfaces legacy rendues par le Core utilisent le même viewport. */
  body.swat-workspace-unified .swat-global-hub-backdrop,.swat-global-hub-backdrop{
    position:fixed!important;left:0!important;right:0!important;
    top:var(--arkyn-mobile-topbar-height)!important;bottom:var(--arkyn-mobile-bottom-height)!important;
    width:auto!important;height:auto!important;min-height:0!important;overflow:hidden!important;
  }
  .swat-global-hub{height:100%!important;min-height:0!important}
  .swat-global-hub main{height:100%!important;min-height:0!important;overflow-y:auto!important;padding-bottom:20px!important}

  .swat-mobile-filter-sheet{
    position:fixed!important;top:var(--arkyn-mobile-topbar-height)!important;right:0!important;
    bottom:var(--arkyn-mobile-bottom-height)!important;left:0!important;height:auto!important;max-height:none!important;
  }
  .swat-mobile-filter-backdrop:has(+.swat-mobile-filter-sheet.swat-mobile-filter-open){
    position:fixed!important;top:var(--arkyn-mobile-topbar-height)!important;right:0!important;
    bottom:var(--arkyn-mobile-bottom-height)!important;left:0!important;height:auto!important;
  }

  /* Les éléments flottants doivent rester au-dessus de la BottomBar. */
  .swat-page-hub-return{bottom:10px!important}
  .swat-nav-toast{bottom:10px!important}

  body.swat-workspace-unified main,
  body.swat-workspace-unified [data-module-root],
  body.swat-workspace-unified .moduleSurface,
  body.swat-workspace-unified .swat-module-surface{scroll-padding-bottom:16px!important}
}

@media(max-width:390px){
  .swat-bottom-navigation button span{font-size:8px!important}
}


/* ==========================================================================
   ARKYN CORE MOBILE VIEWPORT CONTRACT — RC5 / TRUE RESPONSIVE
   Le viewport module se termine TOUJOURS avant la BottomBar.
   ========================================================================== */
@media(max-width:767px){
  :root{
    --arkyn-mobile-module-top:var(--arkyn-mobile-topbar-height);
    --arkyn-mobile-module-bottom:var(--arkyn-mobile-bottom-height);
    --arkyn-mobile-module-height:calc(100dvh - var(--arkyn-mobile-module-top) - var(--arkyn-mobile-module-bottom));
  }

  .swat-sdk-workspace,
  body.swat-scanner-open.swat-workspace-unified .swat-scanner-module{
    top:var(--arkyn-mobile-module-top)!important;
    bottom:var(--arkyn-mobile-module-bottom)!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
  }

  .swat-sdk-layout,
  .swat-sdk-main,
  .swat-sdk-main>[data-module],
  .swat-sdk-main>[data-module-root],
  .swat-sdk-main>.moduleSurface,
  .swat-sdk-main>.swat-module-surface{
    min-height:0!important;
    max-height:100%!important;
    box-sizing:border-box!important;
  }

  .swat-sdk-layout{
    display:flex!important;
    flex-direction:column!important;
    height:100%!important;
    overflow:hidden!important;
  }

  .swat-sdk-main{
    flex:1 1 auto!important;
    height:auto!important;
    max-height:100%!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior-y:contain!important;
    -webkit-overflow-scrolling:touch!important;
    scroll-padding-bottom:20px!important;
  }

  /* Une surface module ne doit jamais recréer un viewport 100vh / 100dvh. */
  .swat-sdk-main :is(
    [data-module-root],
    .moduleSurface,
    .swat-module-surface,
    .swat-dashboard-v33,
    .swat-dashboard-canvas
  ){
    max-block-size:100%!important;
    box-sizing:border-box!important;
  }
}
