/* KAVIR V36.5.89 — adaptive admin workspace width and smooth right drawer.
   UI-only: preserves all admin routes, CRM logic, permissions, API and database. */

/* Desktop: the drawer is an overlay, but its former grid column is reserved only
   while it is open. When closed, the main workspace grows into the full viewport. */
@media (min-width: 1025px) {
  #adminScreen .admin-layout {
    display: grid !important;
    grid-template-columns: 0px minmax(0, 1fr) !important;
    align-items: start !important;
    min-width: 0 !important;
    transition: grid-template-columns 420ms cubic-bezier(.22, 1, .36, 1) !important;
  }

  #adminScreen .admin-main {
    grid-column: 2 !important;
    width: 100% !important;
    max-width: 2000px !important;
    min-width: 0 !important;
    margin-inline: auto !important;
    transition:
      max-width 420ms cubic-bezier(.22, 1, .36, 1),
      padding 260ms ease !important;
  }

  /* Opening the menu restores the familiar content width while the drawer
     occupies its right-side lane. Closing it animates the content to full width. */
  #adminScreen.kv-v12-admin-nav-open .admin-layout {
    grid-template-columns: minmax(0, 350px) minmax(0, 1fr) !important;
  }

  #adminScreen.kv-v12-admin-nav-open .admin-main {
    max-width: 1400px !important;
    margin-inline: auto 0 !important;
  }

  /* Keep the fixed drawer smooth without animating layout-heavy properties. */
  #adminScreen .admin-side {
    backface-visibility: hidden;
    transform: translate3d(calc(100% + 48px), 0, 0) !important;
    transition:
      transform 380ms cubic-bezier(.22, 1, .36, 1),
      opacity 240ms ease,
      visibility 380ms linear !important;
  }

  #adminScreen.kv-v12-admin-nav-open .admin-side {
    transform: translate3d(0, 0, 0) !important;
  }
}

/* Tablet and mobile keep the existing full-width page and overlay drawer. */
@media (max-width: 1024px) {
  #adminScreen .admin-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #adminScreen .admin-main {
    grid-column: 1 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #adminScreen .admin-layout,
  #adminScreen .admin-main,
  #adminScreen .admin-side {
    transition: none !important;
  }
}
