/* EDIVIC final mobile polish + footer + fixed sidebar behavior */
@media (max-width: 900px){
  html, body{
    width:100%!important;
    max-width:100%!important;
    overflow-x:hidden!important;
    -webkit-text-size-adjust:100%!important;
  }

  /* Mobile down bar stays removed everywhere */
  .edv-mobile-bottom-nav,
  .edv-mtb-bottom-nav,
  .edivic-chat-bottom-nav,
  .bottom-nav,
  .edv-chat-bottom-nav{
    display:none!important;
    visibility:hidden!important;
    pointer-events:none!important;
  }

  body.edivic-mtb-nav-ready{
    height:100dvh!important;
    max-height:100dvh!important;
    overflow:hidden!important;
    padding:0!important;
    background:#f6f8fb!important;
  }

  body.edivic-mtb-nav-ready .edv-mtb-main-topbar{
    position:fixed!important;
    top:0!important;
    left:0!important;
    right:0!important;
    min-height:64px!important;
    height:auto!important;
    padding:10px 12px!important;
    gap:10px!important;
    border-radius:0 0 20px 20px!important;
    background:rgba(246,248,251,.96)!important;
    backdrop-filter:blur(14px)!important;
    -webkit-backdrop-filter:blur(14px)!important;
    z-index:2147482000!important;
  }

  body.edivic-mtb-nav-ready .edv-mtb-menu-btn{
    display:grid!important;
    place-items:center!important;
    width:44px!important;
    height:44px!important;
    min-width:44px!important;
    border:0!important;
    border-radius:16px!important;
    background:#111827!important;
    color:#FEBD69!important;
    box-shadow:0 10px 22px rgba(15,23,42,.18)!important;
  }

  body.edivic-mtb-nav-ready .edv-mtb-page-title{
    min-width:0!important;
    flex:1 1 auto!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-page-title h1{
    font-size:18px!important;
    line-height:1.12!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    margin:0!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-page-title p{
    display:none!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-top-actions{
    flex:0 0 auto!important;
    gap:6px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-search{
    display:none!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-top-btn{
    width:42px!important;
    height:42px!important;
    min-height:42px!important;
    padding:0!important;
    border-radius:15px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-top-btn span,
  body.edivic-mtb-nav-ready .edv-mtb-user-chip div:not(.edv-mtb-avatar){
    display:none!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-user-chip{
    width:42px!important;
    height:42px!important;
    padding:0!important;
    justify-content:center!important;
    border-radius:15px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-user-chip .edv-mtb-avatar{
    width:32px!important;
    height:32px!important;
    font-size:12px!important;
  }

  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane{
    position:fixed!important;
    left:0!important;
    right:0!important;
    top:var(--edv-mtb-topbar-h,64px)!important;
    bottom:0!important;
    width:100%!important;
    height:auto!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior:contain!important;
    padding:12px!important;
    background:#f6f8fb!important;
  }

  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane > main,
  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane main.main-content,
  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane .main-content,
  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane .dashboard,
  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane .dashboard-main,
  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane .project-page,
  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane .projects-page,
  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane .settings-page,
  body.edivic-mtb-nav-ready .edv-mtb-scroll-pane .profile-page{
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
    padding:12px!important;
    border-radius:0!important;
    box-sizing:border-box!important;
  }

  body.edivic-mtb-nav-ready .edv-mtb-sidebar{
    position:fixed!important;
    top:0!important;
    left:0!important;
    bottom:auto!important;
    width:286px!important;
    max-width:calc(100vw - 42px)!important;
    height:100dvh!important;
    min-height:100dvh!important;
    max-height:100dvh!important;
    overflow:hidden!important;
    overscroll-behavior:none!important;
    padding:14px 12px!important;
    z-index:2147483000!important;
    transform:translate3d(-110%,0,0)!important;
  }
  body.edv-mtb-sidebar-open .edv-mtb-sidebar{
    transform:translate3d(0,0,0)!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-sidebar-brand{
    padding:4px 6px 10px!important;
    margin-bottom:5px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-logo-mark{
    width:40px!important;
    height:40px!important;
    border-radius:14px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-sidebar-brand h3{
    font-size:15px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-sidebar-brand small{
    font-size:10px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-nav-title{
    padding:7px 8px 4px!important;
    font-size:9px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-nav-link{
    min-height:34px!important;
    padding:7px 9px!important;
    margin:1px 0!important;
    border-radius:12px!important;
    gap:9px!important;
    font-size:12px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-nav-link i{
    font-size:13px!important;
    width:17px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-sidebar-bottom{
    padding-top:6px!important;
  }
  body.edivic-mtb-nav-ready .edv-mtb-side-chip{
    padding:6px 8px!important;
  }

  .cards, .stats-grid, .analytics-grid, .projects-grid, .editors-grid, .dashboard-grid,
  .settings-grid, .profile-grid{
    grid-template-columns:1fr!important;
    gap:14px!important;
  }
  .card, .stat-card, .project-card, .editor-card, .dashboard-card, .settings-card, .detail-card,
  .pricing-card, .glass-card{
    width:100%!important;
    max-width:100%!important;
    border-radius:22px!important;
    box-sizing:border-box!important;
  }
  img, video, canvas, iframe{
    max-width:100%!important;
  }
  input, select, textarea, button{
    max-width:100%!important;
  }

  .chat-container, .messages-shell, .chat-shell{
    width:100%!important;
    max-width:100%!important;
    min-height:auto!important;
  }
  .chat-footer{
    bottom:0!important;
  }
}

@media (max-width: 768px){
  /* The global mobile CSS hides all footers; home page footer is required. */
  body.edv-page-index .footer,
  body.edivic-no-sidebar-page.edv-page-index .footer,
  body.edivic-mtb-home-no-sidebar.edv-page-index .footer{
    display:block!important;
    visibility:visible!important;
    margin:24px 0 0!important;
    padding:36px 18px calc(28px + env(safe-area-inset-bottom,0px))!important;
    background:linear-gradient(180deg,#162334,#0f172a)!important;
    color:#e5edf6!important;
    border-radius:30px 30px 0 0!important;
  }
  body.edv-page-index .footer .footer-content{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:26px!important;
    padding:0!important;
    width:100%!important;
    max-width:100%!important;
  }
  body.edv-page-index .footer h3,
  body.edv-page-index .footer h4{
    color:#FEBD69!important;
    margin-bottom:12px!important;
  }
  body.edv-page-index .footer p{
    color:#cbd5e1!important;
    font-size:13px!important;
    line-height:1.65!important;
  }
  body.edv-page-index .footer a{
    display:flex!important;
    align-items:center!important;
    gap:10px!important;
    padding:8px 0!important;
    color:#e2e8f0!important;
    text-decoration:none!important;
    font-size:14px!important;
  }
  body.edv-page-index .footer .social-icons{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:12px!important;
    margin-top:18px!important;
  }
  body.edv-page-index .footer .social-icons a{
    width:44px!important;
    height:44px!important;
    padding:0!important;
    display:grid!important;
    place-items:center!important;
    border-radius:16px!important;
    background:rgba(255,255,255,.08)!important;
    border:1px solid rgba(255,255,255,.10)!important;
  }
  body.edv-page-index .footer .social-icons i{
    font-size:20px!important;
  }
  body.edv-page-index .footer .copyright{
    margin-top:22px!important;
    padding-top:18px!important;
    border-top:1px solid rgba(255,255,255,.10)!important;
    text-align:left!important;
  }
}
