/*
 * FINAL V67 — profile vehicle dialog: native centering + internal scroll only.
 *
 * The original Radix/Tailwind dialog already centers itself with:
 *   left:50%; top:50%; translate:-50% -50%
 * Previous V64/V65 fixes added transform:translate(-50%,-50%) on top of that,
 * which applied the centering twice and pushed the popup off-screen.
 *
 * V67 keeps ONE centering mechanism only (CSS `translate`) and limits the
 * vehicle form to the visible viewport so the form itself scrolls naturally.
 */

[role="dialog"].v59-vehicle-dialog-scroll{
  /* One centering system only. This also neutralizes stale transform rules. */
  position:fixed!important;
  left:50%!important;
  top:50%!important;
  right:auto!important;
  bottom:auto!important;
  translate:-50% -50%!important;
  transform:none!important;
  margin:0!important;

  /* The popup is the scroll container — never the page behind it. */
  height:auto!important;
  max-height:calc(100dvh - 32px)!important;
  min-height:0!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-y!important;
  pointer-events:auto!important;
  box-sizing:border-box!important;
  scroll-behavior:auto!important;
  scroll-padding-block:16px 28px!important;
  scrollbar-gutter:auto!important;
}

/* Neutralize helper UI/classes left by earlier mobile-dialog experiments. */
[role="dialog"].v59-vehicle-dialog-scroll .v60-scroll-hint,
[role="dialog"].v59-vehicle-dialog-scroll .v65-close-button{
  display:none!important;
}

/* Never let an old sticky-save class cover the last upload field. */
[role="dialog"].v59-vehicle-dialog-scroll .v65-sticky-save{
  position:static!important;
  inset:auto!important;
  margin-top:14px!important;
  box-shadow:none!important;
}

[role="dialog"].v59-vehicle-dialog-scroll > *,
[role="dialog"].v59-vehicle-dialog-scroll form,
[role="dialog"].v59-vehicle-dialog-scroll .grid{
  min-width:0!important;
  min-height:0!important;
}

/* Phone / narrow tablet: leave a clean gap around the card and scroll inside. */
@media (max-width:700px){
  [role="dialog"].v59-vehicle-dialog-scroll{
    width:calc(100vw - 24px)!important;
    max-width:520px!important;
    max-height:calc(100dvh - 24px)!important;
    padding:18px 16px calc(22px + env(safe-area-inset-bottom))!important;
    border-radius:20px!important;
  }
}

/* Very small phones need a little more usable width without touching edges. */
@media (max-width:380px){
  [role="dialog"].v59-vehicle-dialog-scroll{
    width:calc(100vw - 14px)!important;
    max-width:calc(100vw - 14px)!important;
    max-height:calc(100dvh - 14px)!important;
    padding-inline:14px!important;
  }
}
